3

Я использую emacs 23.2.1 с кряком в Linux и пытаюсь установить в качестве шрифта по умолчанию Inconsolata Medium 13. Он установлен в моей системе (debian sid) и может быть установлен вручную для каждого буфера в emacs.

Тем не менее, я бы хотел, чтобы он использовался повсеместно и по умолчанию. Я подозреваю, что режим кряка как-то противоречив.

Я много раз искал информацию о настройке шрифтов в emacs. Хотя есть документация и примеры, я нашел их довольно непоследовательными, когда они взяты вместе, и ничего конкретного не касалось этой проблемы.

Вот мой .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)))))

2 ответа2

1

Хотя это может не помочь вам заставить ваш конкретный шрифт работать, я надеюсь, вы найдете его в целом полезным.

У меня есть это в моем .emacs (который я использую во многих системах) для переносимости. Он ищет заданный шрифт из списка и применяет любой найденный к значению по умолчанию.

Я прошу прощения за петли без стиля; это было очень давно.

(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))))
1

Я также работаю с другим шрифтом, команда в моем .emacs

(set-face-font 'default "-misc-fixed-medium-r-normal--20-*-*-*-c-100-iso8859-1")

Всё ещё ищете ответ? Посмотрите другие вопросы с метками .