Definindo a fonte padrão no Emacs

3

Estou usando o emacs 23.2.1 com o quack no Linux e tentando definir meu tipo padrão para o Inconsolata Medium 13. Ele é instalado no meu sistema (sid do Debian) e pode ser configurado manualmente por buffer no emacs.

No entanto, gostaria que fosse usado por toda parte e por padrão. Minha suspeita é que o modo de charlatão é de alguma forma conflitante.

Pesquisei bastante procurando informações sobre personalização de fontes no emacs. Embora haja documentação e exemplos por aí, eu os considero bastante incoerentes quando tomados em conjunto e nada especificamente abordando esse problema.

Aqui está meu .emacs

(set-default-font "Inconsolata-13")

;;; Turn on visible-bell, get rid of beeps
(setq visible-bell t)

;;; Hilight the selected region
(setq transient-mark-mode t)

;;; Get rid of tool-bar
(tool-bar-mode -1)

;;; Show matched parens
(show-paren-mode 1)

;;; Avoid iconizing emacs.
(global-unset-key "\C-z")

;;; Jump to a specific line of the current buffer
(global-set-key "\M-g" 'goto-line)

;;; Tabs are evil?
;;; Use spaces instead of tabs for indentation.
(setq indent-tabs-mode nil) 

;;; Turn on syntax-highlighting.
(global-font-lock-mode t)
(load-library "font-lock")
(setq font-lock-maximum-decoration t)

;;; load xscheme library

(require 'xscheme)

;;; Scheme-specific customization

;;; Load the Quack mode, which is an advanced Scheme mode.
(require 'quack)

;;; Loading/creating a file/buffer whose name ends with '.ss'
;;; automagically switches Emacs to Scheme mode.
(setq auto-mode-alist (cons '("\.ss" . scheme-mode) auto-mode-alist))

;;; Change the program name string below to point to Petite Chez
;;; Scheme on your machine.  For example, Will uses the string
;;; "/usr/bin/petite" on his laptop running Mac OS X.
(setq scheme-program-name "mit-scheme")

;;; Teach Emacs how to properly indent
;;; certain Scheme special forms
;;; (such as 'pmatch')
(put 'cond 'scheme-indent-function 0)
(put 'for-each 'scheme-indent-function 0)
(put 'pmatch 'scheme-indent-function 1)
(put 'match 'scheme-indent-function 1)
(put 'union-case 'scheme-indent-function 2)
(put 'cases 'scheme-indent-function 1)
(put 'let-values 'scheme-indent-function 1)
(put 'call-with-values 'scheme-indent-function 2)
(put 'syntax-case 'scheme-indent-function 2)
(put 'test 'scheme-indent-function 1)
(put 'test-check 'scheme-indent-function 1)
(put 'test-divergence 'scheme-indent-function 1)
(put 'make-engine 'scheme-indent-function 0)
(put 'with-mutex 'scheme-indent-function 1)
(put 'trace-lambda 'scheme-indent-function 1)
(put 'timed-lambda 'scheme-indent-function 1)
(put 'tlambda 'scheme-indent-function 1)


;;; For folks who like pretty colors on their screens:

(require 'color-theme)
(color-theme-initialize)
(color-theme-dark-blue2)

(if (fboundp 'global-font-lock-mode)
    (global-font-lock-mode 1); Emacs    
    (setq font-lock-auto-fontify t)); XEmacs

(custom-set-variables
  ;; custom-set-variables was added by Custom.
  ;; If you edit it by hand, you could mess it up, so be careful.
  ;; Your init file should contain only one such instance.
  ;; If there is more than one, they won't work right.
 '(column-number-mode t)
 '(paren-blinking "t" t)
 '(paren-matching t t)
 '(quack-default-program "mit-scheme")
 '(quack-fontify-style (quote emacs))
 '(quack-pltish-fontify-keywords-p t)
 '(quack-pltish-keywords-to-fontify (quote ("and" "begin" "begin0" "c-declare" "c-lambda" "call-with-current-continuation" "call-with-input-file" "call-with-output-file" "call/cc" "case" "case-lambda" "class" "class*" "class*/names" "class100" "class100*" "compound-unit/sig" "cond" "cond-expand" "define" "define-macro" "define-module" "define-public" "define-signature" "define-struct" "define-syntax" "define-syntax-set" "define-values" "define-values/invoke-unit/sig" "define/contract" "define/override" "define/private" "define/public" "delay" "do" "else" "exit-handler" "field" "if" "import" "inherit" "inherit-field" "init" "init-field" "init-rest" "instantiate" "interface" "lambda" "let" "let*" "let*-values" "let+" "let-syntax" "let-values" "let/ec" "letrec" "letrec-values" "letrec-syntax" "match" "match-lambda" "match-lambda*" "match-let" "match-let*" "match-letrec" "match-define" "mixin" "module" "opt-lambda" "or" "override" "override*" "namespace-variable-bind/invoke-unit/sig" "parameterize" "private" "private*" "protect" "provide" "provide-signature-elements" "provide/contract" "public" "public*" "quote" "receive" "rename" "require" "require-for-syntax" "send" "send*" "set!" "set!-values" "signature->symbols" "super-instantiate" "syntax-case" "syntax-case*" "syntax-error" "syntax-rules" "unit/sig" "unless" "when" "with-handlers" "with-method" "with-syntax")))
 '(quack-pretty-lambda-p nil)
 '(quack-programs (quote ("petite" "bigloo" "csi" "gosh" "gsi" "guile" "kawa" "mit-scheme" "mred -z" "mzscheme" "mzscheme -M errortrace" "rs" "scheme" "scheme48" "scsh" "sisc" "stklos" "sxi")))
 '(quack-remap-find-file-bindings-p nil)
 '(quack-run-scheme-always-prompts-p nil)
 '(quack-switch-to-scheme-method (quote cmuscheme)))

(custom-set-faces
  ;; custom-set-faces was added by Custom.
  ;; If you edit it by hand, you could mess it up, so be careful.
  ;; Your init file should contain only one such instance.
  ;; If there is more than one, they won't work right.
 '(default ((t (:inherit nil :stipple nil :background "#233b5a" :foreground "#fff8dc" :inverse-video nil :box nil :strike-through nil :overline nil :underline nil :slant normal :weight normal :height 109 :width normal :foundry "unknown" :family "DejaVu Sans Mono"))))
 '(quack-pltish-comment-face ((((class color) (background dark)) (:slant italic))))
 '(quack-pltish-defn-face ((t (:foreground "purple1" :weight bold))))
 '(quack-pltish-keyword-face ((t (:foreground "cyan"))))
 '(quack-pltish-paren-face ((((class color) (background dark)) (:foreground "cyan3"))))
 '(quack-pltish-selfeval-face ((((class color) (background dark)) (:foreground "green"))))
 '(quack-threesemi-semi-face ((((class color) (background dark)) (:background "white" :foreground "white" :box nil))))
 '(quack-threesemi-text-face ((((class color) (background dark)) (:background "cyan4" :foreground "white" :box nil)))))
    
por ryanklee 02.04.2011 / 21:42

2 respostas

1

Eu também trabalho com uma fonte diferente, o comando no meu .emacs é

(set-face-font 'default "-misc-fixed-medium-r-normal--20-*-*-*-c-100-iso8859-1")
    
por 03.04.2011 / 01:44
1

Embora isso possa não ajudar você a colocar sua fonte específica em funcionamento, espero que você a considere útil em geral.

Eu tenho isso no meu .emacs (que eu uso em muitos sistemas) para portabilidade. Ele procura por uma determinada fonte na lista e aplica qualquer uma que encontre ao padrão.

Peço desculpas pelo loop de estilo não lisp; foi há muito tempo atrás.

(defun font-existsp (font)
  "Check that a font exists: http://www.emacswiki.org/emacs/SetFonts#toc8"
  (and (window-system)
       (fboundp 'x-list-fonts)
       (x-list-fonts font)))

;;**************************************************
;; font Searching
;;**************************************************
(setq kjfletch-font-list
      '(;; List of fonts to search for in order of priority.
        ;; Each has it's own line for easy transposing.
        "Consolas-10"
        "ProggyOpti-8"
        "ProggyOptiS-8"
        "ProggyClean-10"
        "Consolas-8"
        "DejaVu Sans Mono-8"
        ;; "Lucida Console-8"
        "Courier New-8"
        ))

(let* ((in-loop t)
       (font (car kjfletch-font-list))
       (rest (cdr kjfletch-font-list)))
  (while (and font in-loop)
    (when (font-existsp font)
      (set-face-attribute 'default nil :font font)
      (setq in-loop nil))
    (setq font (car rest)
          rest (cdr rest))))
    
por 04.04.2011 / 14:12