Add lexical-binding
cookie to generated files
Side-companion to commitsbb0f84bc0b
and50947fd512
. While in there, couldn't resist adding a few minor cleanups I had lying around. * lisp/savehist.el (savehist-save): Add `lexical-binding:t` cookie. * lisp/url/url-cookie.el: Remove redundant `:group` arguments. (url-cookie-write-file): Add `lexical-binding:t` cookie. * lisp/abbrev.el: Prefer #' to quote function names. (write-abbrev-file): Add a `lexical-binding:t` cookie. (unexpand-abbrev): Use `replace-region-contents` and 3-args `<=`. (define-abbrev-table): Use `defvar-1`. * lisp/filesets.el (filesets-menu-cache-file-save-maybe): Add `lexical-binding:t` cookie. (filesets-ingroup-patterns): Don't quote lambdas. (filesets-spawn-external-viewer): Remove redundant "" arg to `mapconcat`. * lisp/recentf.el: Prefer #' to quote function names. (recentf-save-file-header): Add `lexical-binding:t` cookie and change mode to match the actual content.
This commit is contained in:
parent
ec62674cb9
commit
c0ea954d0f
5 changed files with 78 additions and 80 deletions
|
@ -42,7 +42,7 @@
|
|||
(defcustom abbrev-file-name
|
||||
(locate-user-emacs-file "abbrev_defs" ".abbrev_defs")
|
||||
"Default name of file from which to read and where to save abbrevs."
|
||||
:initialize 'custom-initialize-delay
|
||||
:initialize #'custom-initialize-delay
|
||||
:type 'file)
|
||||
|
||||
(defcustom only-global-abbrevs nil
|
||||
|
@ -62,7 +62,7 @@ be replaced by its expansion."
|
|||
;; defining it again.
|
||||
:variable abbrev-mode)
|
||||
|
||||
(put 'abbrev-mode 'safe-local-variable 'booleanp)
|
||||
(put 'abbrev-mode 'safe-local-variable #'booleanp)
|
||||
|
||||
|
||||
(define-obsolete-variable-alias 'edit-abbrevs-map
|
||||
|
@ -271,7 +271,8 @@ abbrevs have been saved."
|
|||
(when (unencodable-char-position (point-min) (point-max) 'utf-8)
|
||||
(setq coding-system-for-write 'utf-8-emacs))
|
||||
(goto-char (point-min))
|
||||
(insert (format ";;-*-coding: %s;-*-\n" coding-system-for-write))
|
||||
(insert (format ";;-*-coding: %S; lexical-binding:t -*-\n"
|
||||
coding-system-for-write))
|
||||
(write-region nil nil file nil (and (not verbose) 0)))))
|
||||
|
||||
(defun abbrev-edit-save-to-file (file)
|
||||
|
@ -495,13 +496,13 @@ A prefix argument means don't query; expand all abbrevs."
|
|||
(set sym nil) ; Make sure it won't be confused for an abbrev.
|
||||
(put sym prop val)))
|
||||
|
||||
(defalias 'abbrev-get 'get
|
||||
(defalias 'abbrev-get #'get
|
||||
"Get the property PROP of abbrev ABBREV
|
||||
See `define-abbrev' for the effect of some special properties.
|
||||
|
||||
\(fn ABBREV PROP)")
|
||||
|
||||
(defalias 'abbrev-put 'put
|
||||
(defalias 'abbrev-put #'put
|
||||
"Set the property PROP of abbrev ABBREV to value VAL.
|
||||
See `define-abbrev' for the effect of some special properties.
|
||||
|
||||
|
@ -574,8 +575,7 @@ This causes `save-some-buffers' to offer to save the abbrevs.")
|
|||
|
||||
(defcustom abbrev-all-caps nil
|
||||
"Non-nil means expand multi-word abbrevs in all caps if the abbrev was so."
|
||||
:type 'boolean
|
||||
:group 'abbrev-mode)
|
||||
:type 'boolean)
|
||||
|
||||
(defvar abbrev-start-location nil
|
||||
"Buffer position for `expand-abbrev' to use as the start of the abbrev.
|
||||
|
@ -692,7 +692,7 @@ current (if global is nil) or standard syntax table."
|
|||
(cl-pushnew (aref abbrev (match-beginning 0)) badchars)
|
||||
(setq pos (1+ pos)))
|
||||
(error "Some abbrev characters (%s) are not word constituents %s"
|
||||
(apply 'string (nreverse badchars))
|
||||
(apply #'string (nreverse badchars))
|
||||
(if global "in the standard syntax" "in this mode"))))))
|
||||
|
||||
(defun define-global-abbrev (abbrev expansion)
|
||||
|
@ -1097,8 +1097,7 @@ This differs from ordinary undo in that other editing done since then
|
|||
is not undone."
|
||||
(interactive)
|
||||
(save-excursion
|
||||
(unless (or (< last-abbrev-location (point-min))
|
||||
(> last-abbrev-location (point-max)))
|
||||
(when (<= (point-min) last-abbrev-location (point-max))
|
||||
(goto-char last-abbrev-location)
|
||||
(when (stringp last-abbrev-text)
|
||||
;; This isn't correct if last-abbrev's hook was used
|
||||
|
@ -1107,9 +1106,9 @@ is not undone."
|
|||
(unless (stringp val)
|
||||
(error "Value of abbrev-symbol must be a string"))
|
||||
;; Don't inherit properties here; just copy from old contents.
|
||||
(insert last-abbrev-text)
|
||||
;; Delete after inserting, to better preserve markers.
|
||||
(delete-region (point) (+ (point) (length val)))
|
||||
(replace-region-contents (point) (+ (point) (length val))
|
||||
last-abbrev-text 0)
|
||||
(goto-char (+ (point) (length last-abbrev-text)))
|
||||
(setq last-abbrev-text nil))))))
|
||||
|
||||
(defun abbrev--write (sym)
|
||||
|
@ -1159,21 +1158,21 @@ a call to `define-abbrev-table' that, when evaluated, will define
|
|||
the abbrev table NAME exactly as it is currently defined.
|
||||
Abbrevs marked as \"system abbrevs\" are ignored."
|
||||
(let ((symbols (abbrev--table-symbols name readable)))
|
||||
(setq symbols (sort symbols 'string-lessp))
|
||||
(setq symbols (sort symbols #'string-lessp))
|
||||
(let ((standard-output (current-buffer)))
|
||||
(if readable
|
||||
(progn
|
||||
(insert "(")
|
||||
(prin1 name)
|
||||
(insert ")\n\n")
|
||||
(mapc 'abbrev--describe symbols)
|
||||
(mapc #'abbrev--describe symbols)
|
||||
(insert "\n\n"))
|
||||
(insert "(define-abbrev-table '")
|
||||
(prin1 name)
|
||||
(if (null symbols)
|
||||
(insert " '())\n\n")
|
||||
(insert "\n '(\n")
|
||||
(mapc 'abbrev--write symbols)
|
||||
(mapc #'abbrev--write symbols)
|
||||
(insert " ))\n\n")))
|
||||
nil)))
|
||||
|
||||
|
@ -1216,7 +1215,7 @@ Properties with special meaning:
|
|||
;; There is really no docstring, instead the docstring arg
|
||||
;; is a property name.
|
||||
(push docstring props) (setq docstring nil))
|
||||
(eval `(defvar ,tablename nil ,@(if docstring (list docstring))))
|
||||
(defvar-1 tablename nil docstring)
|
||||
(let ((table (if (boundp tablename) (symbol-value tablename))))
|
||||
(unless table
|
||||
(setq table (make-abbrev-table))
|
||||
|
@ -1230,7 +1229,7 @@ Properties with special meaning:
|
|||
(unless (cdr props) (error "Missing value for property %S" (car props)))
|
||||
(abbrev-table-put table (pop props) (pop props)))
|
||||
(dolist (elt definitions)
|
||||
(apply 'define-abbrev table elt))))
|
||||
(apply #'define-abbrev table elt))))
|
||||
|
||||
(defun abbrev-table-menu (table &optional prompt sortfun)
|
||||
"Return a menu that shows all abbrevs in TABLE.
|
||||
|
|
|
@ -671,69 +671,70 @@ In order to view pdf or rtf files in an Emacs buffer, you could use these:
|
|||
(boolean :tag "Boolean")))))))
|
||||
|
||||
(defcustom filesets-ingroup-patterns
|
||||
'(("^.+\\.tex$" t
|
||||
;; FIXME: This value does not seem realistically editable via the Custom UI.
|
||||
`(("^.+\\.tex$" t
|
||||
(((:name "Package")
|
||||
(:pattern "\\\\usepackage\\W*\\(\\[[^]]*\\]\\W*\\)?{\\W*\\(.+\\)\\W*}")
|
||||
(:match-number 2)
|
||||
(:stub-flag t)
|
||||
(:get-file-name (lambda (master file)
|
||||
(filesets-which-file master
|
||||
(concat file ".sty")
|
||||
(filesets-convert-path-list
|
||||
(or (getenv "MY_TEXINPUTS")
|
||||
(getenv "TEXINPUTS")))))))
|
||||
(:get-file-name ,(lambda (master file)
|
||||
(filesets-which-file master
|
||||
(concat file ".sty")
|
||||
(filesets-convert-path-list
|
||||
(or (getenv "MY_TEXINPUTS")
|
||||
(getenv "TEXINPUTS")))))))
|
||||
((:name "Include")
|
||||
(:pattern "\\\\include\\W*{\\W*\\(.+\\)\\W*}")
|
||||
(:get-file-name (lambda (master file)
|
||||
(filesets-which-file master
|
||||
(concat file ".tex")
|
||||
(filesets-convert-path-list
|
||||
(or (getenv "MY_TEXINPUTS")
|
||||
(getenv "TEXINPUTS"))))))
|
||||
(:get-file-name ,(lambda (master file)
|
||||
(filesets-which-file master
|
||||
(concat file ".tex")
|
||||
(filesets-convert-path-list
|
||||
(or (getenv "MY_TEXINPUTS")
|
||||
(getenv "TEXINPUTS"))))))
|
||||
(:scan-depth 5))
|
||||
((:name "Input")
|
||||
(:pattern "\\\\input\\W*{\\W*\\(.+\\)\\W*}")
|
||||
(:stubp (lambda (a b) (not (filesets-files-in-same-directory-p a b))))
|
||||
(:get-file-name (lambda (master file)
|
||||
(filesets-which-file master
|
||||
(concat file ".tex")
|
||||
(filesets-convert-path-list
|
||||
(or (getenv "MY_TEXINPUTS")
|
||||
(getenv "TEXINPUTS"))))))
|
||||
(:stubp ,(lambda (a b) (not (filesets-files-in-same-directory-p a b))))
|
||||
(:get-file-name ,(lambda (master file)
|
||||
(filesets-which-file master
|
||||
(concat file ".tex")
|
||||
(filesets-convert-path-list
|
||||
(or (getenv "MY_TEXINPUTS")
|
||||
(getenv "TEXINPUTS"))))))
|
||||
(:scan-depth 5))
|
||||
((:name "Bibliography")
|
||||
(:pattern "\\\\bibliography\\W*{\\W*\\(.+\\)\\W*}")
|
||||
(:get-file-name (lambda (master file)
|
||||
(filesets-which-file master
|
||||
(concat file ".bib")
|
||||
(filesets-convert-path-list
|
||||
(or (getenv "MY_BIBINPUTS")
|
||||
(getenv "BIBINPUTS")))))))))
|
||||
(:get-file-name ,(lambda (master file)
|
||||
(filesets-which-file master
|
||||
(concat file ".bib")
|
||||
(filesets-convert-path-list
|
||||
(or (getenv "MY_BIBINPUTS")
|
||||
(getenv "BIBINPUTS")))))))))
|
||||
("^.+\\.el$" t
|
||||
(((:name "Require")
|
||||
(:pattern "(require\\W+'\\(.+\\))")
|
||||
(:stubp (lambda (a b) (not (filesets-files-in-same-directory-p a b))))
|
||||
(:get-file-name (lambda (master file)
|
||||
(filesets-which-file master
|
||||
(concat file ".el")
|
||||
load-path))))
|
||||
(:stubp ,(lambda (a b) (not (filesets-files-in-same-directory-p a b))))
|
||||
(:get-file-name ,(lambda (master file)
|
||||
(filesets-which-file master
|
||||
(concat file ".el")
|
||||
load-path))))
|
||||
((:name "Load")
|
||||
(:pattern "(load\\(-library\\)?\\W+\"\\(.+\\)\")")
|
||||
(:match-number 2)
|
||||
(:get-file-name (lambda (master file)
|
||||
(filesets-which-file master file load-path))))))
|
||||
(:get-file-name ,(lambda (master file)
|
||||
(filesets-which-file master file load-path))))))
|
||||
("^\\([A-ZÄÖÜ][a-zäöüß]+\\([A-ZÄÖÜ][a-zäöüß]+\\)+\\)$" t
|
||||
(((:pattern "\\<\\([A-ZÄÖÜ][a-zäöüß]+\\([A-ZÄÖÜ][a-zäöüß]+\\)+\\)\\>")
|
||||
(:scan-depth 5)
|
||||
(:stubp (lambda (a b) (not (filesets-files-in-same-directory-p a b))))
|
||||
(:stubp ,(lambda (a b) (not (filesets-files-in-same-directory-p a b))))
|
||||
(:case-sensitive t)
|
||||
(:get-file-name (lambda (master file)
|
||||
(filesets-which-file
|
||||
master
|
||||
file
|
||||
(if (boundp 'emacs-wiki-directories)
|
||||
emacs-wiki-directories
|
||||
nil))))))))
|
||||
(:get-file-name ,(lambda (master file)
|
||||
(filesets-which-file
|
||||
master
|
||||
file
|
||||
(if (boundp 'emacs-wiki-directories)
|
||||
emacs-wiki-directories
|
||||
nil))))))))
|
||||
|
||||
"Inclusion group definitions.
|
||||
|
||||
|
@ -1227,7 +1228,7 @@ Use the viewer defined in EV-ENTRY (a valid element of
|
|||
(shell-quote-argument (if (functionp this)
|
||||
(funcall this)
|
||||
this))))
|
||||
fmt "")
|
||||
fmt)
|
||||
(shell-quote-argument file))))
|
||||
(output
|
||||
(cond
|
||||
|
@ -2335,6 +2336,7 @@ fileset thinks this is necessary or not."
|
|||
(delete-file filesets-menu-cache-file))
|
||||
;;(message "Filesets: saving menu cache")
|
||||
(with-temp-buffer
|
||||
(insert ";; -*- mode: emacs-lisp; lexical-binding:t -*-\n")
|
||||
(dolist (this filesets-menu-cache-contents)
|
||||
(if (get this 'custom-type)
|
||||
(progn
|
||||
|
|
|
@ -88,7 +88,7 @@ See the command `recentf-save-list'."
|
|||
:group 'recentf
|
||||
:version "31.1"
|
||||
:type 'file
|
||||
:initialize 'custom-initialize-default
|
||||
:initialize #'custom-initialize-default
|
||||
:set (lambda (symbol value)
|
||||
(let ((oldvalue (symbol-value symbol)))
|
||||
(custom-set-default symbol value)
|
||||
|
@ -158,7 +158,7 @@ Set VARIABLE with VALUE, and force a rebuild of the recentf menu."
|
|||
"Name of the recentf menu."
|
||||
:group 'recentf
|
||||
:type 'string
|
||||
:set 'recentf-menu-customization-changed)
|
||||
:set #'recentf-menu-customization-changed)
|
||||
|
||||
(defcustom recentf-menu-path '("File")
|
||||
"Path where to add the recentf menu.
|
||||
|
@ -166,7 +166,7 @@ If nil add it at top level (see also `easy-menu-add-item')."
|
|||
:group 'recentf
|
||||
:type '(choice (const :tag "Top Level" nil)
|
||||
(sexp :tag "Menu Path"))
|
||||
:set 'recentf-menu-customization-changed)
|
||||
:set #'recentf-menu-customization-changed)
|
||||
|
||||
(defcustom recentf-menu-before "Open File..."
|
||||
"Name of the menu before which the recentf menu will be added.
|
||||
|
@ -174,7 +174,7 @@ If nil add it at end of menu (see also `easy-menu-add-item')."
|
|||
:group 'recentf
|
||||
:type '(choice (string :tag "Name")
|
||||
(const :tag "Last" nil))
|
||||
:set 'recentf-menu-customization-changed)
|
||||
:set #'recentf-menu-customization-changed)
|
||||
|
||||
(defcustom recentf-menu-action #'find-file
|
||||
"Function to invoke with a filename item of the recentf menu.
|
||||
|
@ -391,11 +391,11 @@ See also the option `recentf-auto-cleanup'.")
|
|||
nil)
|
||||
((numberp recentf-auto-cleanup)
|
||||
(run-with-idle-timer
|
||||
recentf-auto-cleanup t 'recentf-cleanup))
|
||||
recentf-auto-cleanup t #'recentf-cleanup))
|
||||
((stringp recentf-auto-cleanup)
|
||||
(run-at-time
|
||||
;; Repeat every 24 hours.
|
||||
recentf-auto-cleanup (* 24 60 60) 'recentf-cleanup))))))
|
||||
recentf-auto-cleanup (* 24 60 60) #'recentf-cleanup))))))
|
||||
|
||||
;;; File functions
|
||||
;;
|
||||
|
@ -508,7 +508,7 @@ Enable `recentf-mode' if it isn't already."
|
|||
(funcall recentf-menu-action file)))
|
||||
|
||||
;;;###autoload
|
||||
(defalias 'recentf 'recentf-open)
|
||||
(defalias 'recentf #'recentf-open)
|
||||
|
||||
|
||||
;;; Menu building
|
||||
|
@ -1316,7 +1316,9 @@ Optional argument N must be a valid digit number. It defaults to 1.
|
|||
;;; Save/load/cleanup the recent list
|
||||
;;
|
||||
(defconst recentf-save-file-header
|
||||
";;; Automatically generated by `recentf' on %s. -*- mode: lisp-data -*-\n"
|
||||
;; FIXME: This should arguably be a `lisp-data' file, but currently
|
||||
;; it contains and is used as an executable ELisp code.
|
||||
";;; Automatically generated by `recentf' on %s -*- mode: emacs-lisp; lexical-binding:t -*-\n"
|
||||
"Header to be written into the `recentf-save-file'.")
|
||||
|
||||
(defconst recentf-save-file-coding-system
|
||||
|
|
|
@ -244,7 +244,7 @@ If AUTO-SAVE is non-nil, compare the saved contents to the one last saved,
|
|||
(insert
|
||||
(format-message
|
||||
(concat
|
||||
";; -*- mode: emacs-lisp; coding: %s -*-\n"
|
||||
";; -*- mode: emacs-lisp; lexical-binding:t; coding: %s -*-\n"
|
||||
";; Minibuffer history file, automatically generated by `savehist'.\n"
|
||||
"\n")
|
||||
savehist-coding-system))
|
||||
|
|
|
@ -56,16 +56,14 @@
|
|||
|
||||
(defcustom url-cookie-confirmation nil
|
||||
"If non-nil, confirmation by the user is required to accept HTTP cookies."
|
||||
:type 'boolean
|
||||
:group 'url-cookie)
|
||||
:type 'boolean)
|
||||
|
||||
(defcustom url-cookie-multiple-line nil
|
||||
"If nil, HTTP requests put all cookies for the server on one line.
|
||||
Some web servers, such as https://www.hotmail.com/, only accept cookies
|
||||
when they are on one line. This is broken behavior, but just try
|
||||
telling Microsoft that."
|
||||
:type 'boolean
|
||||
:group 'url-cookie)
|
||||
:type 'boolean)
|
||||
|
||||
(defvar url-cookies-changed-since-last-save nil
|
||||
"Whether the cookies list has changed since the last save operation.")
|
||||
|
@ -152,7 +150,7 @@ i.e. 1970-1-1) are loaded as expiring one year from now instead."
|
|||
(url-cookie-clean-up)
|
||||
(url-cookie-clean-up t)
|
||||
(with-temp-buffer
|
||||
(insert ";; Emacs-W3 HTTP cookies file\n"
|
||||
(insert ";; Emacs-W3 HTTP cookies file -*- lexical-binding:t -*-\n"
|
||||
";; Automatically generated file!!! DO NOT EDIT!!!\n\n"
|
||||
"(setq url-cookie-storage\n '")
|
||||
(let ((print-length nil) (print-level nil))
|
||||
|
@ -266,13 +264,11 @@ i.e. 1970-1-1) are loaded as expiring one year from now instead."
|
|||
|
||||
(defcustom url-cookie-trusted-urls nil
|
||||
"A list of regular expressions matching URLs to always accept cookies from."
|
||||
:type '(repeat regexp)
|
||||
:group 'url-cookie)
|
||||
:type '(repeat regexp))
|
||||
|
||||
(defcustom url-cookie-untrusted-urls nil
|
||||
"A list of regular expressions matching URLs to never accept cookies from."
|
||||
:type '(repeat regexp)
|
||||
:group 'url-cookie)
|
||||
:type '(repeat regexp))
|
||||
|
||||
(defun url-cookie-host-can-set-p (host domain)
|
||||
(cond
|
||||
|
@ -361,8 +357,7 @@ to run the `url-cookie-setup-save-timer' function manually."
|
|||
(set-default var val)
|
||||
(if (bound-and-true-p url-setup-done)
|
||||
(url-cookie-setup-save-timer)))
|
||||
:type 'natnum
|
||||
:group 'url-cookie)
|
||||
:type 'natnum)
|
||||
|
||||
(defun url-cookie-setup-save-timer ()
|
||||
"Reset the cookie saver timer."
|
||||
|
|
Loading…
Add table
Reference in a new issue