+2013-06-05 Teodor Zlatanov <tzz@lifelogs.com>
+
+ * simple.el (prog-prettify-symbols): Add version.
+ (prog-prettify-install): Add convenience function to prettify symbols.
+
+ * progmodes/perl-mode.el (perl--augmented-font-lock-keywords)
+ (perl--augmented-font-lock-keywords-1)
+ (perl--augmented-font-lock-keywords-2, perl-mode): Remove unneeded
+ variables and use it.
+
+ * progmodes/cfengine.el (cfengine3--augmented-font-lock-keywords)
+ (cfengine3-mode): Remove unneeded variable and use it.
+
+ * emacs-lisp/lisp-mode.el (lisp--augmented-font-lock-keywords)
+ (lisp--augmented-font-lock-keywords-1)
+ (lisp--augmented-font-lock-keywords-2, lisp-mode-variables):
+ Remove unneeded variables and use it.
+
2013-06-05 Teodor Zlatanov <tzz@lifelogs.com>
* net/tls.el (open-tls-stream): Remove unneeded buffer contents up
font-lock-string-face))))
font-lock-comment-face))
-;; Temporary variables used to add font-lock keywords dynamically.
-(defvar lisp--augmented-font-lock-keywords)
-(defvar lisp--augmented-font-lock-keywords-1)
-(defvar lisp--augmented-font-lock-keywords-2)
-
(defun lisp-mode-variables (&optional lisp-syntax keywords-case-insensitive)
"Common initialization routine for lisp modes.
The LISP-SYNTAX argument is used by code in inf-lisp.el and is
(setq-local imenu-generic-expression lisp-imenu-generic-expression)
(setq-local multibyte-syntax-as-symbol t)
(setq-local syntax-begin-function 'beginning-of-defun)
- (setq-local prog-prettify-symbols-alist lisp--prettify-symbols-alist)
- (setq lisp--augmented-font-lock-keywords
- (append lisp-font-lock-keywords
- (prog-prettify-font-lock-symbols-keywords)))
- (setq lisp--augmented-font-lock-keywords-1
- (append lisp-font-lock-keywords-1
- (prog-prettify-font-lock-symbols-keywords)))
- (setq lisp--augmented-font-lock-keywords-2
- (append lisp-font-lock-keywords-2
- (prog-prettify-font-lock-symbols-keywords)))
+ (prog-prettify-install lisp--prettify-symbols-alist)
(setq font-lock-defaults
- `((lisp--augmented-font-lock-keywords
- lisp--augmented-font-lock-keywords-1
- lisp--augmented-font-lock-keywords-2)
+ `((lisp-font-lock-keywords
+ lisp-font-lock-keywords-1
+ lisp-font-lock-keywords-2)
nil ,keywords-case-insensitive nil nil
(font-lock-mark-block-function . mark-defun)
(font-lock-syntactic-face-function
("=>" . ?⇒)
("::" . ?∷)))
-(defvar cfengine3--augmented-font-lock-keywords)
-
;;;###autoload
(define-derived-mode cfengine3-mode prog-mode "CFE3"
"Major mode for editing CFEngine3 input.
(set (make-local-variable 'indent-line-function) #'cfengine3-indent-line)
- ;; Define the symbols to be prettified
- (setq-local prog-prettify-symbols-alist cfengine3--prettify-symbols-alist)
-
- ;; Tell font-lock.el how to handle cfengine3 keywords..
- (setq cfengine3--augmented-font-lock-keywords
- (append cfengine3-font-lock-keywords
- (prog-prettify-font-lock-symbols-keywords)))
-
(setq font-lock-defaults
- '(cfengine3--augmented-font-lock-keywords
+ '(cfengine3-font-lock-keywords
nil nil nil beginning-of-defun))
+ (prog-prettify-install cfengine3--prettify-symbols-alist)
;; Use defuns as the essential syntax block.
(set (make-local-variable 'beginning-of-defun-function)
(defvar perl-font-lock-keywords perl-font-lock-keywords-1
"Default expressions to highlight in Perl mode.")
-;; Temporary variables used to add font-lock keywords dynamically.
-(defvar perl--augmented-font-lock-keywords)
-(defvar perl--augmented-font-lock-keywords-1)
-(defvar perl--augmented-font-lock-keywords-2)
-
(defvar perl-quote-like-pairs
'((?\( . ?\)) (?\[ . ?\]) (?\{ . ?\}) (?\< . ?\>)))
(setq-local comment-indent-function #'perl-comment-indent)
(setq-local parse-sexp-ignore-comments t)
- ;; Define the symbols to be prettified.
- (setq-local prog-prettify-symbols-alist perl--prettify-symbols-alist)
-
;; Tell font-lock.el how to handle Perl.
- (setq perl--augmented-font-lock-keywords
- (append perl-font-lock-keywords
- (prog-prettify-font-lock-symbols-keywords)))
- (setq perl--augmented-font-lock-keywords-1
- (append perl-font-lock-keywords-1
- (prog-prettify-font-lock-symbols-keywords)))
- (setq perl--augmented-font-lock-keywords-2
- (append perl-font-lock-keywords-2
- (prog-prettify-font-lock-symbols-keywords)))
-
- (setq font-lock-defaults '((perl--augmented-font-lock-keywords
- perl--augmented-font-lock-keywords-1
- perl--augmented-font-lock-keywords-2)
+ (setq font-lock-defaults '((perl-font-lock-keywords
+ perl-font-lock-keywords-1
+ perl-font-lock-keywords-2)
nil nil ((?\_ . "w")) nil
(font-lock-syntactic-face-function
. perl-font-lock-syntactic-face-function)))
+ (prog-prettify-install perl--prettify-symbols-alist)
(setq-local syntax-propertize-function #'perl-syntax-propertize-function)
(add-hook 'syntax-propertize-extend-region-functions
#'syntax-propertize-multiline 'append 'local)
(const :tag "Mode defaults" t)
(alist :tag "Mode defaults augmented with your own list"
:key-type string :value-type character))
+ :version "24.4"
:group 'languages)
(defun prog--prettify-font-lock-compose-symbol (alist)
`((,(regexp-opt (mapcar 'car alist) t)
(0 (prog--prettify-font-lock-compose-symbol ',alist)))))))
+(defun prog-prettify-install (alist)
+ (setq-local prog-prettify-symbols-alist alist)
+ (font-lock-add-keywords nil (prog-prettify-font-lock-symbols-keywords)))
+
;; Making and deleting lines.
(defvar hard-newline (propertize "\n" 'hard t 'rear-nonsticky '(hard))