diff options
| author | Stefan Monnier | 2011-03-01 00:03:24 -0500 |
|---|---|---|
| committer | Stefan Monnier | 2011-03-01 00:03:24 -0500 |
| commit | d032d5e7dfabfae60f3304da02c97cd1e189b9a2 (patch) | |
| tree | 64219849ec4b697e19a1da1c2a5786b61a2c3387 /lisp | |
| parent | 39605a343b566a1a72e0afb61f96d085c2ef8054 (diff) | |
| download | emacs-d032d5e7dfabfae60f3304da02c97cd1e189b9a2.tar.gz emacs-d032d5e7dfabfae60f3304da02c97cd1e189b9a2.zip | |
* doc/lispref/variables.texi (Scope): Mention the availability of lexbind.
(Lexical Binding): New node.
* doc/lispref/eval.texi (Eval): Add `eval's new `lexical' arg.
* lisp/emacs-lisp/cconv.el (cconv-liftwhen): Increase threshold.
(cconv-closure-convert-rec): Convert interactive spec in empty lexenv.
(cconv-analyse-use): Improve unused vars warnings.
(cconv-analyse-form): Analyze interactive spec in empty lexenv.
* lisp/emacs-lisp/bytecomp.el (byte-compile-lambda): Always byte-compile
the interactive spec in lexical-binding mode.
(byte-compile-refresh-preloaded): Don't reload byte-compiler files.
* lisp/custom.el (custom-initialize-default): Use defvar.
(custom-declare-variable): Set the special-variable-p flag.
* lisp/help-fns.el (help-make-usage): Drop leading underscores.
* lisp/dired.el (dired-revert, dired-make-relative): Mark unused args.
(dired-unmark-all-files): Remove unused var `query'.
(dired-overwrite-confirmed): Declare.
(dired-restore-desktop-buffer): Don't use dynamically scoped arg names.
* lisp/mpc.el: Mark unused args.
(mpc--faster-toggle): Remove unused var `songnb'.
* lisp/server.el (server-kill-buffer-running): Move before first use.
* lisp/minibuffer.el: Mark unused args.
* src/callint.c (quotify_arg): Simplify the logic.
(Fcall_interactively): Use lexical binding when evaluating the
interactive spec of a lexically bound function.
Diffstat (limited to 'lisp')
| -rw-r--r-- | lisp/ChangeLog | 30 | ||||
| -rw-r--r-- | lisp/ChangeLog.funvec | 10 | ||||
| -rw-r--r-- | lisp/Makefile.in | 3 | ||||
| -rw-r--r-- | lisp/custom.el | 39 | ||||
| -rw-r--r-- | lisp/dired.el | 22 | ||||
| -rw-r--r-- | lisp/emacs-lisp/byte-opt.el | 4 | ||||
| -rw-r--r-- | lisp/emacs-lisp/bytecomp.el | 28 | ||||
| -rw-r--r-- | lisp/emacs-lisp/cconv.el | 128 | ||||
| -rw-r--r-- | lisp/emacs-lisp/pcase.el | 4 | ||||
| -rw-r--r-- | lisp/help-fns.el | 7 | ||||
| -rw-r--r-- | lisp/minibuffer.el | 24 | ||||
| -rw-r--r-- | lisp/mpc.el | 21 | ||||
| -rw-r--r-- | lisp/server.el | 15 |
13 files changed, 220 insertions, 115 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 4a22b148469..10f57c2b96a 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,24 @@ | |||
| 1 | 2011-03-01 Stefan Monnier <monnier@iro.umontreal.ca> | ||
| 2 | |||
| 3 | * emacs-lisp/cconv.el (cconv-liftwhen): Increase threshold. | ||
| 4 | (cconv-closure-convert-rec): Convert interactive spec in empty lexenv. | ||
| 5 | (cconv-analyse-use): Improve unused vars warnings. | ||
| 6 | (cconv-analyse-form): Analyze interactive spec in empty lexenv. | ||
| 7 | * emacs-lisp/bytecomp.el (byte-compile-lambda): Always byte-compile | ||
| 8 | the interactive spec in lexical-binding mode. | ||
| 9 | (byte-compile-refresh-preloaded): Don't reload byte-compiler files. | ||
| 10 | * custom.el (custom-initialize-default): Use defvar. | ||
| 11 | (custom-declare-variable): Set the special-variable-p flag. | ||
| 12 | * help-fns.el (help-make-usage): Drop leading underscores. | ||
| 13 | * dired.el (dired-revert, dired-make-relative): Mark unused args. | ||
| 14 | (dired-unmark-all-files): Remove unused var `query'. | ||
| 15 | (dired-overwrite-confirmed): Declare. | ||
| 16 | (dired-restore-desktop-buffer): Don't use dynamically scoped arg names. | ||
| 17 | * mpc.el: Mark unused args. | ||
| 18 | (mpc--faster-toggle): Remove unused var `songnb'. | ||
| 19 | * server.el (server-kill-buffer-running): Move before first use. | ||
| 20 | * minibuffer.el: Mark unused args. | ||
| 21 | |||
| 1 | 2011-02-26 Stefan Monnier <monnier@iro.umontreal.ca> | 22 | 2011-02-26 Stefan Monnier <monnier@iro.umontreal.ca> |
| 2 | 23 | ||
| 3 | * emacs-lisp/cconv.el (cconv-closure-convert-rec): Fix last change for | 24 | * emacs-lisp/cconv.el (cconv-closure-convert-rec): Fix last change for |
| @@ -335,6 +356,15 @@ | |||
| 335 | 356 | ||
| 336 | Merge funvec patch. | 357 | Merge funvec patch. |
| 337 | 358 | ||
| 359 | 2004-05-20 Miles Bader <miles@gnu.org> | ||
| 360 | |||
| 361 | * subr.el (functionp): Use `funvecp' instead of | ||
| 362 | `byte-compiled-function-p'. | ||
| 363 | * help-fns.el (describe-function-1): Describe curried functions | ||
| 364 | and other funvecs as such. | ||
| 365 | (help-highlight-arguments): Only format things that look like a | ||
| 366 | function. | ||
| 367 | |||
| 338 | 2004-04-29 Miles Bader <miles@gnu.org> | 368 | 2004-04-29 Miles Bader <miles@gnu.org> |
| 339 | 369 | ||
| 340 | * emacs-lisp/bytecomp.el (byte-compile-top-level): Add new entries | 370 | * emacs-lisp/bytecomp.el (byte-compile-top-level): Add new entries |
diff --git a/lisp/ChangeLog.funvec b/lisp/ChangeLog.funvec deleted file mode 100644 index 0a31b9a590f..00000000000 --- a/lisp/ChangeLog.funvec +++ /dev/null | |||
| @@ -1,10 +0,0 @@ | |||
| 1 | 2004-05-20 Miles Bader <miles@gnu.org> | ||
| 2 | |||
| 3 | * subr.el (functionp): Use `funvecp' instead of | ||
| 4 | `byte-compiled-function-p'. | ||
| 5 | * help-fns.el (describe-function-1): Describe curried functions | ||
| 6 | and other funvecs as such. | ||
| 7 | (help-highlight-arguments): Only format things that look like a | ||
| 8 | function. | ||
| 9 | |||
| 10 | ;; arch-tag: 87f75aac-de53-40d7-96c7-3befaa771cb1 | ||
diff --git a/lisp/Makefile.in b/lisp/Makefile.in index 0182b7f5072..268a45d8948 100644 --- a/lisp/Makefile.in +++ b/lisp/Makefile.in | |||
| @@ -222,6 +222,9 @@ compile-onefile: | |||
| 222 | # cannot have prerequisites. | 222 | # cannot have prerequisites. |
| 223 | .el.elc: | 223 | .el.elc: |
| 224 | @echo Compiling $< | 224 | @echo Compiling $< |
| 225 | @# The BIG_STACK_OPTS are only needed to byte-compile the byte-compiler | ||
| 226 | @# files, which is normally done in compile-first, but may also be | ||
| 227 | @# recompiled via this rule. | ||
| 225 | @$(emacs) $(BIG_STACK_OPTS) $(BYTE_COMPILE_EXTRA_FLAGS) \ | 228 | @$(emacs) $(BIG_STACK_OPTS) $(BYTE_COMPILE_EXTRA_FLAGS) \ |
| 226 | -f batch-byte-compile $< | 229 | -f batch-byte-compile $< |
| 227 | 230 | ||
diff --git a/lisp/custom.el b/lisp/custom.el index e41e7c7bdf8..d0d11610b91 100644 --- a/lisp/custom.el +++ b/lisp/custom.el | |||
| @@ -55,11 +55,9 @@ Otherwise, if symbol has a `saved-value' property, it will evaluate | |||
| 55 | the car of that and use it as the default binding for symbol. | 55 | the car of that and use it as the default binding for symbol. |
| 56 | Otherwise, VALUE will be evaluated and used as the default binding for | 56 | Otherwise, VALUE will be evaluated and used as the default binding for |
| 57 | symbol." | 57 | symbol." |
| 58 | (unless (default-boundp symbol) | 58 | (eval `(defvar ,symbol ,(if (get symbol 'saved-value) |
| 59 | ;; Use the saved value if it exists, otherwise the standard setting. | 59 | (car (get symbol 'saved-value)) |
| 60 | (set-default symbol (eval (if (get symbol 'saved-value) | 60 | value)))) |
| 61 | (car (get symbol 'saved-value)) | ||
| 62 | value))))) | ||
| 63 | 61 | ||
| 64 | (defun custom-initialize-set (symbol value) | 62 | (defun custom-initialize-set (symbol value) |
| 65 | "Initialize SYMBOL based on VALUE. | 63 | "Initialize SYMBOL based on VALUE. |
| @@ -81,15 +79,15 @@ The value is either the symbol's current value | |||
| 81 | \(as obtained using the `:get' function), if any, | 79 | \(as obtained using the `:get' function), if any, |
| 82 | or the value in the symbol's `saved-value' property if any, | 80 | or the value in the symbol's `saved-value' property if any, |
| 83 | or (last of all) VALUE." | 81 | or (last of all) VALUE." |
| 84 | (funcall (or (get symbol 'custom-set) 'set-default) | 82 | (funcall (or (get symbol 'custom-set) 'set-default) |
| 85 | symbol | 83 | symbol |
| 86 | (cond ((default-boundp symbol) | 84 | (cond ((default-boundp symbol) |
| 87 | (funcall (or (get symbol 'custom-get) 'default-value) | 85 | (funcall (or (get symbol 'custom-get) 'default-value) |
| 88 | symbol)) | 86 | symbol)) |
| 89 | ((get symbol 'saved-value) | 87 | ((get symbol 'saved-value) |
| 90 | (eval (car (get symbol 'saved-value)))) | 88 | (eval (car (get symbol 'saved-value)))) |
| 91 | (t | 89 | (t |
| 92 | (eval value))))) | 90 | (eval value))))) |
| 93 | 91 | ||
| 94 | (defun custom-initialize-changed (symbol value) | 92 | (defun custom-initialize-changed (symbol value) |
| 95 | "Initialize SYMBOL with VALUE. | 93 | "Initialize SYMBOL with VALUE. |
| @@ -142,10 +140,8 @@ set to nil, as the value is no longer rogue." | |||
| 142 | ;; Maybe this option was rogue in an earlier version. It no longer is. | 140 | ;; Maybe this option was rogue in an earlier version. It no longer is. |
| 143 | (when (get symbol 'force-value) | 141 | (when (get symbol 'force-value) |
| 144 | (put symbol 'force-value nil)) | 142 | (put symbol 'force-value nil)) |
| 145 | (when doc | 143 | (if (keywordp doc) |
| 146 | (if (keywordp doc) | 144 | (error "Doc string is missing")) |
| 147 | (error "Doc string is missing") | ||
| 148 | (put symbol 'variable-documentation doc))) | ||
| 149 | (let ((initialize 'custom-initialize-reset) | 145 | (let ((initialize 'custom-initialize-reset) |
| 150 | (requests nil)) | 146 | (requests nil)) |
| 151 | (unless (memq :group args) | 147 | (unless (memq :group args) |
| @@ -189,6 +185,13 @@ set to nil, as the value is no longer rogue." | |||
| 189 | ;; Do the actual initialization. | 185 | ;; Do the actual initialization. |
| 190 | (unless custom-dont-initialize | 186 | (unless custom-dont-initialize |
| 191 | (funcall initialize symbol default))) | 187 | (funcall initialize symbol default))) |
| 188 | ;; Use defvar to set the docstring as well as the special-variable-p flag. | ||
| 189 | ;; FIXME: We should reproduce more of `defvar's behavior, such as the warning | ||
| 190 | ;; when the var is currently let-bound. | ||
| 191 | (if (not (default-boundp symbol)) | ||
| 192 | ;; Don't use defvar to avoid setting a default-value when undesired. | ||
| 193 | (when doc (put symbol 'variable-documentation doc)) | ||
| 194 | (eval `(defvar ,symbol nil ,@(when doc (list doc))))) | ||
| 192 | (push symbol current-load-list) | 195 | (push symbol current-load-list) |
| 193 | (run-hooks 'custom-define-hook) | 196 | (run-hooks 'custom-define-hook) |
| 194 | symbol) | 197 | symbol) |
diff --git a/lisp/dired.el b/lisp/dired.el index 4a17b443cfa..af99d4c7413 100644 --- a/lisp/dired.el +++ b/lisp/dired.el | |||
| @@ -1168,7 +1168,7 @@ If HDR is non-nil, insert a header line with the directory name." | |||
| 1168 | 1168 | ||
| 1169 | ;; Reverting a dired buffer | 1169 | ;; Reverting a dired buffer |
| 1170 | 1170 | ||
| 1171 | (defun dired-revert (&optional arg noconfirm) | 1171 | (defun dired-revert (&optional _arg _noconfirm) |
| 1172 | "Reread the dired buffer. | 1172 | "Reread the dired buffer. |
| 1173 | Must also be called after `dired-actual-switches' have changed. | 1173 | Must also be called after `dired-actual-switches' have changed. |
| 1174 | Should not fail even on completely garbaged buffers. | 1174 | Should not fail even on completely garbaged buffers. |
| @@ -2129,7 +2129,7 @@ Optional arg GLOBAL means to replace all matches." | |||
| 2129 | ;; dired-get-filename. | 2129 | ;; dired-get-filename. |
| 2130 | (concat (or dir default-directory) file)) | 2130 | (concat (or dir default-directory) file)) |
| 2131 | 2131 | ||
| 2132 | (defun dired-make-relative (file &optional dir ignore) | 2132 | (defun dired-make-relative (file &optional dir _ignore) |
| 2133 | "Convert FILE (an absolute file name) to a name relative to DIR. | 2133 | "Convert FILE (an absolute file name) to a name relative to DIR. |
| 2134 | If this is impossible, return FILE unchanged. | 2134 | If this is impossible, return FILE unchanged. |
| 2135 | DIR must be a directory name, not a file name." | 2135 | DIR must be a directory name, not a file name." |
| @@ -3219,7 +3219,7 @@ Type \\[help-command] at that time for help." | |||
| 3219 | (interactive "cRemove marks (RET means all): \nP") | 3219 | (interactive "cRemove marks (RET means all): \nP") |
| 3220 | (save-excursion | 3220 | (save-excursion |
| 3221 | (let* ((count 0) | 3221 | (let* ((count 0) |
| 3222 | (inhibit-read-only t) case-fold-search query | 3222 | (inhibit-read-only t) case-fold-search |
| 3223 | (string (format "\n%c" mark)) | 3223 | (string (format "\n%c" mark)) |
| 3224 | (help-form "\ | 3224 | (help-form "\ |
| 3225 | Type SPC or `y' to unmark one file, DEL or `n' to skip to next, | 3225 | Type SPC or `y' to unmark one file, DEL or `n' to skip to next, |
| @@ -3494,6 +3494,8 @@ Anything else means ask for each directory." | |||
| 3494 | (declare-function dnd-get-local-file-name "dnd" (uri &optional must-exist)) | 3494 | (declare-function dnd-get-local-file-name "dnd" (uri &optional must-exist)) |
| 3495 | (declare-function dnd-get-local-file-uri "dnd" (uri)) | 3495 | (declare-function dnd-get-local-file-uri "dnd" (uri)) |
| 3496 | 3496 | ||
| 3497 | (defvar dired-overwrite-confirmed) ;Defined in dired-aux. | ||
| 3498 | |||
| 3497 | (defun dired-dnd-handle-local-file (uri action) | 3499 | (defun dired-dnd-handle-local-file (uri action) |
| 3498 | "Copy, move or link a file to the dired directory. | 3500 | "Copy, move or link a file to the dired directory. |
| 3499 | URI is the file to handle, ACTION is one of copy, move, link or ask. | 3501 | URI is the file to handle, ACTION is one of copy, move, link or ask. |
| @@ -3572,21 +3574,21 @@ Ask means pop up a menu for the user to select one of copy, move or link." | |||
| 3572 | (function (lambda (f) (desktop-file-name (car f) dirname))) | 3574 | (function (lambda (f) (desktop-file-name (car f) dirname))) |
| 3573 | dired-subdir-alist))))) | 3575 | dired-subdir-alist))))) |
| 3574 | 3576 | ||
| 3575 | (defun dired-restore-desktop-buffer (desktop-buffer-file-name | 3577 | (defun dired-restore-desktop-buffer (_file-name |
| 3576 | desktop-buffer-name | 3578 | _buffer-name |
| 3577 | desktop-buffer-misc) | 3579 | misc-data) |
| 3578 | "Restore a dired buffer specified in a desktop file." | 3580 | "Restore a dired buffer specified in a desktop file." |
| 3579 | ;; First element of `desktop-buffer-misc' is the value of `dired-directory'. | 3581 | ;; First element of `misc-data' is the value of `dired-directory'. |
| 3580 | ;; This value is a directory name, optionally with shell wildcard or | 3582 | ;; This value is a directory name, optionally with shell wildcard or |
| 3581 | ;; a directory name followed by list of files. | 3583 | ;; a directory name followed by list of files. |
| 3582 | (let* ((dired-dir (car desktop-buffer-misc)) | 3584 | (let* ((dired-dir (car misc-data)) |
| 3583 | (dir (if (consp dired-dir) (car dired-dir) dired-dir))) | 3585 | (dir (if (consp dired-dir) (car dired-dir) dired-dir))) |
| 3584 | (if (file-directory-p (file-name-directory dir)) | 3586 | (if (file-directory-p (file-name-directory dir)) |
| 3585 | (progn | 3587 | (progn |
| 3586 | (dired dired-dir) | 3588 | (dired dired-dir) |
| 3587 | ;; The following elements of `desktop-buffer-misc' are the keys | 3589 | ;; The following elements of `misc-data' are the keys |
| 3588 | ;; from `dired-subdir-alist'. | 3590 | ;; from `dired-subdir-alist'. |
| 3589 | (mapc 'dired-maybe-insert-subdir (cdr desktop-buffer-misc)) | 3591 | (mapc 'dired-maybe-insert-subdir (cdr misc-data)) |
| 3590 | (current-buffer)) | 3592 | (current-buffer)) |
| 3591 | (message "Desktop: Directory %s no longer exists." dir) | 3593 | (message "Desktop: Directory %s no longer exists." dir) |
| 3592 | (when desktop-missing-file-warning (sit-for 1)) | 3594 | (when desktop-missing-file-warning (sit-for 1)) |
diff --git a/lisp/emacs-lisp/byte-opt.el b/lisp/emacs-lisp/byte-opt.el index 342dd8b71d1..d86cb729081 100644 --- a/lisp/emacs-lisp/byte-opt.el +++ b/lisp/emacs-lisp/byte-opt.el | |||
| @@ -308,6 +308,10 @@ | |||
| 308 | 308 | ||
| 309 | ;; ((lambda ...) ...) | 309 | ;; ((lambda ...) ...) |
| 310 | (defun byte-compile-unfold-lambda (form &optional name) | 310 | (defun byte-compile-unfold-lambda (form &optional name) |
| 311 | ;; In lexical-binding mode, let and functions don't bind vars in the same way | ||
| 312 | ;; (let obey special-variable-p, but functions don't). This doesn't matter | ||
| 313 | ;; here, because function's behavior is underspecified so it can safely be | ||
| 314 | ;; turned into a `let', even though the reverse is not true. | ||
| 311 | (or name (setq name "anonymous lambda")) | 315 | (or name (setq name "anonymous lambda")) |
| 312 | (let ((lambda (car form)) | 316 | (let ((lambda (car form)) |
| 313 | (values (cdr form))) | 317 | (values (cdr form))) |
diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el index 4a53faefa3d..3575b10e1f1 100644 --- a/lisp/emacs-lisp/bytecomp.el +++ b/lisp/emacs-lisp/bytecomp.el | |||
| @@ -2563,6 +2563,7 @@ If FORM is a lambda or a macro, byte-compile it as a function." | |||
| 2563 | ;; b-c-lambda didn't produce a compiled-function, so it's either a trivial | 2563 | ;; b-c-lambda didn't produce a compiled-function, so it's either a trivial |
| 2564 | ;; function, or this is Emacs 18, or generate-emacs19-bytecodes is off. | 2564 | ;; function, or this is Emacs 18, or generate-emacs19-bytecodes is off. |
| 2565 | ((let (tmp) | 2565 | ((let (tmp) |
| 2566 | ;; FIXME: can this happen? | ||
| 2566 | (if (and (setq tmp (assq 'byte-code (cdr-safe (cdr fun)))) | 2567 | (if (and (setq tmp (assq 'byte-code (cdr-safe (cdr fun)))) |
| 2567 | (null (cdr (memq tmp fun)))) | 2568 | (null (cdr (memq tmp fun)))) |
| 2568 | ;; Generate a make-byte-code call. | 2569 | ;; Generate a make-byte-code call. |
| @@ -2587,7 +2588,7 @@ If FORM is a lambda or a macro, byte-compile it as a function." | |||
| 2587 | (list 'quote fun)))))) | 2588 | (list 'quote fun)))))) |
| 2588 | 2589 | ||
| 2589 | ;; Turn a function into an ordinary lambda. Needed for v18 files. | 2590 | ;; Turn a function into an ordinary lambda. Needed for v18 files. |
| 2590 | (defun byte-compile-byte-code-unmake (function) | 2591 | (defun byte-compile-byte-code-unmake (function) ;FIXME: what is it? |
| 2591 | (if (consp function) | 2592 | (if (consp function) |
| 2592 | function;;It already is a lambda. | 2593 | function;;It already is a lambda. |
| 2593 | (setq function (append function nil)) ; turn it into a list | 2594 | (setq function (append function nil)) ; turn it into a list |
| @@ -2685,16 +2686,19 @@ If FORM is a lambda or a macro, byte-compile it as a function." | |||
| 2685 | ;; compile it, because `call-interactively' looks at the | 2686 | ;; compile it, because `call-interactively' looks at the |
| 2686 | ;; args of `list'. Actually, compile it to get warnings, | 2687 | ;; args of `list'. Actually, compile it to get warnings, |
| 2687 | ;; but don't use the result. | 2688 | ;; but don't use the result. |
| 2688 | (let ((form (nth 1 bytecomp-int))) | 2689 | (let* ((form (nth 1 bytecomp-int)) |
| 2690 | (newform (byte-compile-top-level form))) | ||
| 2689 | (while (memq (car-safe form) '(let let* progn save-excursion)) | 2691 | (while (memq (car-safe form) '(let let* progn save-excursion)) |
| 2690 | (while (consp (cdr form)) | 2692 | (while (consp (cdr form)) |
| 2691 | (setq form (cdr form))) | 2693 | (setq form (cdr form))) |
| 2692 | (setq form (car form))) | 2694 | (setq form (car form))) |
| 2693 | (if (eq (car-safe form) 'list) | 2695 | (if (and (eq (car-safe form) 'list) |
| 2694 | (byte-compile-top-level (nth 1 bytecomp-int)) | 2696 | ;; The spec is evaled in callint.c in dynamic-scoping |
| 2695 | (setq bytecomp-int (list 'interactive | 2697 | ;; mode, so just leaving the form unchanged would mean |
| 2696 | (byte-compile-top-level | 2698 | ;; it won't be eval'd in the right mode. |
| 2697 | (nth 1 bytecomp-int))))))) | 2699 | (not lexical-binding)) |
| 2700 | nil | ||
| 2701 | (setq bytecomp-int `(interactive ,newform))))) | ||
| 2698 | ((cdr bytecomp-int) | 2702 | ((cdr bytecomp-int) |
| 2699 | (byte-compile-warn "malformed interactive spec: %s" | 2703 | (byte-compile-warn "malformed interactive spec: %s" |
| 2700 | (prin1-to-string bytecomp-int))))) | 2704 | (prin1-to-string bytecomp-int))))) |
| @@ -3826,7 +3830,6 @@ Return the offset in the form (VAR . OFFSET)." | |||
| 3826 | (byte-compile-push-constant nil))))) | 3830 | (byte-compile-push-constant nil))))) |
| 3827 | 3831 | ||
| 3828 | (defun byte-compile-not-lexical-var-p (var) | 3832 | (defun byte-compile-not-lexical-var-p (var) |
| 3829 | ;; FIXME: this doesn't catch defcustoms! | ||
| 3830 | (or (not (symbolp var)) | 3833 | (or (not (symbolp var)) |
| 3831 | (special-variable-p var) | 3834 | (special-variable-p var) |
| 3832 | (memq var byte-compile-bound-variables) | 3835 | (memq var byte-compile-bound-variables) |
| @@ -4560,7 +4563,14 @@ Use with caution." | |||
| 4560 | (setq f (car f)) | 4563 | (setq f (car f)) |
| 4561 | (if (string-match "elc\\'" f) (setq f (substring f 0 -1))) | 4564 | (if (string-match "elc\\'" f) (setq f (substring f 0 -1))) |
| 4562 | (when (and (file-readable-p f) | 4565 | (when (and (file-readable-p f) |
| 4563 | (file-newer-than-file-p f emacs-file)) | 4566 | (file-newer-than-file-p f emacs-file) |
| 4567 | ;; Don't reload the source version of the files below | ||
| 4568 | ;; because that causes subsequent byte-compilation to | ||
| 4569 | ;; be a lot slower and need a higher max-lisp-eval-depth, | ||
| 4570 | ;; so it can cause recompilation to fail. | ||
| 4571 | (not (member (file-name-nondirectory f) | ||
| 4572 | '("pcase.el" "bytecomp.el" "macroexp.el" | ||
| 4573 | "cconv.el" "byte-opt.el")))) | ||
| 4564 | (message "Reloading stale %s" (file-name-nondirectory f)) | 4574 | (message "Reloading stale %s" (file-name-nondirectory f)) |
| 4565 | (condition-case nil | 4575 | (condition-case nil |
| 4566 | (load f 'noerror nil 'nosuffix) | 4576 | (load f 'noerror nil 'nosuffix) |
diff --git a/lisp/emacs-lisp/cconv.el b/lisp/emacs-lisp/cconv.el index 006e2ef904c..7855193fa3f 100644 --- a/lisp/emacs-lisp/cconv.el +++ b/lisp/emacs-lisp/cconv.el | |||
| @@ -65,21 +65,54 @@ | |||
| 65 | ;; | 65 | ;; |
| 66 | ;;; Code: | 66 | ;;; Code: |
| 67 | 67 | ||
| 68 | ;;; TODO: | 68 | ;; TODO: |
| 69 | ;; - pay attention to `interactive': its arg is run in an empty env. | ||
| 70 | ;; - canonize code in macro-expand so we don't have to handle (let (var) body) | 69 | ;; - canonize code in macro-expand so we don't have to handle (let (var) body) |
| 71 | ;; and other oddities. | 70 | ;; and other oddities. |
| 72 | ;; - Change new byte-code representation, so it directly gives the | 71 | ;; - Change new byte-code representation, so it directly gives the |
| 73 | ;; number of mandatory and optional arguments as well as whether or | 72 | ;; number of mandatory and optional arguments as well as whether or |
| 74 | ;; not there's a &rest arg. | 73 | ;; not there's a &rest arg. |
| 75 | ;; - warn about unused lexical vars. | ||
| 76 | ;; - clean up cconv-closure-convert-rec, especially the `let' binding part. | 74 | ;; - clean up cconv-closure-convert-rec, especially the `let' binding part. |
| 77 | ;; - new byte codes for unwind-protect, catch, and condition-case so that | 75 | ;; - new byte codes for unwind-protect, catch, and condition-case so that |
| 78 | ;; closures aren't needed at all. | 76 | ;; closures aren't needed at all. |
| 77 | ;; - a reference to a var that is known statically to always hold a constant | ||
| 78 | ;; should be turned into a byte-constant rather than a byte-stack-ref. | ||
| 79 | ;; Hmm... right, that's called constant propagation and could be done here | ||
| 80 | ;; But when that constant is a function, we have to be careful to make sure | ||
| 81 | ;; the bytecomp only compiles it once. | ||
| 82 | ;; - Since we know here when a variable is not mutated, we could pass that | ||
| 83 | ;; info to the byte-compiler, e.g. by using a new `immutable-let'. | ||
| 84 | ;; - add tail-calls to bytecode.c and the bytecompiler. | ||
| 85 | |||
| 86 | ;; (defmacro dlet (binders &rest body) | ||
| 87 | ;; ;; Works in both lexical and non-lexical mode. | ||
| 88 | ;; `(progn | ||
| 89 | ;; ,@(mapcar (lambda (binder) | ||
| 90 | ;; `(defvar ,(if (consp binder) (car binder) binder))) | ||
| 91 | ;; binders) | ||
| 92 | ;; (let ,binders ,@body))) | ||
| 93 | |||
| 94 | ;; (defmacro llet (binders &rest body) | ||
| 95 | ;; ;; Only works in lexical-binding mode. | ||
| 96 | ;; `(funcall | ||
| 97 | ;; (lambda ,(mapcar (lambda (binder) (if (consp binder) (car binder) binder)) | ||
| 98 | ;; binders) | ||
| 99 | ;; ,@body) | ||
| 100 | ;; ,@(mapcar (lambda (binder) (if (consp binder) (cadr binder))) | ||
| 101 | ;; binders))) | ||
| 102 | |||
| 103 | ;; (defmacro letrec (binders &rest body) | ||
| 104 | ;; ;; Only useful in lexical-binding mode. | ||
| 105 | ;; ;; As a special-form, we could implement it more efficiently (and cleanly, | ||
| 106 | ;; ;; making the vars actually unbound during evaluation of the binders). | ||
| 107 | ;; `(let ,(mapcar (lambda (binder) (if (consp binder) (car binder) binder)) | ||
| 108 | ;; binders) | ||
| 109 | ;; ,@(delq nil (mapcar (lambda (binder) (if (consp binder) `(setq ,@binder))) | ||
| 110 | ;; binders)) | ||
| 111 | ;; ,@body)) | ||
| 79 | 112 | ||
| 80 | (eval-when-compile (require 'cl)) | 113 | (eval-when-compile (require 'cl)) |
| 81 | 114 | ||
| 82 | (defconst cconv-liftwhen 3 | 115 | (defconst cconv-liftwhen 6 |
| 83 | "Try to do lambda lifting if the number of arguments + free variables | 116 | "Try to do lambda lifting if the number of arguments + free variables |
| 84 | is less than this number.") | 117 | is less than this number.") |
| 85 | ;; List of all the variables that are both captured by a closure | 118 | ;; List of all the variables that are both captured by a closure |
| @@ -212,13 +245,13 @@ Returns a form where all lambdas don't have any free variables." | |||
| 212 | ;; This function actually rewrites the tree. | 245 | ;; This function actually rewrites the tree. |
| 213 | "Eliminates all free variables of all lambdas in given forms. | 246 | "Eliminates all free variables of all lambdas in given forms. |
| 214 | Arguments: | 247 | Arguments: |
| 215 | -- FORM is a piece of Elisp code after macroexpansion. | 248 | - FORM is a piece of Elisp code after macroexpansion. |
| 216 | -- LMENVS is a list of environments used for lambda-lifting. Initially empty. | 249 | - LMENVS is a list of environments used for lambda-lifting. Initially empty. |
| 217 | -- EMVRS is a list that contains mutated variables that are visible | 250 | - EMVRS is a list that contains mutated variables that are visible |
| 218 | within current environment. | 251 | within current environment. |
| 219 | -- ENVS is an environment(list of free variables) of current closure. | 252 | - ENVS is an environment(list of free variables) of current closure. |
| 220 | Initially empty. | 253 | Initially empty. |
| 221 | -- FVRS is a list of variables to substitute in each context. | 254 | - FVRS is a list of variables to substitute in each context. |
| 222 | Initially empty. | 255 | Initially empty. |
| 223 | 256 | ||
| 224 | Returns a form where all lambdas don't have any free variables." | 257 | Returns a form where all lambdas don't have any free variables." |
| @@ -270,10 +303,17 @@ Returns a form where all lambdas don't have any free variables." | |||
| 270 | ; lambda lifting condition | 303 | ; lambda lifting condition |
| 271 | (if (or (not fv) (< cconv-liftwhen (length funcvars))) | 304 | (if (or (not fv) (< cconv-liftwhen (length funcvars))) |
| 272 | ; do not lift | 305 | ; do not lift |
| 273 | (cconv-closure-convert-rec | 306 | (progn |
| 274 | value emvrs fvrs envs lmenvs) | 307 | ;; (byte-compile-log-warning |
| 308 | ;; (format "Not λ-lifting `%S': %d > %d" | ||
| 309 | ;; var (length funcvars) cconv-liftwhen)) | ||
| 310 | |||
| 311 | (cconv-closure-convert-rec | ||
| 312 | value emvrs fvrs envs lmenvs)) | ||
| 275 | ; lift | 313 | ; lift |
| 276 | (progn | 314 | (progn |
| 315 | ;; (byte-compile-log-warning | ||
| 316 | ;; (format "λ-lifting `%S'" var)) | ||
| 277 | (setq cconv-freevars-alist | 317 | (setq cconv-freevars-alist |
| 278 | ;; Now that we know we'll λ-lift, consume the | 318 | ;; Now that we know we'll λ-lift, consume the |
| 279 | ;; freevar data. | 319 | ;; freevar data. |
| @@ -579,6 +619,12 @@ Returns a form where all lambdas don't have any free variables." | |||
| 579 | cdr-new)) | 619 | cdr-new)) |
| 580 | `(,callsym . ,(reverse cdr-new)))))) | 620 | `(,callsym . ,(reverse cdr-new)))))) |
| 581 | 621 | ||
| 622 | (`(interactive . ,forms) | ||
| 623 | `(interactive | ||
| 624 | ,@(mapcar (lambda (form) | ||
| 625 | (cconv-closure-convert-rec form nil nil nil nil)) | ||
| 626 | forms))) | ||
| 627 | |||
| 582 | (`(,func . ,body-forms) ; first element is function or whatever | 628 | (`(,func . ,body-forms) ; first element is function or whatever |
| 583 | ; function-like forms are: | 629 | ; function-like forms are: |
| 584 | ; or, and, if, progn, prog1, prog2, | 630 | ; or, and, if, progn, prog1, prog2, |
| @@ -608,23 +654,34 @@ Returns a form where all lambdas don't have any free variables." | |||
| 608 | ;; Only used to test the code in non-lexbind Emacs. | 654 | ;; Only used to test the code in non-lexbind Emacs. |
| 609 | (defalias 'byte-compile-not-lexical-var-p 'boundp)) | 655 | (defalias 'byte-compile-not-lexical-var-p 'boundp)) |
| 610 | 656 | ||
| 611 | (defun cconv-analyse-use (vardata form) | 657 | (defun cconv-analyse-use (vardata form varkind) |
| 658 | "Analyse the use of a variable. | ||
| 659 | VARDATA should be (BINDER READ MUTATED CAPTURED CALLED). | ||
| 660 | VARKIND is the name of the kind of variable. | ||
| 661 | FORM is the parent form that binds this var." | ||
| 612 | ;; use = `(,binder ,read ,mutated ,captured ,called) | 662 | ;; use = `(,binder ,read ,mutated ,captured ,called) |
| 613 | (pcase vardata | 663 | (pcase vardata |
| 614 | (`(,binder nil ,_ ,_ nil) | 664 | (`(,_ nil nil nil nil) nil) |
| 615 | ;; FIXME: Don't warn about unused fun-args. | 665 | (`((,(and (pred (lambda (var) (eq ?_ (aref (symbol-name var) 0)))) var) . ,_) |
| 616 | ;; FIXME: Don't warn about uninterned vars or _ vars. | 666 | ,_ ,_ ,_ ,_) |
| 617 | ;; FIXME: This gives warnings in the wrong order and with wrong line | 667 | (byte-compile-log-warning (format "%s `%S' not left unused" varkind var))) |
| 618 | ;; number and without function name info. | 668 | ((or `(,_ ,_ ,_ ,_ ,_) dontcare) nil)) |
| 619 | (byte-compile-log-warning (format "Unused variable %S" (car binder)))) | 669 | (pcase vardata |
| 670 | (`((,var . ,_) nil ,_ ,_ nil) | ||
| 671 | ;; FIXME: This gives warnings in the wrong order, with imprecise line | ||
| 672 | ;; numbers and without function name info. | ||
| 673 | (unless (or ;; Uninterned symbols typically come from macro-expansion, so | ||
| 674 | ;; it is often non-trivial for the programmer to avoid such | ||
| 675 | ;; unused vars. | ||
| 676 | (not (intern-soft var)) | ||
| 677 | (eq ?_ (aref (symbol-name var) 0))) | ||
| 678 | (byte-compile-log-warning (format "Unused lexical %s `%S'" | ||
| 679 | varkind var)))) | ||
| 620 | ;; If it's unused, there's no point converting it into a cons-cell, even if | 680 | ;; If it's unused, there's no point converting it into a cons-cell, even if |
| 621 | ;; it's captures and mutated. | 681 | ;; it's captured and mutated. |
| 622 | (`(,binder ,_ t t ,_) | 682 | (`(,binder ,_ t t ,_) |
| 623 | (push (cons binder form) cconv-captured+mutated)) | 683 | (push (cons binder form) cconv-captured+mutated)) |
| 624 | (`(,(and binder `(,_ (function (lambda . ,_)))) nil nil nil t) | 684 | (`(,(and binder `(,_ (function (lambda . ,_)))) nil nil nil t) |
| 625 | ;; This is very rare in typical Elisp code. It's probably not really | ||
| 626 | ;; worth the trouble to try and use lambda-lifting in Elisp, but | ||
| 627 | ;; since we coded it up, we might as well use it. | ||
| 628 | (push (cons binder form) cconv-lambda-candidates)) | 685 | (push (cons binder form) cconv-lambda-candidates)) |
| 629 | (`(,_ ,_ ,_ ,_ ,_) nil) | 686 | (`(,_ ,_ ,_ ,_ ,_) nil) |
| 630 | (dontcare))) | 687 | (dontcare))) |
| @@ -654,7 +711,7 @@ Returns a form where all lambdas don't have any free variables." | |||
| 654 | (cconv-analyse-form form newenv)) | 711 | (cconv-analyse-form form newenv)) |
| 655 | ;; Summarize resulting data about arguments. | 712 | ;; Summarize resulting data about arguments. |
| 656 | (dolist (vardata newvars) | 713 | (dolist (vardata newvars) |
| 657 | (cconv-analyse-use vardata parentform)) | 714 | (cconv-analyse-use vardata parentform "argument")) |
| 658 | ;; Transfer uses collected in `envcopy' (via `newenv') back to `env'; | 715 | ;; Transfer uses collected in `envcopy' (via `newenv') back to `env'; |
| 659 | ;; and compute free variables. | 716 | ;; and compute free variables. |
| 660 | (while env | 717 | (while env |
| @@ -673,8 +730,8 @@ Returns a form where all lambdas don't have any free variables." | |||
| 673 | (defun cconv-analyse-form (form env) | 730 | (defun cconv-analyse-form (form env) |
| 674 | "Find mutated variables and variables captured by closure. | 731 | "Find mutated variables and variables captured by closure. |
| 675 | Analyse lambdas if they are suitable for lambda lifting. | 732 | Analyse lambdas if they are suitable for lambda lifting. |
| 676 | -- FORM is a piece of Elisp code after macroexpansion. | 733 | - FORM is a piece of Elisp code after macroexpansion. |
| 677 | -- ENV is an alist mapping each enclosing lexical variable to its info. | 734 | - ENV is an alist mapping each enclosing lexical variable to its info. |
| 678 | I.e. each element has the form (VAR . (READ MUTATED CAPTURED CALLED)). | 735 | I.e. each element has the form (VAR . (READ MUTATED CAPTURED CALLED)). |
| 679 | This function does not return anything but instead fills the | 736 | This function does not return anything but instead fills the |
| 680 | `cconv-captured+mutated' and `cconv-lambda-candidates' variables | 737 | `cconv-captured+mutated' and `cconv-lambda-candidates' variables |
| @@ -707,7 +764,7 @@ and updates the data stored in ENV." | |||
| 707 | (cconv-analyse-form form env)) | 764 | (cconv-analyse-form form env)) |
| 708 | 765 | ||
| 709 | (dolist (vardata newvars) | 766 | (dolist (vardata newvars) |
| 710 | (cconv-analyse-use vardata form)))) | 767 | (cconv-analyse-use vardata form "variable")))) |
| 711 | 768 | ||
| 712 | ; defun special form | 769 | ; defun special form |
| 713 | (`(,(or `defun `defmacro) ,func ,vrs . ,body-forms) | 770 | (`(,(or `defun `defmacro) ,func ,vrs . ,body-forms) |
| @@ -736,8 +793,7 @@ and updates the data stored in ENV." | |||
| 736 | 793 | ||
| 737 | (`(cond . ,cond-forms) ; cond special form | 794 | (`(cond . ,cond-forms) ; cond special form |
| 738 | (dolist (forms cond-forms) | 795 | (dolist (forms cond-forms) |
| 739 | (dolist (form forms) | 796 | (dolist (form forms) (cconv-analyse-form form env)))) |
| 740 | (cconv-analyse-form form env)))) | ||
| 741 | 797 | ||
| 742 | (`(quote . ,_) nil) ; quote form | 798 | (`(quote . ,_) nil) ; quote form |
| 743 | (`(function . ,_) nil) ; same as quote | 799 | (`(function . ,_) nil) ; same as quote |
| @@ -773,12 +829,18 @@ and updates the data stored in ENV." | |||
| 773 | (if fdata | 829 | (if fdata |
| 774 | (setf (nth 4 fdata) t) | 830 | (setf (nth 4 fdata) t) |
| 775 | (cconv-analyse-form fun env))) | 831 | (cconv-analyse-form fun env))) |
| 776 | (dolist (form args) | 832 | (dolist (form args) (cconv-analyse-form form env))) |
| 777 | (cconv-analyse-form form env))) | 833 | |
| 778 | 834 | (`(interactive . ,forms) | |
| 835 | ;; These appear within the function body but they don't have access | ||
| 836 | ;; to the function's arguments. | ||
| 837 | ;; We could extend this to allow interactive specs to refer to | ||
| 838 | ;; variables in the function's enclosing environment, but it doesn't | ||
| 839 | ;; seem worth the trouble. | ||
| 840 | (dolist (form forms) (cconv-analyse-form form nil))) | ||
| 841 | |||
| 779 | (`(,_ . ,body-forms) ; First element is a function or whatever. | 842 | (`(,_ . ,body-forms) ; First element is a function or whatever. |
| 780 | (dolist (form body-forms) | 843 | (dolist (form body-forms) (cconv-analyse-form form env))) |
| 781 | (cconv-analyse-form form env))) | ||
| 782 | 844 | ||
| 783 | ((pred symbolp) | 845 | ((pred symbolp) |
| 784 | (let ((dv (assq form env))) ; dv = declared and visible | 846 | (let ((dv (assq form env))) ; dv = declared and visible |
diff --git a/lisp/emacs-lisp/pcase.el b/lisp/emacs-lisp/pcase.el index d795dbd390c..89bbff980c4 100644 --- a/lisp/emacs-lisp/pcase.el +++ b/lisp/emacs-lisp/pcase.el | |||
| @@ -431,7 +431,7 @@ and otherwise defers to REST which is a list of branches of the form | |||
| 431 | rest))))))) | 431 | rest))))))) |
| 432 | ((eq 'match (caar matches)) | 432 | ((eq 'match (caar matches)) |
| 433 | (let* ((popmatches (pop matches)) | 433 | (let* ((popmatches (pop matches)) |
| 434 | (op (car popmatches)) (cdrpopmatches (cdr popmatches)) | 434 | (_op (car popmatches)) (cdrpopmatches (cdr popmatches)) |
| 435 | (sym (car cdrpopmatches)) | 435 | (sym (car cdrpopmatches)) |
| 436 | (upat (cdr cdrpopmatches))) | 436 | (upat (cdr cdrpopmatches))) |
| 437 | (cond | 437 | (cond |
| @@ -520,7 +520,7 @@ and otherwise defers to REST which is a list of branches of the form | |||
| 520 | (pcase--u1 `((match ,sym . ,(cadr upat))) | 520 | (pcase--u1 `((match ,sym . ,(cadr upat))) |
| 521 | ;; FIXME: This codegen is not careful to share its | 521 | ;; FIXME: This codegen is not careful to share its |
| 522 | ;; code if used several times: code blow up is likely. | 522 | ;; code if used several times: code blow up is likely. |
| 523 | (lambda (vars) | 523 | (lambda (_vars) |
| 524 | ;; `vars' will likely contain bindings which are | 524 | ;; `vars' will likely contain bindings which are |
| 525 | ;; not always available in other paths to | 525 | ;; not always available in other paths to |
| 526 | ;; `rest', so there' no point trying to pass | 526 | ;; `rest', so there' no point trying to pass |
diff --git a/lisp/help-fns.el b/lisp/help-fns.el index b488bc40acd..87fb6a02bd3 100644 --- a/lisp/help-fns.el +++ b/lisp/help-fns.el | |||
| @@ -119,8 +119,11 @@ ARGLIST can also be t or a string of the form \"(FUN ARG1 ARG2 ...)\"." | |||
| 119 | (cdr arg)) | 119 | (cdr arg)) |
| 120 | arg) | 120 | arg) |
| 121 | (let ((name (symbol-name arg))) | 121 | (let ((name (symbol-name arg))) |
| 122 | (if (string-match "\\`&" name) arg | 122 | (cond |
| 123 | (intern (upcase name)))))) | 123 | ((string-match "\\`&" name) arg) |
| 124 | ((string-match "\\`_" name) | ||
| 125 | (intern (upcase (substring name 1)))) | ||
| 126 | (t (intern (upcase name))))))) | ||
| 124 | arglist))) | 127 | arglist))) |
| 125 | 128 | ||
| 126 | ;; Could be this, if we make symbol-file do the work below. | 129 | ;; Could be this, if we make symbol-file do the work below. |
diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el index 392ec2d3dad..531a0e26eaf 100644 --- a/lisp/minibuffer.el +++ b/lisp/minibuffer.el | |||
| @@ -210,7 +210,7 @@ You should give VAR a non-nil `risky-local-variable' property." | |||
| 210 | ((vectorp table) ;Obarray. | 210 | ((vectorp table) ;Obarray. |
| 211 | (lambda (sym) (funcall pred (concat prefix (symbol-name sym))))) | 211 | (lambda (sym) (funcall pred (concat prefix (symbol-name sym))))) |
| 212 | ((hash-table-p table) | 212 | ((hash-table-p table) |
| 213 | (lambda (s v) (funcall pred (concat prefix s)))) | 213 | (lambda (s _v) (funcall pred (concat prefix s)))) |
| 214 | ((functionp table) | 214 | ((functionp table) |
| 215 | (lambda (s) (funcall pred (concat prefix s)))) | 215 | (lambda (s) (funcall pred (concat prefix s)))) |
| 216 | (t ;Lists and alists. | 216 | (t ;Lists and alists. |
| @@ -681,7 +681,7 @@ scroll the window of possible completions." | |||
| 681 | t) | 681 | t) |
| 682 | (t t))))) | 682 | (t t))))) |
| 683 | 683 | ||
| 684 | (defun completion--flush-all-sorted-completions (&rest ignore) | 684 | (defun completion--flush-all-sorted-completions (&rest _ignore) |
| 685 | (setq completion-cycling nil) | 685 | (setq completion-cycling nil) |
| 686 | (setq completion-all-sorted-completions nil)) | 686 | (setq completion-all-sorted-completions nil)) |
| 687 | 687 | ||
| @@ -1313,7 +1313,7 @@ The completion method is determined by `completion-at-point-functions'." | |||
| 1313 | (concat "\\(?:^\\|[^$]\\(?:\\$\\$\\)*\\)" | 1313 | (concat "\\(?:^\\|[^$]\\(?:\\$\\$\\)*\\)" |
| 1314 | "$\\([[:alnum:]_]*\\|{\\([^}]*\\)\\)\\'")) | 1314 | "$\\([[:alnum:]_]*\\|{\\([^}]*\\)\\)\\'")) |
| 1315 | 1315 | ||
| 1316 | (defun completion--embedded-envvar-table (string pred action) | 1316 | (defun completion--embedded-envvar-table (string _pred action) |
| 1317 | "Completion table for envvars embedded in a string. | 1317 | "Completion table for envvars embedded in a string. |
| 1318 | The envvar syntax (and escaping) rules followed by this table are the | 1318 | The envvar syntax (and escaping) rules followed by this table are the |
| 1319 | same as `substitute-in-file-name'." | 1319 | same as `substitute-in-file-name'." |
| @@ -1726,13 +1726,13 @@ Like `internal-complete-buffer', but removes BUFFER from the completion list." | |||
| 1726 | 1726 | ||
| 1727 | ;;; Old-style completion, used in Emacs-21 and Emacs-22. | 1727 | ;;; Old-style completion, used in Emacs-21 and Emacs-22. |
| 1728 | 1728 | ||
| 1729 | (defun completion-emacs21-try-completion (string table pred point) | 1729 | (defun completion-emacs21-try-completion (string table pred _point) |
| 1730 | (let ((completion (try-completion string table pred))) | 1730 | (let ((completion (try-completion string table pred))) |
| 1731 | (if (stringp completion) | 1731 | (if (stringp completion) |
| 1732 | (cons completion (length completion)) | 1732 | (cons completion (length completion)) |
| 1733 | completion))) | 1733 | completion))) |
| 1734 | 1734 | ||
| 1735 | (defun completion-emacs21-all-completions (string table pred point) | 1735 | (defun completion-emacs21-all-completions (string table pred _point) |
| 1736 | (completion-hilit-commonality | 1736 | (completion-hilit-commonality |
| 1737 | (all-completions string table pred) | 1737 | (all-completions string table pred) |
| 1738 | (length string) | 1738 | (length string) |
| @@ -1817,7 +1817,7 @@ Return the new suffix." | |||
| 1817 | (let* ((beforepoint (substring string 0 point)) | 1817 | (let* ((beforepoint (substring string 0 point)) |
| 1818 | (afterpoint (substring string point)) | 1818 | (afterpoint (substring string point)) |
| 1819 | (bounds (completion-boundaries beforepoint table pred afterpoint)) | 1819 | (bounds (completion-boundaries beforepoint table pred afterpoint)) |
| 1820 | (suffix (substring afterpoint (cdr bounds))) | 1820 | ;; (suffix (substring afterpoint (cdr bounds))) |
| 1821 | (prefix (substring beforepoint 0 (car bounds))) | 1821 | (prefix (substring beforepoint 0 (car bounds))) |
| 1822 | (pattern (delete | 1822 | (pattern (delete |
| 1823 | "" (list (substring beforepoint (car bounds)) | 1823 | "" (list (substring beforepoint (car bounds)) |
| @@ -2006,7 +2006,7 @@ filter out additional entries (because TABLE migth not obey PRED)." | |||
| 2006 | ;; The prefix has no completions at all, so we should try and fix | 2006 | ;; The prefix has no completions at all, so we should try and fix |
| 2007 | ;; that first. | 2007 | ;; that first. |
| 2008 | (let ((substring (substring prefix 0 -1))) | 2008 | (let ((substring (substring prefix 0 -1))) |
| 2009 | (destructuring-bind (subpat suball subprefix subsuffix) | 2009 | (destructuring-bind (subpat suball subprefix _subsuffix) |
| 2010 | (completion-pcm--find-all-completions | 2010 | (completion-pcm--find-all-completions |
| 2011 | substring table pred (length substring) filter) | 2011 | substring table pred (length substring) filter) |
| 2012 | (let ((sep (aref prefix (1- (length prefix)))) | 2012 | (let ((sep (aref prefix (1- (length prefix)))) |
| @@ -2071,7 +2071,7 @@ filter out additional entries (because TABLE migth not obey PRED)." | |||
| 2071 | (list pattern all prefix suffix))))) | 2071 | (list pattern all prefix suffix))))) |
| 2072 | 2072 | ||
| 2073 | (defun completion-pcm-all-completions (string table pred point) | 2073 | (defun completion-pcm-all-completions (string table pred point) |
| 2074 | (destructuring-bind (pattern all &optional prefix suffix) | 2074 | (destructuring-bind (pattern all &optional prefix _suffix) |
| 2075 | (completion-pcm--find-all-completions string table pred point) | 2075 | (completion-pcm--find-all-completions string table pred point) |
| 2076 | (when all | 2076 | (when all |
| 2077 | (nconc (completion-pcm--hilit-commonality pattern all) | 2077 | (nconc (completion-pcm--hilit-commonality pattern all) |
| @@ -2246,14 +2246,14 @@ filter out additional entries (because TABLE migth not obey PRED)." | |||
| 2246 | (list all pattern prefix suffix (car bounds)))) | 2246 | (list all pattern prefix suffix (car bounds)))) |
| 2247 | 2247 | ||
| 2248 | (defun completion-substring-try-completion (string table pred point) | 2248 | (defun completion-substring-try-completion (string table pred point) |
| 2249 | (destructuring-bind (all pattern prefix suffix carbounds) | 2249 | (destructuring-bind (all pattern prefix suffix _carbounds) |
| 2250 | (completion-substring--all-completions string table pred point) | 2250 | (completion-substring--all-completions string table pred point) |
| 2251 | (if minibuffer-completing-file-name | 2251 | (if minibuffer-completing-file-name |
| 2252 | (setq all (completion-pcm--filename-try-filter all))) | 2252 | (setq all (completion-pcm--filename-try-filter all))) |
| 2253 | (completion-pcm--merge-try pattern all prefix suffix))) | 2253 | (completion-pcm--merge-try pattern all prefix suffix))) |
| 2254 | 2254 | ||
| 2255 | (defun completion-substring-all-completions (string table pred point) | 2255 | (defun completion-substring-all-completions (string table pred point) |
| 2256 | (destructuring-bind (all pattern prefix suffix carbounds) | 2256 | (destructuring-bind (all pattern prefix _suffix _carbounds) |
| 2257 | (completion-substring--all-completions string table pred point) | 2257 | (completion-substring--all-completions string table pred point) |
| 2258 | (when all | 2258 | (when all |
| 2259 | (nconc (completion-pcm--hilit-commonality pattern all) | 2259 | (nconc (completion-pcm--hilit-commonality pattern all) |
| @@ -2290,12 +2290,12 @@ filter out additional entries (because TABLE migth not obey PRED)." | |||
| 2290 | (concat (substring str 0 (car bounds)) | 2290 | (concat (substring str 0 (car bounds)) |
| 2291 | (mapconcat 'string (substring str (car bounds)) sep)))))))) | 2291 | (mapconcat 'string (substring str (car bounds)) sep)))))))) |
| 2292 | 2292 | ||
| 2293 | (defun completion-initials-all-completions (string table pred point) | 2293 | (defun completion-initials-all-completions (string table pred _point) |
| 2294 | (let ((newstr (completion-initials-expand string table pred))) | 2294 | (let ((newstr (completion-initials-expand string table pred))) |
| 2295 | (when newstr | 2295 | (when newstr |
| 2296 | (completion-pcm-all-completions newstr table pred (length newstr))))) | 2296 | (completion-pcm-all-completions newstr table pred (length newstr))))) |
| 2297 | 2297 | ||
| 2298 | (defun completion-initials-try-completion (string table pred point) | 2298 | (defun completion-initials-try-completion (string table pred _point) |
| 2299 | (let ((newstr (completion-initials-expand string table pred))) | 2299 | (let ((newstr (completion-initials-expand string table pred))) |
| 2300 | (when newstr | 2300 | (when newstr |
| 2301 | (completion-pcm-try-completion newstr table pred (length newstr))))) | 2301 | (completion-pcm-try-completion newstr table pred (length newstr))))) |
diff --git a/lisp/mpc.el b/lisp/mpc.el index 548fd17d038..10e8c9d7688 100644 --- a/lisp/mpc.el +++ b/lisp/mpc.el | |||
| @@ -357,14 +357,14 @@ which will be concatenated with proper quoting before passing them to MPD." | |||
| 357 | (mapconcat 'mpc--proc-quote-string cmd " ")) | 357 | (mapconcat 'mpc--proc-quote-string cmd " ")) |
| 358 | "\n"))) | 358 | "\n"))) |
| 359 | (if callback | 359 | (if callback |
| 360 | (let ((buf (current-buffer))) | 360 | ;; (let ((buf (current-buffer))) |
| 361 | (process-put proc 'callback | 361 | (process-put proc 'callback |
| 362 | callback | 362 | callback |
| 363 | ;; (lambda () | 363 | ;; (lambda () |
| 364 | ;; (funcall callback | 364 | ;; (funcall callback |
| 365 | ;; (prog1 (current-buffer) | 365 | ;; (prog1 (current-buffer) |
| 366 | ;; (set-buffer buf)))) | 366 | ;; (set-buffer buf))))) |
| 367 | )) | 367 | ) |
| 368 | ;; If `callback' is nil, we're executing synchronously. | 368 | ;; If `callback' is nil, we're executing synchronously. |
| 369 | (process-put proc 'callback 'ignore) | 369 | (process-put proc 'callback 'ignore) |
| 370 | ;; This returns the process's buffer. | 370 | ;; This returns the process's buffer. |
| @@ -600,7 +600,7 @@ The songs are returned as alists." | |||
| 600 | (cond | 600 | (cond |
| 601 | ((eq tag 'Playlist) | 601 | ((eq tag 'Playlist) |
| 602 | ;; Special case for pseudo-tag playlist. | 602 | ;; Special case for pseudo-tag playlist. |
| 603 | (let ((l (condition-case err | 603 | (let ((l (condition-case nil |
| 604 | (mpc-proc-buf-to-alists | 604 | (mpc-proc-buf-to-alists |
| 605 | (mpc-proc-cmd (list "listplaylistinfo" value))) | 605 | (mpc-proc-cmd (list "listplaylistinfo" value))) |
| 606 | (mpc-proc-error | 606 | (mpc-proc-error |
| @@ -633,7 +633,7 @@ The songs are returned as alists." | |||
| 633 | (mpc-union (mpc-cmd-find tag1 value) | 633 | (mpc-union (mpc-cmd-find tag1 value) |
| 634 | (mpc-cmd-find tag2 value)))) | 634 | (mpc-cmd-find tag2 value)))) |
| 635 | (t | 635 | (t |
| 636 | (condition-case err | 636 | (condition-case nil |
| 637 | (mpc-proc-buf-to-alists | 637 | (mpc-proc-buf-to-alists |
| 638 | (mpc-proc-cmd (list "find" (symbol-name tag) value))) | 638 | (mpc-proc-cmd (list "find" (symbol-name tag) value))) |
| 639 | (mpc-proc-error | 639 | (mpc-proc-error |
| @@ -935,7 +935,7 @@ If PLAYLIST is t or nil or missing, use the main playlist." | |||
| 935 | 935 | ||
| 936 | (defun mpc-tempfiles-clean () | 936 | (defun mpc-tempfiles-clean () |
| 937 | (let ((live ())) | 937 | (let ((live ())) |
| 938 | (maphash (lambda (k v) (push v live)) mpc-tempfiles-reftable) | 938 | (maphash (lambda (_k v) (push v live)) mpc-tempfiles-reftable) |
| 939 | (dolist (f mpc-tempfiles) | 939 | (dolist (f mpc-tempfiles) |
| 940 | (unless (member f live) (ignore-errors (delete-file f)))) | 940 | (unless (member f live) (ignore-errors (delete-file f)))) |
| 941 | (setq mpc-tempfiles live))) | 941 | (setq mpc-tempfiles live))) |
| @@ -1159,7 +1159,7 @@ If PLAYLIST is t or nil or missing, use the main playlist." | |||
| 1159 | (mpc-status-mode)) | 1159 | (mpc-status-mode)) |
| 1160 | (mpc-proc-buffer (mpc-proc) 'status buf)) | 1160 | (mpc-proc-buffer (mpc-proc) 'status buf)) |
| 1161 | (if (null songs-win) (pop-to-buffer buf) | 1161 | (if (null songs-win) (pop-to-buffer buf) |
| 1162 | (let ((win (split-window songs-win 20 t))) | 1162 | (let ((_win (split-window songs-win 20 t))) |
| 1163 | (set-window-dedicated-p songs-win nil) | 1163 | (set-window-dedicated-p songs-win nil) |
| 1164 | (set-window-buffer songs-win buf) | 1164 | (set-window-buffer songs-win buf) |
| 1165 | (set-window-dedicated-p songs-win 'soft))))) | 1165 | (set-window-dedicated-p songs-win 'soft))))) |
| @@ -2385,15 +2385,13 @@ This is used so that they can be compared with `eq', which is needed for | |||
| 2385 | (mpc--faster-stop) | 2385 | (mpc--faster-stop) |
| 2386 | (mpc-status-refresh) (mpc-proc-sync) | 2386 | (mpc-status-refresh) (mpc-proc-sync) |
| 2387 | (let* (songid ;The ID of the currently ffwd/rewinding song. | 2387 | (let* (songid ;The ID of the currently ffwd/rewinding song. |
| 2388 | songnb ;The position of that song in the playlist. | ||
| 2389 | songduration ;The duration of that song. | 2388 | songduration ;The duration of that song. |
| 2390 | songtime ;The time of the song last time we ran. | 2389 | songtime ;The time of the song last time we ran. |
| 2391 | oldtime ;The timeoftheday last time we ran. | 2390 | oldtime ;The timeoftheday last time we ran. |
| 2392 | prevsongid) ;The song we're in the process leaving. | 2391 | prevsongid) ;The song we're in the process leaving. |
| 2393 | (let ((fun | 2392 | (let ((fun |
| 2394 | (lambda () | 2393 | (lambda () |
| 2395 | (let ((newsongid (cdr (assq 'songid mpc-status))) | 2394 | (let ((newsongid (cdr (assq 'songid mpc-status)))) |
| 2396 | (newsongnb (cdr (assq 'song mpc-status)))) | ||
| 2397 | 2395 | ||
| 2398 | (if (and (equal prevsongid newsongid) | 2396 | (if (and (equal prevsongid newsongid) |
| 2399 | (not (equal prevsongid songid))) | 2397 | (not (equal prevsongid songid))) |
| @@ -2444,8 +2442,7 @@ This is used so that they can be compared with `eq', which is needed for | |||
| 2444 | (mpc-proc-cmd | 2442 | (mpc-proc-cmd |
| 2445 | (list "seekid" songid songtime) | 2443 | (list "seekid" songid songtime) |
| 2446 | 'mpc-status-refresh) | 2444 | 'mpc-status-refresh) |
| 2447 | (mpc-proc-error (mpc-status-refresh))))))) | 2445 | (mpc-proc-error (mpc-status-refresh))))))))))) |
| 2448 | (setq songnb newsongnb))))) | ||
| 2449 | (setq mpc--faster-toggle-forward (> step 0)) | 2446 | (setq mpc--faster-toggle-forward (> step 0)) |
| 2450 | (funcall fun) ;Initialize values. | 2447 | (funcall fun) ;Initialize values. |
| 2451 | (setq mpc--faster-toggle-timer | 2448 | (setq mpc--faster-toggle-timer |
diff --git a/lisp/server.el b/lisp/server.el index 79204b3cb8e..019a16a43d7 100644 --- a/lisp/server.el +++ b/lisp/server.el | |||
| @@ -418,10 +418,11 @@ If CLIENT is non-nil, add a description of it to the logged message." | |||
| 418 | (server-delete-client proc 'noframe)))) ; Let delete-frame delete the frame later. | 418 | (server-delete-client proc 'noframe)))) ; Let delete-frame delete the frame later. |
| 419 | 419 | ||
| 420 | (defun server-handle-suspend-tty (terminal) | 420 | (defun server-handle-suspend-tty (terminal) |
| 421 | "Notify the emacsclient process to suspend itself when its tty device is suspended." | 421 | "Notify the client process that its tty device is suspended." |
| 422 | (dolist (proc (server-clients-with 'terminal terminal)) | 422 | (dolist (proc (server-clients-with 'terminal terminal)) |
| 423 | (server-log (format "server-handle-suspend-tty, terminal %s" terminal) proc) | 423 | (server-log (format "server-handle-suspend-tty, terminal %s" terminal) |
| 424 | (condition-case err | 424 | proc) |
| 425 | (condition-case nil | ||
| 425 | (server-send-string proc "-suspend \n") | 426 | (server-send-string proc "-suspend \n") |
| 426 | (file-error ;The pipe/socket was closed. | 427 | (file-error ;The pipe/socket was closed. |
| 427 | (ignore-errors (server-delete-client proc)))))) | 428 | (ignore-errors (server-delete-client proc)))))) |
| @@ -1207,7 +1208,10 @@ so don't mark these buffers specially, just visit them normally." | |||
| 1207 | (process-put proc 'buffers | 1208 | (process-put proc 'buffers |
| 1208 | (nconc (process-get proc 'buffers) client-record))) | 1209 | (nconc (process-get proc 'buffers) client-record))) |
| 1209 | client-record)) | 1210 | client-record)) |
| 1210 | 1211 | ||
| 1212 | (defvar server-kill-buffer-running nil | ||
| 1213 | "Non-nil while `server-kill-buffer' or `server-buffer-done' is running.") | ||
| 1214 | |||
| 1211 | (defun server-buffer-done (buffer &optional for-killing) | 1215 | (defun server-buffer-done (buffer &optional for-killing) |
| 1212 | "Mark BUFFER as \"done\" for its client(s). | 1216 | "Mark BUFFER as \"done\" for its client(s). |
| 1213 | This buries the buffer, then returns a list of the form (NEXT-BUFFER KILLED). | 1217 | This buries the buffer, then returns a list of the form (NEXT-BUFFER KILLED). |
| @@ -1329,9 +1333,6 @@ specifically for the clients and did not exist before their request for it." | |||
| 1329 | (setq live-client t)))) | 1333 | (setq live-client t)))) |
| 1330 | (yes-or-no-p "This Emacs session has clients; exit anyway? "))) | 1334 | (yes-or-no-p "This Emacs session has clients; exit anyway? "))) |
| 1331 | 1335 | ||
| 1332 | (defvar server-kill-buffer-running nil | ||
| 1333 | "Non-nil while `server-kill-buffer' or `server-buffer-done' is running.") | ||
| 1334 | |||
| 1335 | (defun server-kill-buffer () | 1336 | (defun server-kill-buffer () |
| 1336 | "Remove the current buffer from its clients' buffer list. | 1337 | "Remove the current buffer from its clients' buffer list. |
| 1337 | Designed to be added to `kill-buffer-hook'." | 1338 | Designed to be added to `kill-buffer-hook'." |