diff options
| author | Gerd Möllmann | 2022-10-12 13:53:07 +0200 |
|---|---|---|
| committer | Gerd Möllmann | 2022-10-12 14:09:33 +0200 |
| commit | b3cdb8a3d3aba0ea537ecabd2900a3682e7c0660 (patch) | |
| tree | 8f20aa6cb1b0a1b1e6e24f8518697f8e12cd61c6 | |
| parent | 3e29407122da36e942c9a1c44e701f8aacae7c72 (diff) | |
| download | emacs-b3cdb8a3d3aba0ea537ecabd2900a3682e7c0660.tar.gz emacs-b3cdb8a3d3aba0ea537ecabd2900a3682e7c0660.zip | |
Intern keywords differently
Instead of something like (intern (format ":%s" ...)) do
(intern (format "%s" :keyword). Likewise in C.
| -rw-r--r-- | lisp/auth-source.el | 2 | ||||
| -rw-r--r-- | lisp/emacs-lisp/cl-macs.el | 2 | ||||
| -rw-r--r-- | lisp/emacs-lisp/macroexp.el | 2 | ||||
| -rw-r--r-- | lisp/net/nsm.el | 2 | ||||
| -rw-r--r-- | lisp/obsolete/cl-compat.el | 2 | ||||
| -rw-r--r-- | lisp/org/ox-ascii.el | 2 | ||||
| -rw-r--r-- | lisp/org/ox-html.el | 2 | ||||
| -rw-r--r-- | lisp/org/ox-koma-letter.el | 2 | ||||
| -rw-r--r-- | lisp/org/ox.el | 2 | ||||
| -rw-r--r-- | src/image.c | 2 | ||||
| -rw-r--r-- | src/lisp.h | 2 | ||||
| -rw-r--r-- | src/lread.c | 35 | ||||
| -rw-r--r-- | src/pkg.c | 13 | ||||
| -rw-r--r-- | test/lisp/erc/resources/erc-d/erc-d.el | 2 |
14 files changed, 52 insertions, 20 deletions
diff --git a/lisp/auth-source.el b/lisp/auth-source.el index feefd391a87..5d1e58d303b 100644 --- a/lisp/auth-source.el +++ b/lisp/auth-source.el | |||
| @@ -1160,7 +1160,7 @@ FILE is the file from which we obtained this token." | |||
| 1160 | (point-max)))))) | 1160 | (point-max)))))) |
| 1161 | 1161 | ||
| 1162 | (defun auth-source--symbol-keyword (symbol) | 1162 | (defun auth-source--symbol-keyword (symbol) |
| 1163 | (intern (format ":%s" symbol))) | 1163 | (intern (format "%s" symbol) :keyword)) |
| 1164 | 1164 | ||
| 1165 | (defun auth-source-netrc-normalize (alist filename) | 1165 | (defun auth-source-netrc-normalize (alist filename) |
| 1166 | (mapcar (lambda (entry) | 1166 | (mapcar (lambda (entry) |
diff --git a/lisp/emacs-lisp/cl-macs.el b/lisp/emacs-lisp/cl-macs.el index beafee1d631..394ba1e1e0e 100644 --- a/lisp/emacs-lisp/cl-macs.el +++ b/lisp/emacs-lisp/cl-macs.el | |||
| @@ -611,7 +611,7 @@ its argument list allows full Common Lisp conventions." | |||
| 611 | ;; shouldn't affect the key's name (bug#12367). | 611 | ;; shouldn't affect the key's name (bug#12367). |
| 612 | (if (eq ?_ (aref name 0)) | 612 | (if (eq ?_ (aref name 0)) |
| 613 | (setq name (substring name 1))) | 613 | (setq name (substring name 1))) |
| 614 | (intern (format ":%s" name))))) | 614 | (intern (format "%s" name) :keyword)))) |
| 615 | (varg (if (consp (car arg)) (cadar arg) (car arg))) | 615 | (varg (if (consp (car arg)) (cadar arg) (car arg))) |
| 616 | (def (if (cdr arg) (cadr arg) | 616 | (def (if (cdr arg) (cadr arg) |
| 617 | ;; The ordering between those two or clauses is | 617 | ;; The ordering between those two or clauses is |
diff --git a/lisp/emacs-lisp/macroexp.el b/lisp/emacs-lisp/macroexp.el index f4df40249de..abcb3e3e6b5 100644 --- a/lisp/emacs-lisp/macroexp.el +++ b/lisp/emacs-lisp/macroexp.el | |||
| @@ -819,7 +819,7 @@ test of free variables in the following ways: | |||
| 819 | ;; Hopefully this shouldn't happen thanks to the cycle detection, | 819 | ;; Hopefully this shouldn't happen thanks to the cycle detection, |
| 820 | ;; but in case it does happen, let's catch the error and give the | 820 | ;; but in case it does happen, let's catch the error and give the |
| 821 | ;; code a chance to macro-expand later. | 821 | ;; code a chance to macro-expand later. |
| 822 | (error "Eager macro-expansion failure: %S" err) | 822 | (error "Eager macro-expansion failure: %S in %S" err form) |
| 823 | form)))))) | 823 | form)))))) |
| 824 | 824 | ||
| 825 | ;; ¡¡¡ Big Ugly Hack !!! | 825 | ;; ¡¡¡ Big Ugly Hack !!! |
diff --git a/lisp/net/nsm.el b/lisp/net/nsm.el index 3146189be63..ed8228d97e9 100644 --- a/lisp/net/nsm.el +++ b/lisp/net/nsm.el | |||
| @@ -273,7 +273,7 @@ See also: `network-security-protocol-checks' and `nsm-noninteractive'" | |||
| 273 | (let* ((results | 273 | (let* ((results |
| 274 | (cl-loop | 274 | (cl-loop |
| 275 | for check in network-security-protocol-checks | 275 | for check in network-security-protocol-checks |
| 276 | for type = (intern (format ":%s" (car check))) | 276 | for type = (intern (format "%s" (car check)) :keyword) |
| 277 | ;; Skip the check if the user has already said that this | 277 | ;; Skip the check if the user has already said that this |
| 278 | ;; host is OK for this type of "error". | 278 | ;; host is OK for this type of "error". |
| 279 | for result = (and (not (memq type | 279 | for result = (and (not (memq type |
diff --git a/lisp/obsolete/cl-compat.el b/lisp/obsolete/cl-compat.el index e58f475d1c2..a68bec8d2de 100644 --- a/lisp/obsolete/cl-compat.el +++ b/lisp/obsolete/cl-compat.el | |||
| @@ -56,7 +56,7 @@ | |||
| 56 | (cl-list* 'defconst x (list 'quote x) (and doc (list doc)))) | 56 | (cl-list* 'defconst x (list 'quote x) (and doc (list doc)))) |
| 57 | 57 | ||
| 58 | (defun keyword-of (sym) | 58 | (defun keyword-of (sym) |
| 59 | (or (keywordp sym) (keywordp (intern (format ":%s" sym))))) | 59 | (or (keywordp sym) (keywordp (intern (format "%s" sym) :keyword)))) |
| 60 | 60 | ||
| 61 | 61 | ||
| 62 | ;; Multiple values. Note that the new package uses a different | 62 | ;; Multiple values. Note that the new package uses a different |
diff --git a/lisp/org/ox-ascii.el b/lisp/org/ox-ascii.el index 76a1a71fabe..c488d6d10b9 100644 --- a/lisp/org/ox-ascii.el +++ b/lisp/org/ox-ascii.el | |||
| @@ -1157,7 +1157,7 @@ holding export options." | |||
| 1157 | (defun org-ascii--translate (s info) | 1157 | (defun org-ascii--translate (s info) |
| 1158 | "Translate string S according to specified language and charset. | 1158 | "Translate string S according to specified language and charset. |
| 1159 | INFO is a plist used as a communication channel." | 1159 | INFO is a plist used as a communication channel." |
| 1160 | (let ((charset (intern (format ":%s" (plist-get info :ascii-charset))))) | 1160 | (let ((charset (intern (format "%s" (plist-get info :ascii-charset)) :keyword))) |
| 1161 | (org-export-translate s charset info))) | 1161 | (org-export-translate s charset info))) |
| 1162 | 1162 | ||
| 1163 | 1163 | ||
diff --git a/lisp/org/ox-html.el b/lisp/org/ox-html.el index 9cf9125aebd..e3f0cb569f5 100644 --- a/lisp/org/ox-html.el +++ b/lisp/org/ox-html.el | |||
| @@ -1979,7 +1979,7 @@ INFO is a plist used as a communication channel." | |||
| 1979 | "Return document preamble or postamble as a string, or nil. | 1979 | "Return document preamble or postamble as a string, or nil. |
| 1980 | TYPE is either `preamble' or `postamble', INFO is a plist used as a | 1980 | TYPE is either `preamble' or `postamble', INFO is a plist used as a |
| 1981 | communication channel." | 1981 | communication channel." |
| 1982 | (let ((section (plist-get info (intern (format ":html-%s" type)))) | 1982 | (let ((section (plist-get info (intern (format "html-%s" type) :keyword))) |
| 1983 | (spec (org-html-format-spec info))) | 1983 | (spec (org-html-format-spec info))) |
| 1984 | (when section | 1984 | (when section |
| 1985 | (let ((section-contents | 1985 | (let ((section-contents |
diff --git a/lisp/org/ox-koma-letter.el b/lisp/org/ox-koma-letter.el index 5f62cd1c040..dbc23be5875 100644 --- a/lisp/org/ox-koma-letter.el +++ b/lisp/org/ox-koma-letter.el | |||
| @@ -774,7 +774,7 @@ a communication channel." | |||
| 774 | (let* ((check-scope | 774 | (let* ((check-scope |
| 775 | ;; Non-nil value when SETTING was defined in SCOPE. | 775 | ;; Non-nil value when SETTING was defined in SCOPE. |
| 776 | (lambda (setting) | 776 | (lambda (setting) |
| 777 | (let ((property (intern (format ":inbuffer-%s" setting)))) | 777 | (let ((property (intern (format "inbuffer-%s" setting) :keyword))) |
| 778 | (if (eq scope 'global) | 778 | (if (eq scope 'global) |
| 779 | (eq (plist-get info property) 'koma-letter:empty) | 779 | (eq (plist-get info property) 'koma-letter:empty) |
| 780 | (not (eq (plist-get info property) 'koma-letter:empty)))))) | 780 | (not (eq (plist-get info property) 'koma-letter:empty)))))) |
diff --git a/lisp/org/ox.el b/lisp/org/ox.el index 56bb4b74df3..6b8925b0db4 100644 --- a/lisp/org/ox.el +++ b/lisp/org/ox.el | |||
| @@ -1969,7 +1969,7 @@ Return a string." | |||
| 1969 | ;; as in the original buffer, and call appropriate filters. | 1969 | ;; as in the original buffer, and call appropriate filters. |
| 1970 | (t | 1970 | (t |
| 1971 | (org-export-filter-apply-functions | 1971 | (org-export-filter-apply-functions |
| 1972 | (plist-get info (intern (format ":filter-%s" type))) | 1972 | (plist-get info (intern (format "filter-%s" type) :keyword)) |
| 1973 | (let ((blank (or (org-element-property :post-blank data) 0))) | 1973 | (let ((blank (or (org-element-property :post-blank data) 0))) |
| 1974 | (if (eq (org-element-class data parent) 'object) | 1974 | (if (eq (org-element-class data parent) 'object) |
| 1975 | (concat results (make-string blank ?\s)) | 1975 | (concat results (make-string blank ?\s)) |
diff --git a/src/image.c b/src/image.c index 1e323ba66a0..f6209149313 100644 --- a/src/image.c +++ b/src/image.c | |||
| @@ -10072,7 +10072,7 @@ imagemagick_filename_hint (Lisp_Object spec, char hint_buffer[MaxTextExtent]) | |||
| 10072 | if (! CONSP (val)) | 10072 | if (! CONSP (val)) |
| 10073 | return NULL; | 10073 | return NULL; |
| 10074 | 10074 | ||
| 10075 | format = image_spec_value (spec, intern (":format"), NULL); | 10075 | format = image_spec_value (spec, QCformat, NULL); |
| 10076 | val = Fcar_safe (Fcdr_safe (Fassq (format, val))); | 10076 | val = Fcar_safe (Fcdr_safe (Fassq (format, val))); |
| 10077 | if (! STRINGP (val)) | 10077 | if (! STRINGP (val)) |
| 10078 | return NULL; | 10078 | return NULL; |
diff --git a/src/lisp.h b/src/lisp.h index 68a7233abd0..c5ce309306f 100644 --- a/src/lisp.h +++ b/src/lisp.h | |||
| @@ -2268,6 +2268,8 @@ extern Lisp_Object pkg_emacs_intern_soft (Lisp_Object name, Lisp_Object package) | |||
| 2268 | extern Lisp_Object pkg_emacs_unintern (Lisp_Object name, Lisp_Object package); | 2268 | extern Lisp_Object pkg_emacs_unintern (Lisp_Object name, Lisp_Object package); |
| 2269 | extern bool pkg_intern_name_c_string (const char *p, ptrdiff_t len, Lisp_Object *symbol); | 2269 | extern bool pkg_intern_name_c_string (const char *p, ptrdiff_t len, Lisp_Object *symbol); |
| 2270 | extern void pkg_early_intern_symbol (Lisp_Object symbol); | 2270 | extern void pkg_early_intern_symbol (Lisp_Object symbol); |
| 2271 | extern Lisp_Object pkg_lookup_c_string (const char *ptr, ptrdiff_t nchars, ptrdiff_t nbytes); | ||
| 2272 | extern void pkg_break (void); | ||
| 2271 | 2273 | ||
| 2272 | extern bool package_system_ready; | 2274 | extern bool package_system_ready; |
| 2273 | 2275 | ||
diff --git a/src/lread.c b/src/lread.c index 4260850399f..edd50efd16b 100644 --- a/src/lread.c +++ b/src/lread.c | |||
| @@ -4138,7 +4138,7 @@ read0 (Lisp_Object readcharfun, bool locate_syms) | |||
| 4138 | /* If of the form ||, everything except '|' is considered quoted. | 4138 | /* If of the form ||, everything except '|' is considered quoted. |
| 4139 | the bars doesn't belong to the symbol name. */ | 4139 | the bars doesn't belong to the symbol name. */ |
| 4140 | bool in_vertical_bar = false; | 4140 | bool in_vertical_bar = false; |
| 4141 | if (c == '|') | 4141 | if (!read_emacs_syntax && c == '|') |
| 4142 | { | 4142 | { |
| 4143 | in_vertical_bar = true; | 4143 | in_vertical_bar = true; |
| 4144 | c = READCHAR; | 4144 | c = READCHAR; |
| @@ -4160,19 +4160,22 @@ read0 (Lisp_Object readcharfun, bool locate_syms) | |||
| 4160 | { | 4160 | { |
| 4161 | if (c == ':' && !last_was_backslash && !in_vertical_bar) | 4161 | if (c == ':' && !last_was_backslash && !in_vertical_bar) |
| 4162 | { | 4162 | { |
| 4163 | /* #:xyz should not contain a colon. */ | ||
| 4164 | if (uninterned_symbol) | ||
| 4165 | invalid_syntax ("colon in uninterned symbol", readcharfun); | ||
| 4166 | |||
| 4167 | /* Remember where the first : is. */ | 4163 | /* Remember where the first : is. */ |
| 4168 | if (colon == NULL) | 4164 | if (colon == NULL) |
| 4169 | colon = p; | 4165 | colon = p; |
| 4170 | ++ncolons; | 4166 | ++ncolons; |
| 4171 | 4167 | ||
| 4172 | /* Up to two colons are allowed if they are | 4168 | if (!read_emacs_syntax) |
| 4173 | consecutive. PKG-FIXME check consecutive :. */ | 4169 | { |
| 4174 | if (ncolons > 2) | 4170 | /* #:xyz should not contain a colon. */ |
| 4175 | invalid_syntax ("too many colons", readcharfun); | 4171 | if (uninterned_symbol) |
| 4172 | invalid_syntax ("colon in uninterned symbol", readcharfun); | ||
| 4173 | |||
| 4174 | /* Up to two colons are allowed if they are | ||
| 4175 | consecutive. PKG-FIXME check consecutive :. */ | ||
| 4176 | if (ncolons > 2) | ||
| 4177 | invalid_syntax ("too many colons", readcharfun); | ||
| 4178 | } | ||
| 4176 | } | 4179 | } |
| 4177 | 4180 | ||
| 4178 | /* Handle backslash. The first backslash is not part of | 4181 | /* Handle backslash. The first backslash is not part of |
| @@ -4219,6 +4222,7 @@ read0 (Lisp_Object readcharfun, bool locate_syms) | |||
| 4219 | symbol. */ | 4222 | symbol. */ |
| 4220 | if (in_vertical_bar) | 4223 | if (in_vertical_bar) |
| 4221 | { | 4224 | { |
| 4225 | eassert (!read_emacs_syntax); | ||
| 4222 | if (c < 0) | 4226 | if (c < 0) |
| 4223 | end_of_file_error (); | 4227 | end_of_file_error (); |
| 4224 | if (c == '|') | 4228 | if (c == '|') |
| @@ -4826,6 +4830,8 @@ A second optional argument specifies the obarray to use; | |||
| 4826 | it defaults to the value of `obarray'. */) | 4830 | it defaults to the value of `obarray'. */) |
| 4827 | (Lisp_Object string, Lisp_Object package) | 4831 | (Lisp_Object string, Lisp_Object package) |
| 4828 | { | 4832 | { |
| 4833 | /* PKG-FIXME: Remove this eassert. */ | ||
| 4834 | eassert (SREF (string, 0) != ':' || !package_system_ready); | ||
| 4829 | return pkg_emacs_intern (string, package); | 4835 | return pkg_emacs_intern (string, package); |
| 4830 | } | 4836 | } |
| 4831 | 4837 | ||
| @@ -4862,6 +4868,10 @@ usage: (unintern NAME OBARRAY) */) | |||
| 4862 | Lisp_Object | 4868 | Lisp_Object |
| 4863 | oblookup (Lisp_Object obarray, register const char *ptr, ptrdiff_t size, ptrdiff_t size_byte) | 4869 | oblookup (Lisp_Object obarray, register const char *ptr, ptrdiff_t size, ptrdiff_t size_byte) |
| 4864 | { | 4870 | { |
| 4871 | const Lisp_Object found = pkg_lookup_c_string (ptr, size, size_byte); | ||
| 4872 | if (!EQ (found, Qunbound)) | ||
| 4873 | return found; | ||
| 4874 | |||
| 4865 | size_t hash; | 4875 | size_t hash; |
| 4866 | size_t obsize; | 4876 | size_t obsize; |
| 4867 | register Lisp_Object tail; | 4877 | register Lisp_Object tail; |
| @@ -4897,6 +4907,7 @@ oblookup (Lisp_Object obarray, register const char *ptr, ptrdiff_t size, ptrdiff | |||
| 4897 | void | 4907 | void |
| 4898 | map_obarray (Lisp_Object obarray, void (*fn) (Lisp_Object, Lisp_Object), Lisp_Object arg) | 4908 | map_obarray (Lisp_Object obarray, void (*fn) (Lisp_Object, Lisp_Object), Lisp_Object arg) |
| 4899 | { | 4909 | { |
| 4910 | eassert (package_system_ready); | ||
| 4900 | ptrdiff_t i; | 4911 | ptrdiff_t i; |
| 4901 | register Lisp_Object tail; | 4912 | register Lisp_Object tail; |
| 4902 | CHECK_VECTOR (obarray); | 4913 | CHECK_VECTOR (obarray); |
| @@ -4917,6 +4928,7 @@ map_obarray (Lisp_Object obarray, void (*fn) (Lisp_Object, Lisp_Object), Lisp_Ob | |||
| 4917 | static void | 4928 | static void |
| 4918 | mapatoms_1 (Lisp_Object sym, Lisp_Object function) | 4929 | mapatoms_1 (Lisp_Object sym, Lisp_Object function) |
| 4919 | { | 4930 | { |
| 4931 | eassert (package_system_ready); | ||
| 4920 | call1 (function, sym); | 4932 | call1 (function, sym); |
| 4921 | } | 4933 | } |
| 4922 | 4934 | ||
| @@ -4925,6 +4937,7 @@ DEFUN ("mapatoms", Fmapatoms, Smapatoms, 1, 2, 0, | |||
| 4925 | OBARRAY defaults to the value of `obarray'. */) | 4937 | OBARRAY defaults to the value of `obarray'. */) |
| 4926 | (Lisp_Object function, Lisp_Object obarray) | 4938 | (Lisp_Object function, Lisp_Object obarray) |
| 4927 | { | 4939 | { |
| 4940 | eassert (package_system_ready); | ||
| 4928 | if (NILP (obarray)) obarray = Vobarray; | 4941 | if (NILP (obarray)) obarray = Vobarray; |
| 4929 | obarray = check_obarray (obarray); | 4942 | obarray = check_obarray (obarray); |
| 4930 | 4943 | ||
| @@ -5575,6 +5588,10 @@ that are loaded before your customizations are read! */); | |||
| 5575 | doc: /* Non-nil means not to load a .eln file when a .elc was requested. */); | 5588 | doc: /* Non-nil means not to load a .eln file when a .elc was requested. */); |
| 5576 | load_no_native = false; | 5589 | load_no_native = false; |
| 5577 | 5590 | ||
| 5591 | DEFVAR_BOOL ("read-emacs-syntax", read_emacs_syntax, | ||
| 5592 | doc: /* Non-nil means don't treat ':' or '|' specially in symbols. */); | ||
| 5593 | read_emacs_syntax = true; | ||
| 5594 | |||
| 5578 | /* Vsource_directory was initialized in init_lread. */ | 5595 | /* Vsource_directory was initialized in init_lread. */ |
| 5579 | 5596 | ||
| 5580 | DEFSYM (Qcurrent_load_list, "current-load-list"); | 5597 | DEFSYM (Qcurrent_load_list, "current-load-list"); |
| @@ -555,6 +555,15 @@ pkg_intern_name_c_string (const char *p, ptrdiff_t len, Lisp_Object *symbol) | |||
| 555 | return true; | 555 | return true; |
| 556 | } | 556 | } |
| 557 | 557 | ||
| 558 | Lisp_Object | ||
| 559 | pkg_lookup_c_string (const char *ptr, ptrdiff_t nchars, ptrdiff_t nbytes) | ||
| 560 | { | ||
| 561 | if (!package_system_ready) | ||
| 562 | return Qunbound; | ||
| 563 | const Lisp_Object name = make_string_from_bytes (ptr, nchars, nbytes); | ||
| 564 | return lookup_symbol (name, Vearmuffs_package); | ||
| 565 | } | ||
| 566 | |||
| 558 | void | 567 | void |
| 559 | pkg_early_intern_symbol (Lisp_Object symbol) | 568 | pkg_early_intern_symbol (Lisp_Object symbol) |
| 560 | { | 569 | { |
| @@ -582,6 +591,10 @@ pkg_unintern_symbol (Lisp_Object symbol, Lisp_Object package) | |||
| 582 | return Qnil; | 591 | return Qnil; |
| 583 | } | 592 | } |
| 584 | 593 | ||
| 594 | void pkg_break (void) | ||
| 595 | { | ||
| 596 | } | ||
| 597 | |||
| 585 | 598 | ||
| 586 | /*********************************************************************** | 599 | /*********************************************************************** |
| 587 | Old Emacs intern stuff | 600 | Old Emacs intern stuff |
diff --git a/test/lisp/erc/resources/erc-d/erc-d.el b/test/lisp/erc/resources/erc-d/erc-d.el index d6082227c52..6cbe26bb8b4 100644 --- a/test/lisp/erc/resources/erc-d/erc-d.el +++ b/test/lisp/erc/resources/erc-d/erc-d.el | |||
| @@ -951,7 +951,7 @@ appearing among DIALOGS." | |||
| 951 | erc-d-match-handlers)))) | 951 | erc-d-match-handlers)))) |
| 952 | (pcase-dolist (`(,var . ,def) defaults) | 952 | (pcase-dolist (`(,var . ,def) defaults) |
| 953 | (push (or (plist-get kwds var) def) args) | 953 | (push (or (plist-get kwds var) def) args) |
| 954 | (push (intern (format ":dialog-%s" var)) args)) | 954 | (push (intern (format "dialog-%s" var) :keyword) args)) |
| 955 | (apply #'erc-d--start host service (or server-name erc-d-server-name) | 955 | (apply #'erc-d--start host service (or server-name erc-d-server-name) |
| 956 | args))) | 956 | args))) |
| 957 | 957 | ||