I would like to change the font in Emacs from within a major mode. I am using Emacs 24.3 on Ubuntu 12.04.
I tried set-frame-font, like:
(set-frame-font "DejaVu Sans Mono-10")
But I get error:
Debugger entered--Lisp error: (error "Font not available" #<font-spec nil nil DejaVu\ Sans\ Mono nil nil nil nil nil 10.0 nil nil nil ((:name . "DejaVu Sans Mono-10") (user-spec . "DejaVu Sans Mono-10"))>)
internal-set-lisp-face-attribute(default :font "DejaVu Sans Mono-10" #<frame emacs-24.3#cipr064219.klientdrift.uib.no 0x116a4c0>)
The output of fc-list is:
fc-list | grep 'DejaVu Sans Mono'
DejaVu Sans Mono:style=Bold Oblique
DejaVu Sans Mono:style=Oblique
DejaVu Sans Mono:style=Book
DejaVu Sans Mono:style=Bold
It sounds like you've built Emacs without Xft support, which is required if you want to use anti-aliased, TrueType, and OpenType fonts.
Here is how you can build it with Xft:
Install the libxft-dev package, which contains the required Xft headers:
sudo apt-get install libxft-dev
Build Emacs as before, but this time include the --with-xft flag in your ./configure command.
Now your Emacs should be able to use TrueType and OpenType fonts, including DejaVu Sans Mono.
Related
When convert pdf page to image, if a Font is not embedded in the input pdf, default Font substitution (usually Arial) is used. However, I want to change the default font.
There is a description here but it is too few information. I don't know how to create and where to put the config file.
OS: Ubuntu 18.04
The page you mentioned saved me, thanks!
Here is how:
As they indicate, what is needed is to configure fontconfig. I can't be sure for Ubuntu, but for Debian this means creating or editing this file :
/etc/fonts/local.conf
For the font substitution, you just need to include something like this example:
<alias>
<family>Helvetica</family>
<accept><family>Nimbus Sans L</family></accept>
</alias>
Where the Helvetica family would be substituted by the 'Nimbus Sans L' family.
To check that it works, you may use a PDF file containing e.g. Helvetica, and type:
pdffonts -subst <yourfile>.pdf
This will list the fonts substitutions. In my case, it worked just fine, with poppler now doing the right substitution.
For Fedora, I created ~/.config/fontconfig/fonts.conf with following content:
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
<match target="pattern">
<test name="family">
<string>Helvetica</string>
</test>
<edit name="family" mode="prepend" binding="strong">
<string>Liberation Sans</string>
</edit>
</match>
</fontconfig>
It worked fine, tested with fc-match Helvetica and pdffonts -subst <yourfile>.pdf
I recommend the arch linux wiki for more font configuration info.
My Emacs (24.5) on Ubuntu16.04 complains that
Company backend 'company-lua' could not be initialized:
Company found no Lua executable
I have installed and lua-mode company-lua via MELPA. The lua executable in my environment is /usr/bin/lua5.3, and there is no shortcut called lua,
and I cannot create shortcuts for environmental reasons.
Is there a way to let company-lua know the correct name or pathname for the Lua executable?
From its website, company-lua does not seem to have a variable for setting Lua executable names as lua-mode has.
From company-lua.el, I saw the following mentions of version, which seem to be wrong in 5.3. Is this something I should modify to fix the problem?
(defcustom company-lua-interpreter 'lua52
"Lua interpreter."
:group 'company-lua
:type '(choice (const :tag "Lua 5.1" lua51)
(const :tag "Lua 5.2" lua52)
(const :tag "Lua 5.2" lua53)
(const :tag "LÖVE" love))
:safe #'symbolp)
As suggested by #EgorSkriptunoff, the problem is solved when modifying company-lua-executable variable to the right version of Lua, e.g. by adding the following the Emacs init file:
(custom-set-variables '(company-lua-executable (executable-find "lua5.3") ) )
I used to use Emacs in windows, recently I want to try Ubuntu 14.04. I used the same settings, same init.el, same packages. but I got an error when start Emacs under Ubuntu.
I am not an elisp programmer, and I hope I can get some help here. I am using Prelude for Emacs 24, but even I run emacs with -Q, the same error is still there....
The errors are as follows:
Debugger entered--Lisp error: (invalid-function "abbrev")
"abbrev"("convenience" "matching")
byte-code("\300\301\302\303\304\305\306\307\310\311\312\"&\207" [define-package "company" "20140731.944" "Modular text completion framework" ((emacs "24.1") (cl-lib "0.5")) :url "http://company-mode.github.io/" :keywords "abbrev" "convenience" "matching"] 11)
load("/home/zhijia/.emacs.d/elpa/company-20140731.944/company-pkg" nil t)
package-load-descriptor("/home/zhijia/.emacs.d/elpa" "company-20140731.944")
package-maybe-load-descriptor("company" "20140731.944" "/home/zhijia/.emacs.d/elpa")
package-load-all-descriptors()
package-initialize()
byte-code("\302\303!\210\302\304!\210\305\306\307\310#\210\311\312\"\313 \207" [prelude-dir package-user-dir require cl package add-to-list package-archives ("melpa" . "http://melpa.milkbox.net/packages/") t expand-file-name "elpa" package-initialize] 4)
require(prelude-packages)
eval-buffer(#<buffer *load*> nil "/home/zhijia/.emacs.d/init.el" nil t) ; Reading at buffer position 4156
load-with-code-conversion("/home/zhijia/.emacs.d/init.el" "/home/zhijia/.emacs.d/init.el" nil nil)
load("/home/zhijia/.emacs.d/init.el" nil nil t)
load-file("~/.emacs.d/init.el")
call-interactively(load-file record nil)
command-execute(load-file record)
execute-extended-command(nil "load-file")
call-interactively(execute-extended-command nil nil)
Delete ~/.emacs.d/elpa, restart Emacs, and let Prelude install all packages again.
It looks like you've stumbled across incompatibilities between package.el in different Emacs versions. I'm not sure why, though. Normally errors like this only occur when upgrading from Emacs 23 to 24, or when upgrading from Emacs 24.3 to the (not yet released) Emacs 24.4. Neither of these seem to be the case here, though.
You are getting this error with emacs -Q as well, because emacs -Q still loads all user-installed packages from ~/.emacs.d/elpa.
It seems you need to remove the ~/emacs.d/elpa/company-XXX and re-install it.
Even if you call it with -Q, it still has a startup file that checks the ~/.emacs.d/ directory.
Try first to remove the .elc files before to remove everything.
I've been trying to get the CEDET working with a simple project for the last little while. I have the following project file:
(ede-cpp-root-project "aesalon-project"
:name "aesalon-name"
:file "~/projects/aesalon/SConstruct"
:include-path '("/"
"/include/"))
I've been loading the above into a buffer and executing the buffer contents. The problem is not with the project not loading correctly -- it seems to bet set up properly; I can change the settings etc. using the menubar. When I try to rescan the project's files, however, I get the following error:
Debugger entered--Lisp error: (wrong-type-argument class-p ede-cpp-root)
signal(wrong-type-argument (class-p ede-cpp-root))
child-of-class-p(ede-cpp-root-project ede-cpp-root)
object-of-class-p([object ede-cpp-root-project "aesalon-project" nil "aesalon-name" "1.0" "/home/ethereal/projects/aesalon/" 3546321 "/home/ethereal/projects/aesalon/SConstruct" nil nil nil unbound unbound "" "" "" "" "" "" ("debug" "release") "debug" nil ("/" "/include/") nil nil nil "\\.\\(h\\(h\\|xx\\|pp\\|\\+\\+\\)?\\|H\\)$\\|\\<\\w+$" nil] ede-cpp-root)
ede-toplevel-project("~/projects/aesalon/")
ede-rescan-toplevel()
call-interactively(ede-rescan-toplevel nil nil)
I find this somewhat odd, as when I look at the documentation for ede-cpp-root-project I see that it has ede-project as its parent, not ede-cpp-root? Or am I misunderstanding the trace? I'm not very familiar with Emacs Lisp.
Here's my output from cedet-version:
CEDET Version: 1.0
Requested File Loaded
Package Version Version Version
----------------------------------------------------------
cedet: 1.0 ok ok
eieio: 1.3 ok ok
semantic: 2.0 ok ok
srecode: 1.0 ok ok
ede: 1.0 ok ok
speedbar: 1.0.3 ok ok
cogre: 1.0 ok Not Loaded
cedet-contrib: 1.0 ok Not Loaded
C-h f cedet-version RET
for details on output format.
And my emacs version: (latest from Arch Linux repositories)
GNU Emacs 23.4.1 (x86_64-unknown-linux-gnu, GTK+ Version 2.24.9) of 2012-02-01 on shirley.hoetzel.info
Does anyone have any suggestions on how I could go about fixing this issue? Is it a problem with my project? My CEDET environment? Version of emacs?
Apparently the problem is inconsistencies in EDE and CEDET. As best I can tell, the version of the CEDET that I was using was relying on an old architecture of EDE that has since been changed.
Compiling the CEDET from the latest source tree instead of the (older) snapshot I was using fixed the problem.
I've just installed the new Aquamacs 2.0 in my Mac Os X 10.6.3 and I'm
an happy user of IDLWAVE on Aquamacs for programming in IDL.
Unfortunately I run into a problem which I can't understand.
I used in my configuration file to put the following
(setq idlwave-surround-by-blank t)
for the beautiful space around operator.
This used to work till
Aquamacs 2.0 preview b3 (third beta release)
from that on, it stops to work and every time I type an operator (the
same for '=' '<' '>' etc) I got the following message
Debugger entered--Lisp error: (void-variable idlwave-expand-equal)
(lambda nil (interactive) (self-insert-command 1) idlwave-expand- equal -1 -1)()
call-interactively((lambda nil (interactive) (self-insert-command 1)
idlwave-expand-equal -1 -1) nil nil)
Any help is welcommed
There was a bug introduced in Emacs 23.2. Try a newer version of the package or move to a version of Emacs based on 23.3 or 23.1.