Mercurial > emacs
annotate lisp/epg-config.el @ 110305:b10051866f51
New syntax-propertize functionality.
* lisp/font-lock.el (font-lock-syntactic-keywords): Make obsolete.
(font-lock-fontify-syntactic-keywords-region): Move handling of
font-lock-syntactically-fontified to...
(font-lock-default-fontify-region): ...here.
Let syntax-propertize-function take precedence.
(font-lock-fontify-syntactically-region): Cal syntax-propertize.
* lisp/emacs-lisp/regexp-opt.el (regexp-opt-depth): Skip named groups.
* lisp/emacs-lisp/syntax.el (syntax-propertize-function)
(syntax-propertize-chunk-size, syntax-propertize--done)
(syntax-propertize-extend-region-functions): New vars.
(syntax-propertize-wholelines, syntax-propertize-multiline)
(syntax-propertize--shift-groups, syntax-propertize-via-font-lock)
(syntax-propertize): New functions.
(syntax-propertize-rules): New macro.
(syntax-ppss-flush-cache): Set syntax-propertize--done.
(syntax-ppss): Call syntax-propertize.
* lisp/progmodes/ada-mode.el (ada-set-syntax-table-properties)
(ada-after-change-function, ada-initialize-syntax-table-properties)
(ada-handle-syntax-table-properties): Only define when
syntax-propertize is not available.
(ada-mode): Use syntax-propertize-function.
* lisp/progmodes/autoconf.el (autoconf-mode):
Use syntax-propertize-function.
(autoconf-font-lock-syntactic-keywords): Remove.
* lisp/progmodes/cfengine.el (cfengine-mode):
Use syntax-propertize-function.
(cfengine-font-lock-syntactic-keywords): Remove.
* lisp/progmodes/cperl-mode.el (cperl-mode): Use syntax-propertize-function.
* lisp/progmodes/fortran.el (fortran-mode): Use syntax-propertize-function.
(fortran--font-lock-syntactic-keywords): New var.
(fortran-line-length): Update syntax-propertize-function and
fortran--font-lock-syntactic-keywords.
* lisp/progmodes/gud.el (gdb-script-syntax-propertize-function): New var;
replaces gdb-script-font-lock-syntactic-keywords.
(gdb-script-mode): Use it.
* lisp/progmodes/js.el (js--regexp-literal): Define while compiling.
(js-syntax-propertize-function): New var; replaces
js-font-lock-syntactic-keywords.
(js-mode): Use it.
* lisp/progmodes/make-mode.el (makefile-syntax-propertize-function):
New var; replaces makefile-font-lock-syntactic-keywords.
(makefile-mode): Use it.
(makefile-imake-mode): Adjust.
* lisp/progmodes/mixal-mode.el (mixal-syntax-propertize-function): New var;
replaces mixal-font-lock-syntactic-keywords.
(mixal-mode): Use it.
* lisp/progmodes/octave-mod.el (octave-syntax-propertize-sqs): New function
to replace octave-font-lock-close-quotes.
(octave-syntax-propertize-function): New function to replace
octave-font-lock-syntactic-keywords.
(octave-mode): Use it.
* lisp/progmodes/perl-mode.el (perl-syntax-propertize-function): New fun to
replace perl-font-lock-syntactic-keywords.
(perl-syntax-propertize-special-constructs): New fun to replace
perl-font-lock-special-syntactic-constructs.
(perl-font-lock-syntactic-face-function): New fun.
(perl-mode): Use it.
* lisp/progmodes/python.el (python-syntax-propertize-function): New var to
replace python-font-lock-syntactic-keywords.
(python-mode): Use it.
(python-quote-syntax): Simplify and adjust to new use.
* lisp/progmodes/ruby-mode.el (ruby-here-doc-beg-re):
Define while compiling.
(ruby-here-doc-end-re, ruby-here-doc-beg-match)
(ruby-font-lock-syntactic-keywords, ruby-comment-beg-syntax)
(syntax-ppss, ruby-in-ppss-context-p, ruby-in-here-doc-p)
(ruby-here-doc-find-end, ruby-here-doc-beg-syntax)
(ruby-here-doc-end-syntax): Only define when
syntax-propertize is not available.
(ruby-syntax-propertize-function, ruby-syntax-propertize-heredoc):
New functions.
(ruby-in-ppss-context-p): Update to new syntax of heredocs.
(electric-indent-chars): Silence bytecompiler.
(ruby-mode): Use prog-mode, syntax-propertize-function, and
electric-indent-chars.
* lisp/progmodes/sh-script.el (sh-st-symbol): Remove.
(sh-font-lock-close-heredoc, sh-font-lock-open-heredoc): Add eol arg.
(sh-font-lock-flush-syntax-ppss-cache, sh-font-lock-here-doc): Remove.
(sh-font-lock-quoted-subshell): Assume we've already matched $(.
(sh-font-lock-paren): Set syntax-multiline.
(sh-font-lock-syntactic-keywords): Remove.
(sh-syntax-propertize-function): New function to replace it.
(sh-mode): Use it.
* lisp/progmodes/simula.el (simula-syntax-propertize-function): New var to
replace simula-font-lock-syntactic-keywords.
(simula-mode): Use it.
* lisp/progmodes/tcl.el (tcl-syntax-propertize-function): New var to
replace tcl-font-lock-syntactic-keywords.
(tcl-mode): Use it.
* lisp/progmodes/vhdl-mode.el (vhdl-mode): Use syntax-propertize-function
if available.
(vhdl-fontify-buffer): Adjust.
* lisp/textmodes/bibtex.el (bibtex-mode): Use syntax-propertize-function.
* lisp/textmodes/reftex.el (font-lock-syntactic-keywords): Don't declare
since we don't use it.
* lisp/textmodes/sgml-mode.el (sgml-syntax-propertize-function): New var to
replace sgml-font-lock-syntactic-keywords.
(sgml-mode): Use it.
* lisp/textmodes/tex-mode.el (tex-common-initialization, doctex-mode):
Use syntax-propertize-function.
* lisp/textmodes/texinfo.el (texinfo-syntax-propertize-function): New fun
to replace texinfo-font-lock-syntactic-keywords.
(texinfo-mode): Use it.
* test/indent/octave.m: Remove some `fixindent' not needed any more.
author | Stefan Monnier <monnier@iro.umontreal.ca> |
---|---|
date | Sat, 11 Sep 2010 01:13:42 +0200 |
parents | 280c8ae2476d |
children | 1b078a586243 |
rev | line source |
---|---|
91647 | 1 ;;; epg-config.el --- configuration of the EasyPG Library |
106000 | 2 |
106815 | 3 ;; Copyright (C) 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. |
91647 | 4 |
5 ;; Author: Daiki Ueno <ueno@unixuser.org> | |
6 ;; Keywords: PGP, GnuPG | |
110015
280c8ae2476d
Add "Package:" file headers to denote built-in packages.
Chong Yidong <cyd@stupidchicken.com>
parents:
107378
diff
changeset
|
7 ;; Package: epg |
91647 | 8 |
9 ;; This file is part of GNU Emacs. | |
10 | |
94678
ee5932bf781d
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
91731
diff
changeset
|
11 ;; GNU Emacs is free software: you can redistribute it and/or modify |
91647 | 12 ;; it under the terms of the GNU General Public License as published by |
94678
ee5932bf781d
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
91731
diff
changeset
|
13 ;; the Free Software Foundation, either version 3 of the License, or |
ee5932bf781d
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
91731
diff
changeset
|
14 ;; (at your option) any later version. |
91647 | 15 |
16 ;; GNU Emacs is distributed in the hope that it will be useful, | |
17 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
19 ;; GNU General Public License for more details. | |
20 | |
21 ;; You should have received a copy of the GNU General Public License | |
94678
ee5932bf781d
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
91731
diff
changeset
|
22 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. |
91647 | 23 |
24 ;;; Code: | |
25 | |
91731
7efbdc83b944
EasyPG: Implement some suggestions from emacs-devel.
Michael Olson <mwolson@gnu.org>
parents:
91703
diff
changeset
|
26 (defconst epg-package-name "epg" |
7efbdc83b944
EasyPG: Implement some suggestions from emacs-devel.
Michael Olson <mwolson@gnu.org>
parents:
91703
diff
changeset
|
27 "Name of this package.") |
7efbdc83b944
EasyPG: Implement some suggestions from emacs-devel.
Michael Olson <mwolson@gnu.org>
parents:
91703
diff
changeset
|
28 |
7efbdc83b944
EasyPG: Implement some suggestions from emacs-devel.
Michael Olson <mwolson@gnu.org>
parents:
91703
diff
changeset
|
29 (defconst epg-version-number "1.0.0" |
7efbdc83b944
EasyPG: Implement some suggestions from emacs-devel.
Michael Olson <mwolson@gnu.org>
parents:
91703
diff
changeset
|
30 "Version number of this package.") |
7efbdc83b944
EasyPG: Implement some suggestions from emacs-devel.
Michael Olson <mwolson@gnu.org>
parents:
91703
diff
changeset
|
31 |
7efbdc83b944
EasyPG: Implement some suggestions from emacs-devel.
Michael Olson <mwolson@gnu.org>
parents:
91703
diff
changeset
|
32 (defconst epg-bug-report-address "ueno@unixuser.org" |
7efbdc83b944
EasyPG: Implement some suggestions from emacs-devel.
Michael Olson <mwolson@gnu.org>
parents:
91703
diff
changeset
|
33 "Report bugs to this address.") |
91647 | 34 |
35 (defgroup epg () | |
106000 | 36 "The EasyPG library." |
91703
bda1e76bc03b
* epa.el (epa-faces, epa):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
91687
diff
changeset
|
37 :version "23.1" |
107378
904ccd8f2acb
Reorganize Custom groups.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
38 :group 'data) |
91647 | 39 |
40 (defcustom epg-gpg-program "gpg" | |
41 "The `gpg' executable." | |
42 :group 'epg | |
43 :type 'string) | |
44 | |
45 (defcustom epg-gpgsm-program "gpgsm" | |
46 "The `gpgsm' executable." | |
47 :group 'epg | |
48 :type 'string) | |
49 | |
50 (defcustom epg-gpg-home-directory nil | |
51 "The directory which contains the configuration files of `epg-gpg-program'." | |
52 :group 'epg | |
53 :type '(choice (const :tag "Default" nil) directory)) | |
54 | |
55 (defcustom epg-passphrase-coding-system nil | |
56 "Coding system to use with messages from `epg-gpg-program'." | |
57 :group 'epg | |
58 :type 'symbol) | |
59 | |
60 (defcustom epg-debug nil | |
61 "If non-nil, debug output goes to the \" *epg-debug*\" buffer. | |
62 Note that the buffer name starts with a space." | |
63 :group 'epg | |
64 :type 'boolean) | |
65 | |
66 (defconst epg-gpg-minimum-version "1.4.3") | |
67 | |
68 ;;;###autoload | |
69 (defun epg-configuration () | |
70 "Return a list of internal configuration parameters of `epg-gpg-program'." | |
71 (let (config groups type args) | |
72 (with-temp-buffer | |
73 (apply #'call-process epg-gpg-program nil (list t nil) nil | |
74 (append (if epg-gpg-home-directory | |
75 (list "--homedir" epg-gpg-home-directory)) | |
76 '("--with-colons" "--list-config"))) | |
77 (goto-char (point-min)) | |
78 (while (re-search-forward "^cfg:\\([^:]+\\):\\(.*\\)" nil t) | |
79 (setq type (intern (match-string 1)) | |
80 args (match-string 2)) | |
81 (cond | |
82 ((eq type 'group) | |
83 (if (string-match "\\`\\([^:]+\\):" args) | |
84 (setq groups | |
85 (cons (cons (downcase (match-string 1 args)) | |
86 (delete "" (split-string | |
87 (substring args | |
88 (match-end 0)) | |
89 ";"))) | |
90 groups)) | |
91 (if epg-debug | |
92 (message "Invalid group configuration: %S" args)))) | |
93 ((memq type '(pubkey cipher digest compress)) | |
94 (if (string-match "\\`\\([0-9]+\\)\\(;[0-9]+\\)*" args) | |
95 (setq config | |
96 (cons (cons type | |
97 (mapcar #'string-to-number | |
98 (delete "" (split-string args ";")))) | |
99 config)) | |
100 (if epg-debug | |
101 (message "Invalid %S algorithm configuration: %S" | |
102 type args)))) | |
103 (t | |
104 (setq config (cons (cons type args) config)))))) | |
105 (if groups | |
106 (cons (cons 'groups groups) config) | |
107 config))) | |
108 | |
109 (defun epg-config--parse-version (string) | |
110 (let ((index 0) | |
111 version) | |
112 (while (eq index (string-match "\\([0-9]+\\)\\.?" string index)) | |
113 (setq version (cons (string-to-number (match-string 1 string)) | |
114 version) | |
115 index (match-end 0))) | |
116 (nreverse version))) | |
117 | |
118 (defun epg-config--compare-version (v1 v2) | |
119 (while (and v1 v2 (= (car v1) (car v2))) | |
120 (setq v1 (cdr v1) v2 (cdr v2))) | |
121 (- (or (car v1) 0) (or (car v2) 0))) | |
122 | |
123 ;;;###autoload | |
124 (defun epg-check-configuration (config &optional minimum-version) | |
125 "Verify that a sufficient version of GnuPG is installed." | |
126 (let ((entry (assq 'version config)) | |
127 version) | |
128 (unless (and entry | |
129 (stringp (cdr entry))) | |
130 (error "Undetermined version: %S" entry)) | |
131 (setq version (epg-config--parse-version (cdr entry)) | |
132 minimum-version (epg-config--parse-version | |
133 (or minimum-version | |
134 epg-gpg-minimum-version))) | |
135 (unless (>= (epg-config--compare-version version minimum-version) 0) | |
136 (error "Unsupported version: %s" (cdr entry))))) | |
137 | |
138 ;;;###autoload | |
139 (defun epg-expand-group (config group) | |
140 "Look at CONFIG and try to expand GROUP." | |
141 (let ((entry (assq 'groups config))) | |
142 (if (and entry | |
143 (setq entry (assoc (downcase group) (cdr entry)))) | |
144 (cdr entry)))) | |
145 | |
146 (provide 'epg-config) | |
147 | |
91687 | 148 ;; arch-tag: 9aca7cb8-5f63-4bcb-84ee-46fd2db0763f |
91647 | 149 ;;; epg-config.el ends here |