>From address@hidden Thu Mar 02 20:21:49 2017 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [PATCH] Fix documents and add trivial improvements X-Mercurial-Node: a5f1df6d805ae7eca1e6aa475939d657f40c03f4 X-Mercurial-Series-Index: 1 X-Mercurial-Series-Total: 1 Message-Id: X-Mercurial-Series-Id: User-Agent: Mercurial-patchbomb/4.0.1 Date: Thu, 02 Mar 2017 20:21:49 +0900 From: Ikumi Keita To: dummy * font-latex.el (font-latex-deactivated-keyword-classes): Add keyword class biblatexnoarg, biblatex and slide-title to doc string. Use `buffer-string'. (font-latex-keyword-matcher): Mention that face attributes is accepted as FACE argument in doc string. (font-latex-make-built-in-keywords): Arrange doc string for generated defvar of `font-latex-match-*-keywords-local' depending on the keyword type. Remove spurious type declaration from generated defcustom of `font-latex-match-*-keywords'. Replace meaningless argument with nil and add doc string for generated defvar of `font-latex-match-*'. Replace redundant call to intern with literal quote of symbol. (font-latex-user-keyword-classes): Fix doc string. The accepted face argument is face attribute rather than font specification. Add doc string for generated defvar of `font-latex-match-*'. (font-latex-make-user-keywords): Replace backquote with quote where backquote is not necessary. (font-latex-add-keywords): Add keyword class biblatexnoarg to doc string. * doc/auctex.texi (): Update copyright year. (Deactivating defaults of built-in keyword classes): Add keyword class biblatexnoarg, biblatex and slide-title. Fix sample lisp code. (User-defined keyword classes): The accepted face argument is face attribute rather than font specification. diff --git a/doc/auctex.texi b/doc/auctex.texi --- a/doc/auctex.texi +++ b/doc/auctex.texi @@ -12,7 +12,7 @@ (version @value{VERSION} from @value{UPDATED}), a sophisticated TeX environment for Emacs. -Copyright @copyright{} 1992-1995, 2001, 2002, 2004-2016 +Copyright @copyright{} 1992-1995, 2001, 2002, 2004-2017 Free Software Foundation, Inc. @quotation @@ -2137,10 +2137,11 @@ described above. You can disable these defaults per class by customizing the variable @code{font-latex-deactivated-keyword-classes}. This is a list of strings for keyword classes to be deactivated. Valid -entries are "warning", "variable", "reference", "function" , -"sectioning-0", "sectioning-1", "sectioning-2", "sectioning-3", -"sectioning-4", "sectioning-5", "textual", "bold-command", -"italic-command", "math-command", "type-command", "bold-declaration", +entries are "warning", "variable", "biblatexnoarg", "biblatex", +"reference", "function" , "sectioning-0", "sectioning-1", +"sectioning-2", "sectioning-3", "sectioning-4", "sectioning-5", +"slide-title", "textual", "bold-command", "italic-command", +"math-command", "type-command", "bold-declaration", "italic-declaration", "type-declaration". You can also get rid of certain keywords only. For example if you want @@ -2151,7 +2152,9 @@ (eval-after-load "font-latex" '(setq-default font-latex-match-reference-keywords-local - (remove "footnote" font-latex-match-reference-keywords-local))) + (remove (TeX-assoc-string "footnote" + font-latex-match-reference-keywords-local) + font-latex-match-reference-keywords-local))) @end lisp But note that this means fiddling with @fontlatex{}'s internals and is @@ -2177,7 +2180,7 @@ name omitting the leading backslash or a list consisting of the command name and a string specifying the sequence of arguments for the command. -The face argument can either be an existing face or font specifications +The face argument can either be an existing face or face attributes made by you. (The latter option is not available on XEmacs.) There are three alternatives for the type of keywords---``Command with diff --git a/font-latex.el b/font-latex.el --- a/font-latex.el +++ b/font-latex.el @@ -440,11 +440,13 @@ (defcustom font-latex-deactivated-keyword-classes nil "List of strings for built-in keyword classes to be deactivated. -Valid entries are \"warning\", \"variable\", \"reference\", -\"function\" , \"sectioning-0\", \"sectioning-1\", \"sectioning-2\", -\"sectioning-3\", \"sectioning-4\", \"sectioning-5\", \"textual\", -\"bold-command\", \"italic-command\", \"math-command\", \"type-command\", -\"bold-declaration\", \"italic-declaration\", \"type-declaration\". +Valid entries are \"warning\", \"variable\", \"biblatexnoarg\", +\"biblatex\", \"reference\", \"function\" , \"sectioning-0\", +\"sectioning-1\", \"sectioning-2\", \"sectioning-3\", +\"sectioning-4\", \"sectioning-5\", \"slide-title\", \"textual\", +\"bold-command\", \"italic-command\", \"math-command\", +\"type-command\", \"bold-declaration\", \"italic-declaration\", +\"type-declaration\". You have to restart Emacs for a change of this variable to take effect." :group 'font-latex-keywords @@ -470,8 +472,7 @@ x)) (nth 1 spec) ", ")) (fill-paragraph nil) - (buffer-substring-no-properties - (point-min) (point-max)))) + (buffer-string))) ,(car spec))) font-latex-built-in-keyword-classes))) @@ -529,11 +530,12 @@ (defun font-latex-keyword-matcher (prefix name face type) "Return a matcher and highlighter as required by `font-lock-keywords'. PREFIX and NAME are strings which are concatenated to form the -respective match function. FACE is a face name or a list of text -properties that will be applied to the respective part of the -match returned by the match function. TYPE is the type of -construct to be highlighted. Currently the symbols 'command, -'sectioning, 'declaration and 'noarg are valid. +respective match function. FACE is a face name or a list of face +attributes that will be applied to the respective part of the +match returned by the match function. A lisp form returning a +face name or a list of face attributes is also valid for FACE. +TYPE is the type of construct to be highlighted. Currently the +symbols 'command, 'declaration and 'noarg are valid. This is a helper function for `font-latex-make-built-in-keywords' and `font-latex-make-user-keywords' and not intended for general @@ -579,14 +581,18 @@ (eval `(defvar ,(intern (concat prefix name "-keywords-local")) ',keywords ,(concat "Buffer-local keywords to add to `" - prefix name "-keywords'. - + prefix name "-keywords'.\n\n" + (if (eq type 'command) + "\ This must be a list where each element is a list consisting of a keyword string \(not a regular expression\) omitting the leading -backslash and a format specifier as. The options for the format -specifier are described in the doc string of -`font-latex-user-keyword-classes'. +backslash and a format specifier as described in the doc string of +`font-latex-user-keyword-classes'." + "\ +This must be a list where each element is a keyword string \(not a +regular expression\) omitting the leading backslash.") + "\n\n\ This is an internal variable which should not be set directly. Use `font-latex-add-keywords' instead. @@ -643,7 +649,6 @@ Emacs. Generated by `font-latex-make-built-in-keywords'.") - :type '(repeat (string :tag "Keyword")) :type '(repeat ,(if (eq type 'command) '(list (string :tag "Keyword") (string :tag "Format")) @@ -654,8 +659,11 @@ :group 'font-latex-keywords)) ;; defvar font-latex-match-* - (eval `(defvar ,(intern (concat prefix name)) - ,(intern (concat prefix name "-keywords")))) + (eval `(defvar ,(intern (concat prefix name)) nil + ,(concat "Regular expression to match " name + " keywords. + +Generated by `font-latex-make-built-in-keywords'"))) (make-variable-buffer-local (intern (concat prefix name))) ;; defun font-latex-match-* @@ -668,7 +676,7 @@ (number-to-string level))) keywords-entry t) (when (= level 1) - (add-to-list (intern (concat "font-latex-keywords-2")) + (add-to-list 'font-latex-keywords-2 keywords-entry t)))))) (font-latex-make-built-in-keywords) @@ -699,8 +707,8 @@ \"|\". As an example, the specifier for \\newcommand is \"*|{\\=\\[[{\". -The face argument can either be an existing face or a font -specification. (The latter option is not available in XEmacs.) +The face argument can either be an existing face or a face +attribute. (The latter option is not available in XEmacs.) There are three alternatives for the class type: @@ -760,7 +768,11 @@ (dolist (elt value) (unless (boundp (intern (concat prefix (car elt)))) ;; defvar font-latex-match-* - (eval `(defvar ,(intern (concat prefix (car elt))) nil))) + (eval `(defvar ,(intern (concat prefix (car elt))) nil + ,(concat "Regular expression to match " (car elt) + " keywords. + +Generated by `font-latex-user-keyword-classes'")))) (let ((keywords (nth 1 elt)) single-char-macro-flag) (setq keywords (if (listp (car keywords)) @@ -815,7 +827,7 @@ (add-to-list 'font-latex-keywords-1 item) (add-to-list 'font-latex-keywords-2 item)) (dolist (item - `((font-latex-match-math-env + '((font-latex-match-math-env (0 'font-latex-warning-face t t) (1 'font-latex-math-face append t)) (font-latex-match-math-envII @@ -833,11 +845,12 @@ "Add KEYWORDS to CLASS. KEYWORDS is a list of keywords or keywords with syntax specs. CLASS corresponds to a keyword class and can be one of the -symbols 'warning, 'variable, 'reference, 'biblatex, 'function, -'sectioning-0, 'sectioning-1, 'sectioning-2, 'sectioning-3, -'sectioning-4, 'sectioning-5, 'slide-title, 'textual, -'bold-command, 'italic-command, 'math-command, 'type-command, -'bold-declaration, 'italic-declaration or 'type-declaration. +symbols 'warning, 'variable, 'reference, 'biblatexnoarg, +'biblatex, 'function, 'sectioning-0, 'sectioning-1, +'sectioning-2, 'sectioning-3, 'sectioning-4, 'sectioning-5, +'slide-title, 'textual, 'bold-command, 'italic-command, +'math-command, 'type-command, 'bold-declaration, +'italic-declaration or 'type-declaration. The keywords will be added to the buffer-local list of keywords of the respective keyword class and necessary updates of the font