diff options
| author | Juanma Barranquero | 2013-08-10 17:17:29 +0200 |
|---|---|---|
| committer | Juanma Barranquero | 2013-08-10 17:17:29 +0200 |
| commit | 45fdb48240996f7ad9c8c03f438ecf7f5b925d8e (patch) | |
| tree | 63d1b157c6391428d8641dd4bf25cceab50e7e84 | |
| parent | c880af52a62dda0900b8737b9e592700466e45ec (diff) | |
| download | emacs-45fdb48240996f7ad9c8c03f438ecf7f5b925d8e.tar.gz emacs-45fdb48240996f7ad9c8c03f438ecf7f5b925d8e.zip | |
lisp/*.el: Remove lexical-binding warnings; additional small cleanups.
* calculator.el (calculator): Mark unused argument.
(calculator-paste, calculator-quit, calculator-integer-p):
Use ignore-errors.
(calculator-string-to-number, calculator-decimal, calculator-exp)
(calculator-op-or-exp): Use string-match-p.
* dired-aux.el (dired-compress): Use ignore-errors.
(dired-do-chxxx, dired-do-chmod, dired-trample-file-versions)
(dired-do-async-shell-command, dired-do-shell-command)
(dired-shell-stuff-it, dired-compress-file, dired-insert-subdir)
(dired-insert-subdir-validate): Use string-match-p.
(dired-map-dired-file-lines, dired-subdir-hidden-p): Use looking-at-p.
(dired-add-entry): Use string-match-p, looking-at-p.
(dired-insert-subdir-newpos): Remove unused local variable.
* dired.el (dired-buffer-more-recently-used-p): Declare.
(dired-insert-set-properties, dired-insert-old-subdirs):
Use ignore-errors.
* filenotify.el (file-notify-callback): Remove unused local variable.
* filesets.el (filesets-error): Mark unused argument.
(filesets-which-command-p, filesets-filter-dir-names)
(filesets-directory-files, filesets-get-external-viewer)
(filesets-ingroup-get-data): Use string-match-p.
* find-file.el (ff-other-file-name, ff-other-file-name)
(ff-find-the-other-file, ff-cc-hh-converter):
Remove unused local variables.
(ff-get-file-name): Use string-match-p.
(ff-all-dirs-under): Use ignore-errors.
* follow.el (follow-comint-scroll-to-bottom): Mark unused argument.
(follow-select-if-visible): Remove unused local variable.
* forms.el (read-file-filter): Move declaration.
(forms--make-format, forms--make-parser, forms-insert-record):
Quote function with #'.
(forms--update): Use string-match-p. Quote function with #'.
* help-mode.el (help-dir-local-var-def): Mark unused argument.
(help-make-xrefs): Use looking-at-p.
(help-xref-on-pp): Use looking-at-p, ignore-errors.
* ibuffer.el (ibuffer-ext-visible-p): Declare.
(ibuffer-confirm-operation-on): Use string-match-p.
* msb.el (msb-item-handler, msb-dired-item-handler):
Mark unused arguments.
* ses.el (ses-decode-cell-symbol)
(ses-kill-override): Remove unused local variable.
(ses-create-cell-variable, ses-relocate-formula): Use string-match-p.
(ses-load): Use ignore-errors, looking-at-p.
(ses-jump-safe): Use ignore-errors.
(ses-export-tsv, ses-export-tsf, ses-unsafe): Mark unused arguments.
* tabify.el (untabify, tabify): Mark unused arguments.
* thingatpt.el (thing-at-point--bounds-of-well-formed-url):
Mark unused argument.
(bounds-of-thing-at-point, thing-at-point-bounds-of-list-at-point)
(thing-at-point-newsgroup-p, form-at-point): Use ignore-errors.
| -rw-r--r-- | lisp/ChangeLog | 64 | ||||
| -rw-r--r-- | lisp/calculator.el | 36 | ||||
| -rw-r--r-- | lisp/dired-aux.el | 60 | ||||
| -rw-r--r-- | lisp/dired.el | 52 | ||||
| -rw-r--r-- | lisp/filenotify.el | 2 | ||||
| -rw-r--r-- | lisp/filesets.el | 24 | ||||
| -rw-r--r-- | lisp/find-file.el | 50 | ||||
| -rw-r--r-- | lisp/follow.el | 7 | ||||
| -rw-r--r-- | lisp/forms.el | 24 | ||||
| -rw-r--r-- | lisp/help-mode.el | 43 | ||||
| -rw-r--r-- | lisp/ibuffer.el | 4 | ||||
| -rw-r--r-- | lisp/msb.el | 4 | ||||
| -rw-r--r-- | lisp/ses.el | 32 | ||||
| -rw-r--r-- | lisp/tabify.el | 4 | ||||
| -rw-r--r-- | lisp/thingatpt.el | 130 |
15 files changed, 283 insertions, 253 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 15ff4e131a0..4c55452e5b4 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,5 +1,69 @@ | |||
| 1 | 2013-08-10 Juanma Barranquero <lekktu@gmail.com> | 1 | 2013-08-10 Juanma Barranquero <lekktu@gmail.com> |
| 2 | 2 | ||
| 3 | * calculator.el (calculator): Mark unused argument. | ||
| 4 | (calculator-paste, calculator-quit, calculator-integer-p): | ||
| 5 | Use ignore-errors. | ||
| 6 | (calculator-string-to-number, calculator-decimal, calculator-exp) | ||
| 7 | (calculator-op-or-exp): Use string-match-p. | ||
| 8 | |||
| 9 | * dired.el (dired-buffer-more-recently-used-p): Declare. | ||
| 10 | (dired-insert-set-properties, dired-insert-old-subdirs): | ||
| 11 | Use ignore-errors. | ||
| 12 | |||
| 13 | * dired-aux.el (dired-compress): Use ignore-errors. | ||
| 14 | (dired-do-chxxx, dired-do-chmod, dired-trample-file-versions) | ||
| 15 | (dired-do-async-shell-command, dired-do-shell-command) | ||
| 16 | (dired-shell-stuff-it, dired-compress-file, dired-insert-subdir) | ||
| 17 | (dired-insert-subdir-validate): Use string-match-p. | ||
| 18 | (dired-map-dired-file-lines, dired-subdir-hidden-p): Use looking-at-p. | ||
| 19 | (dired-add-entry): Use string-match-p, looking-at-p. | ||
| 20 | (dired-insert-subdir-newpos): Remove unused local variable. | ||
| 21 | |||
| 22 | * filenotify.el (file-notify-callback): Remove unused local variable. | ||
| 23 | |||
| 24 | * filesets.el (filesets-error): Mark unused argument. | ||
| 25 | (filesets-which-command-p, filesets-filter-dir-names) | ||
| 26 | (filesets-directory-files, filesets-get-external-viewer) | ||
| 27 | (filesets-ingroup-get-data): Use string-match-p. | ||
| 28 | |||
| 29 | * find-file.el (ff-other-file-name, ff-other-file-name) | ||
| 30 | (ff-find-the-other-file, ff-cc-hh-converter): | ||
| 31 | Remove unused local variables. | ||
| 32 | (ff-get-file-name): Use string-match-p. | ||
| 33 | (ff-all-dirs-under): Use ignore-errors. | ||
| 34 | |||
| 35 | * follow.el (follow-comint-scroll-to-bottom): Mark unused argument. | ||
| 36 | (follow-select-if-visible): Remove unused local variable. | ||
| 37 | |||
| 38 | * forms.el (read-file-filter): Move declaration. | ||
| 39 | (forms--make-format, forms--make-parser, forms-insert-record): | ||
| 40 | Quote function with #'. | ||
| 41 | (forms--update): Use string-match-p. Quote function with #'. | ||
| 42 | |||
| 43 | * help-mode.el (help-dir-local-var-def): Mark unused argument. | ||
| 44 | (help-make-xrefs): Use looking-at-p. | ||
| 45 | (help-xref-on-pp): Use looking-at-p, ignore-errors. | ||
| 46 | |||
| 47 | * ibuffer.el (ibuffer-ext-visible-p): Declare. | ||
| 48 | (ibuffer-confirm-operation-on): Use string-match-p. | ||
| 49 | |||
| 50 | * msb.el (msb-item-handler, msb-dired-item-handler): | ||
| 51 | Mark unused arguments. | ||
| 52 | |||
| 53 | * ses.el (ses-decode-cell-symbol) | ||
| 54 | (ses-kill-override): Remove unused local variable. | ||
| 55 | (ses-create-cell-variable, ses-relocate-formula): Use string-match-p. | ||
| 56 | (ses-load): Use ignore-errors, looking-at-p. | ||
| 57 | (ses-jump-safe): Use ignore-errors. | ||
| 58 | (ses-export-tsv, ses-export-tsf, ses-unsafe): Mark unused arguments. | ||
| 59 | |||
| 60 | * tabify.el (untabify, tabify): Mark unused arguments. | ||
| 61 | |||
| 62 | * thingatpt.el (thing-at-point--bounds-of-well-formed-url): | ||
| 63 | Mark unused argument. | ||
| 64 | (bounds-of-thing-at-point, thing-at-point-bounds-of-list-at-point) | ||
| 65 | (thing-at-point-newsgroup-p, form-at-point): Use ignore-errors. | ||
| 66 | |||
| 3 | * emacs-lisp/timer.el (timer--time): Define setter with | 67 | * emacs-lisp/timer.el (timer--time): Define setter with |
| 4 | gv-define-setter to avoid deprecation warning. | 68 | gv-define-setter to avoid deprecation warning. |
| 5 | 69 | ||
diff --git a/lisp/calculator.el b/lisp/calculator.el index 8b253b810f5..c9a73054712 100644 --- a/lisp/calculator.el +++ b/lisp/calculator.el | |||
| @@ -708,7 +708,7 @@ See the documentation for `calculator-mode' for more information." | |||
| 708 | ;; can't use 'noprompt, bug in electric.el | 708 | ;; can't use 'noprompt, bug in electric.el |
| 709 | (lambda () 'noprompt) | 709 | (lambda () 'noprompt) |
| 710 | nil | 710 | nil |
| 711 | (lambda (x y) (calculator-update-display)))) | 711 | (lambda (_x _y) (calculator-update-display)))) |
| 712 | (and calculator-buffer | 712 | (and calculator-buffer |
| 713 | (catch 'calculator-done (calculator-quit))) | 713 | (catch 'calculator-done (calculator-quit))) |
| 714 | (use-local-map old-l-map) | 714 | (use-local-map old-l-map) |
| @@ -905,9 +905,9 @@ The string is set not to exceed the screen width." | |||
| 905 | value) | 905 | value) |
| 906 | (car (read-from-string | 906 | (car (read-from-string |
| 907 | (cond ((equal "." str) "0.0") | 907 | (cond ((equal "." str) "0.0") |
| 908 | ((string-match "[eE][+-]?$" str) (concat str "0")) | 908 | ((string-match-p "[eE][+-]?$" str) (concat str "0")) |
| 909 | ((string-match "\\.[0-9]\\|[eE]" str) str) | 909 | ((string-match-p "\\.[0-9]\\|[eE]" str) str) |
| 910 | ((string-match "\\." str) | 910 | ((string-match-p "\\." str) |
| 911 | ;; do this because Emacs reads "23." as an integer | 911 | ;; do this because Emacs reads "23." as an integer |
| 912 | (concat str "0")) | 912 | (concat str "0")) |
| 913 | ((stringp str) (concat str ".0")) | 913 | ((stringp str) (concat str ".0")) |
| @@ -1366,7 +1366,7 @@ OP is the operator (if any) that caused this call." | |||
| 1366 | (or calculator-display-fragile | 1366 | (or calculator-display-fragile |
| 1367 | (not (numberp (car calculator-stack)))) | 1367 | (not (numberp (car calculator-stack)))) |
| 1368 | (not (and calculator-curnum | 1368 | (not (and calculator-curnum |
| 1369 | (string-match "[.eE]" calculator-curnum)))) | 1369 | (string-match-p "[.eE]" calculator-curnum)))) |
| 1370 | ;; enter the period on the same condition as a digit, only if no | 1370 | ;; enter the period on the same condition as a digit, only if no |
| 1371 | ;; period or exponent entered yet | 1371 | ;; period or exponent entered yet |
| 1372 | (progn | 1372 | (progn |
| @@ -1382,7 +1382,7 @@ OP is the operator (if any) that caused this call." | |||
| 1382 | (if (and (or calculator-display-fragile | 1382 | (if (and (or calculator-display-fragile |
| 1383 | (not (numberp (car calculator-stack)))) | 1383 | (not (numberp (car calculator-stack)))) |
| 1384 | (not (and calculator-curnum | 1384 | (not (and calculator-curnum |
| 1385 | (string-match "[eE]" calculator-curnum)))) | 1385 | (string-match-p "[eE]" calculator-curnum)))) |
| 1386 | ;; same condition as above, also no E so far | 1386 | ;; same condition as above, also no E so far |
| 1387 | (progn | 1387 | (progn |
| 1388 | (calculator-clear-fragile) | 1388 | (calculator-clear-fragile) |
| @@ -1452,7 +1452,7 @@ no need for negative numbers since these are handled by unary operators)." | |||
| 1452 | (interactive) | 1452 | (interactive) |
| 1453 | (if (and (not calculator-display-fragile) | 1453 | (if (and (not calculator-display-fragile) |
| 1454 | calculator-curnum | 1454 | calculator-curnum |
| 1455 | (string-match "[eE]$" calculator-curnum)) | 1455 | (string-match-p "[eE]$" calculator-curnum)) |
| 1456 | (calculator-digit) | 1456 | (calculator-digit) |
| 1457 | (calculator-op))) | 1457 | (calculator-op))) |
| 1458 | 1458 | ||
| @@ -1661,8 +1661,7 @@ Used by `calculator-paste' and `get-register'." | |||
| 1661 | (setq str (concat (or (match-string 1 str) "0") | 1661 | (setq str (concat (or (match-string 1 str) "0") |
| 1662 | (or (match-string 2 str) ".0") | 1662 | (or (match-string 2 str) ".0") |
| 1663 | (or (match-string 3 str) "")))) | 1663 | (or (match-string 3 str) "")))) |
| 1664 | (condition-case nil (calculator-string-to-number str) | 1664 | (ignore-errors (calculator-string-to-number str))))) |
| 1665 | (error nil))))) | ||
| 1666 | 1665 | ||
| 1667 | (defun calculator-get-register (reg) | 1666 | (defun calculator-get-register (reg) |
| 1668 | "Get a value from a register REG." | 1667 | "Get a value from a register REG." |
| @@ -1728,13 +1727,11 @@ Used by `calculator-paste' and `get-register'." | |||
| 1728 | (interactive) | 1727 | (interactive) |
| 1729 | (set-buffer calculator-buffer) | 1728 | (set-buffer calculator-buffer) |
| 1730 | (let ((inhibit-read-only t)) (erase-buffer)) | 1729 | (let ((inhibit-read-only t)) (erase-buffer)) |
| 1731 | (if (not calculator-electric-mode) | 1730 | (unless calculator-electric-mode |
| 1732 | (progn | 1731 | (ignore-errors |
| 1733 | (condition-case nil | 1732 | (while (get-buffer-window calculator-buffer) |
| 1734 | (while (get-buffer-window calculator-buffer) | 1733 | (delete-window (get-buffer-window calculator-buffer)))) |
| 1735 | (delete-window (get-buffer-window calculator-buffer))) | 1734 | (kill-buffer calculator-buffer)) |
| 1736 | (error nil)) | ||
| 1737 | (kill-buffer calculator-buffer))) | ||
| 1738 | (setq calculator-buffer nil) | 1735 | (setq calculator-buffer nil) |
| 1739 | (message "Calculator done.") | 1736 | (message "Calculator done.") |
| 1740 | (if calculator-electric-mode (throw 'calculator-done nil))) | 1737 | (if calculator-electric-mode (throw 'calculator-done nil))) |
| @@ -1768,14 +1765,11 @@ To use this, apply a binary operator (evaluate it), then call this." | |||
| 1768 | 1765 | ||
| 1769 | (defun calculator-integer-p (x) | 1766 | (defun calculator-integer-p (x) |
| 1770 | "Non-nil if X is equal to an integer." | 1767 | "Non-nil if X is equal to an integer." |
| 1771 | (condition-case nil | 1768 | (ignore-errors (= x (ftruncate x)))) |
| 1772 | (= x (ftruncate x)) | ||
| 1773 | (error nil))) | ||
| 1774 | 1769 | ||
| 1775 | (defun calculator-expt (x y) | 1770 | (defun calculator-expt (x y) |
| 1776 | "Compute X^Y, dealing with errors appropriately." | 1771 | "Compute X^Y, dealing with errors appropriately." |
| 1777 | (condition-case | 1772 | (condition-case nil |
| 1778 | nil | ||
| 1779 | (expt x y) | 1773 | (expt x y) |
| 1780 | (domain-error 0.0e+NaN) | 1774 | (domain-error 0.0e+NaN) |
| 1781 | (range-error | 1775 | (range-error |
diff --git a/lisp/dired-aux.el b/lisp/dired-aux.el index c12ac068689..31d0495175a 100644 --- a/lisp/dired-aux.el +++ b/lisp/dired-aux.el | |||
| @@ -286,7 +286,7 @@ List has a form of (file-name full-file-name (attribute-list))." | |||
| 286 | (if (eq op-symbol 'touch) | 286 | (if (eq op-symbol 'touch) |
| 287 | (list "-t" new-attribute) | 287 | (list "-t" new-attribute) |
| 288 | (list new-attribute))) | 288 | (list new-attribute))) |
| 289 | (if (string-match "gnu" system-configuration) | 289 | (if (string-match-p "gnu" system-configuration) |
| 290 | '("--") nil)) | 290 | '("--") nil)) |
| 291 | files)) | 291 | files)) |
| 292 | (dired-do-redisplay arg);; moves point if ARG is an integer | 292 | (dired-do-redisplay arg);; moves point if ARG is an integer |
| @@ -327,7 +327,7 @@ into the minibuffer." | |||
| 327 | ;; We used to treat empty input as DEFAULT, but that is not | 327 | ;; We used to treat empty input as DEFAULT, but that is not |
| 328 | ;; such a good idea (Bug#9361). | 328 | ;; such a good idea (Bug#9361). |
| 329 | (error "No file mode specified")) | 329 | (error "No file mode specified")) |
| 330 | ((string-match "^[0-7]+" modes) | 330 | ((string-match-p "^[0-7]+" modes) |
| 331 | (setq num-modes (string-to-number modes 8)))) | 331 | (setq num-modes (string-to-number modes 8)))) |
| 332 | 332 | ||
| 333 | (dolist (file files) | 333 | (dolist (file files) |
| @@ -500,7 +500,7 @@ with a prefix argument." | |||
| 500 | (goto-char (point-min)) | 500 | (goto-char (point-min)) |
| 501 | (while (not (eobp)) | 501 | (while (not (eobp)) |
| 502 | (save-excursion | 502 | (save-excursion |
| 503 | (and (not (looking-at dired-re-dir)) | 503 | (and (not (looking-at-p dired-re-dir)) |
| 504 | (not (eolp)) | 504 | (not (eolp)) |
| 505 | (setq file (dired-get-filename nil t)) ; nil on non-file | 505 | (setq file (dired-get-filename nil t)) ; nil on non-file |
| 506 | (progn (end-of-line) | 506 | (progn (end-of-line) |
| @@ -530,7 +530,7 @@ with a prefix argument." | |||
| 530 | dired-file-version-alist))))))) | 530 | dired-file-version-alist))))))) |
| 531 | 531 | ||
| 532 | (defun dired-trample-file-versions (fn) | 532 | (defun dired-trample-file-versions (fn) |
| 533 | (let* ((start-vn (string-match "\\.~[0-9]+~$" fn)) | 533 | (let* ((start-vn (string-match-p "\\.~[0-9]+~$" fn)) |
| 534 | base-version-list) | 534 | base-version-list) |
| 535 | (and start-vn | 535 | (and start-vn |
| 536 | (setq base-version-list ; there was a base version to which | 536 | (setq base-version-list ; there was a base version to which |
| @@ -602,7 +602,7 @@ The output appears in the buffer `*Async Shell Command*'." | |||
| 602 | (dired-read-shell-command "& on %s: " current-prefix-arg files) | 602 | (dired-read-shell-command "& on %s: " current-prefix-arg files) |
| 603 | current-prefix-arg | 603 | current-prefix-arg |
| 604 | files))) | 604 | files))) |
| 605 | (unless (string-match "&[ \t]*\\'" command) | 605 | (unless (string-match-p "&[ \t]*\\'" command) |
| 606 | (setq command (concat command " &"))) | 606 | (setq command (concat command " &"))) |
| 607 | (dired-do-shell-command command arg file-list)) | 607 | (dired-do-shell-command command arg file-list)) |
| 608 | 608 | ||
| @@ -663,10 +663,10 @@ can be produced by `dired-get-marked-files', for example." | |||
| 663 | (dired-read-shell-command "! on %s: " current-prefix-arg files) | 663 | (dired-read-shell-command "! on %s: " current-prefix-arg files) |
| 664 | current-prefix-arg | 664 | current-prefix-arg |
| 665 | files))) | 665 | files))) |
| 666 | (let* ((on-each (not (string-match dired-star-subst-regexp command))) | 666 | (let* ((on-each (not (string-match-p dired-star-subst-regexp command))) |
| 667 | (no-subst (not (string-match dired-quark-subst-regexp command))) | 667 | (no-subst (not (string-match-p dired-quark-subst-regexp command))) |
| 668 | (star (string-match "\\*" command)) | 668 | (star (string-match-p "\\*" command)) |
| 669 | (qmark (string-match "\\?" command))) | 669 | (qmark (string-match-p "\\?" command))) |
| 670 | ;; Get confirmation for wildcards that may have been meant | 670 | ;; Get confirmation for wildcards that may have been meant |
| 671 | ;; to control substitution of a file name or the file name list. | 671 | ;; to control substitution of a file name or the file name list. |
| 672 | (if (cond ((not (or on-each no-subst)) | 672 | (if (cond ((not (or on-each no-subst)) |
| @@ -713,8 +713,8 @@ can be produced by `dired-get-marked-files', for example." | |||
| 713 | (substring command 0 (match-beginning 0)) | 713 | (substring command 0 (match-beginning 0)) |
| 714 | command)) | 714 | command)) |
| 715 | (stuff-it | 715 | (stuff-it |
| 716 | (if (or (string-match dired-star-subst-regexp command) | 716 | (if (or (string-match-p dired-star-subst-regexp command) |
| 717 | (string-match dired-quark-subst-regexp command)) | 717 | (string-match-p dired-quark-subst-regexp command)) |
| 718 | (lambda (x) | 718 | (lambda (x) |
| 719 | (let ((retval command)) | 719 | (let ((retval command)) |
| 720 | (while (string-match | 720 | (while (string-match |
| @@ -840,9 +840,7 @@ command with a prefix argument (the value does not matter)." | |||
| 840 | (if new-file | 840 | (if new-file |
| 841 | (let ((start (point))) | 841 | (let ((start (point))) |
| 842 | ;; Remove any preexisting entry for the name NEW-FILE. | 842 | ;; Remove any preexisting entry for the name NEW-FILE. |
| 843 | (condition-case nil | 843 | (ignore-errors (dired-remove-entry new-file)) |
| 844 | (dired-remove-entry new-file) | ||
| 845 | (error nil)) | ||
| 846 | (goto-char start) | 844 | (goto-char start) |
| 847 | ;; Now replace the current line with an entry for NEW-FILE. | 845 | ;; Now replace the current line with an entry for NEW-FILE. |
| 848 | (dired-update-file-line new-file) nil) | 846 | (dired-update-file-line new-file) nil) |
| @@ -883,7 +881,7 @@ Otherwise, the rule is a compression rule, and compression is done with gzip.") | |||
| 883 | ;; See if any suffix rule matches this file name. | 881 | ;; See if any suffix rule matches this file name. |
| 884 | (while suffixes | 882 | (while suffixes |
| 885 | (let (case-fold-search) | 883 | (let (case-fold-search) |
| 886 | (if (string-match (car (car suffixes)) file) | 884 | (if (string-match-p (car (car suffixes)) file) |
| 887 | (setq suffix (car suffixes) suffixes nil)) | 885 | (setq suffix (car suffixes) suffixes nil)) |
| 888 | (setq suffixes (cdr suffixes)))) | 886 | (setq suffixes (cdr suffixes)))) |
| 889 | ;; If so, compute desired new name. | 887 | ;; If so, compute desired new name. |
| @@ -1143,16 +1141,16 @@ files matching `dired-omit-regexp'." | |||
| 1143 | ;; Avoid calling ls for files that are going to be omitted anyway. | 1141 | ;; Avoid calling ls for files that are going to be omitted anyway. |
| 1144 | (let ((omit-re (dired-omit-regexp))) | 1142 | (let ((omit-re (dired-omit-regexp))) |
| 1145 | (or (string= omit-re "") | 1143 | (or (string= omit-re "") |
| 1146 | (not (string-match omit-re | 1144 | (not (string-match-p omit-re |
| 1147 | (cond | 1145 | (cond |
| 1148 | ((eq 'no-dir dired-omit-localp) | 1146 | ((eq 'no-dir dired-omit-localp) |
| 1149 | filename) | 1147 | filename) |
| 1150 | ((eq t dired-omit-localp) | 1148 | ((eq t dired-omit-localp) |
| 1151 | (dired-make-relative filename)) | 1149 | (dired-make-relative filename)) |
| 1152 | (t | 1150 | (t |
| 1153 | (dired-make-absolute | 1151 | (dired-make-absolute |
| 1154 | filename | 1152 | filename |
| 1155 | (file-name-directory filename))))))))) | 1153 | (file-name-directory filename))))))))) |
| 1156 | ;; Do it! | 1154 | ;; Do it! |
| 1157 | (progn | 1155 | (progn |
| 1158 | (setq filename (directory-file-name filename)) | 1156 | (setq filename (directory-file-name filename)) |
| @@ -1180,7 +1178,7 @@ files matching `dired-omit-regexp'." | |||
| 1180 | ;; else try to find correct place to insert | 1178 | ;; else try to find correct place to insert |
| 1181 | (if (dired-goto-subdir directory) | 1179 | (if (dired-goto-subdir directory) |
| 1182 | (progn ;; unhide if necessary | 1180 | (progn ;; unhide if necessary |
| 1183 | (if (looking-at "\r") | 1181 | (if (looking-at-p "\r") |
| 1184 | ;; Point is at end of subdir line. | 1182 | ;; Point is at end of subdir line. |
| 1185 | (dired-unhide-subdir)) | 1183 | (dired-unhide-subdir)) |
| 1186 | ;; found - skip subdir and `total' line | 1184 | ;; found - skip subdir and `total' line |
| @@ -2090,7 +2088,7 @@ This function takes some pains to conform to `ls -lR' output." | |||
| 2090 | (and (not switches) cons (setq switches (cdr cons))) | 2088 | (and (not switches) cons (setq switches (cdr cons))) |
| 2091 | (dired-insert-subdir-validate dirname switches) | 2089 | (dired-insert-subdir-validate dirname switches) |
| 2092 | ;; case-fold-search is nil now, so we can test for capital `R': | 2090 | ;; case-fold-search is nil now, so we can test for capital `R': |
| 2093 | (if (setq switches-have-R (and switches (string-match "R" switches))) | 2091 | (if (setq switches-have-R (and switches (string-match-p "R" switches))) |
| 2094 | ;; avoid duplicated subdirs | 2092 | ;; avoid duplicated subdirs |
| 2095 | (setq mark-alist (dired-kill-tree dirname t))) | 2093 | (setq mark-alist (dired-kill-tree dirname t))) |
| 2096 | (if elt | 2094 | (if elt |
| @@ -2128,8 +2126,8 @@ This function takes some pains to conform to `ls -lR' output." | |||
| 2128 | (mapcar | 2126 | (mapcar |
| 2129 | (function | 2127 | (function |
| 2130 | (lambda (x) | 2128 | (lambda (x) |
| 2131 | (or (eq (null (string-match x real-switches)) | 2129 | (or (eq (null (string-match-p x real-switches)) |
| 2132 | (null (string-match x dired-actual-switches))) | 2130 | (null (string-match-p x dired-actual-switches))) |
| 2133 | (error | 2131 | (error |
| 2134 | "Can't have dirs with and without -%s switches together" x)))) | 2132 | "Can't have dirs with and without -%s switches together" x)))) |
| 2135 | ;; all switches that make a difference to dired-get-filename: | 2133 | ;; all switches that make a difference to dired-get-filename: |
| @@ -2170,7 +2168,7 @@ of marked files. If KILL-ROOT is non-nil, kill DIRNAME as well." | |||
| 2170 | (defun dired-insert-subdir-newpos (new-dir) | 2168 | (defun dired-insert-subdir-newpos (new-dir) |
| 2171 | ;; Find pos for new subdir, according to tree order. | 2169 | ;; Find pos for new subdir, according to tree order. |
| 2172 | ;;(goto-char (point-max)) | 2170 | ;;(goto-char (point-max)) |
| 2173 | (let ((alist dired-subdir-alist) elt dir pos new-pos) | 2171 | (let ((alist dired-subdir-alist) elt dir new-pos) |
| 2174 | (while alist | 2172 | (while alist |
| 2175 | (setq elt (car alist) | 2173 | (setq elt (car alist) |
| 2176 | alist (cdr alist) | 2174 | alist (cdr alist) |
| @@ -2421,7 +2419,7 @@ Lower levels are unaffected." | |||
| 2421 | (and selective-display | 2419 | (and selective-display |
| 2422 | (save-excursion | 2420 | (save-excursion |
| 2423 | (dired-goto-subdir dir) | 2421 | (dired-goto-subdir dir) |
| 2424 | (looking-at "\r")))) | 2422 | (looking-at-p "\r")))) |
| 2425 | 2423 | ||
| 2426 | ;;;###autoload | 2424 | ;;;###autoload |
| 2427 | (defun dired-hide-subdir (arg) | 2425 | (defun dired-hide-subdir (arg) |
diff --git a/lisp/dired.el b/lisp/dired.el index 48f1b463f4a..f830623a255 100644 --- a/lisp/dired.el +++ b/lisp/dired.el | |||
| @@ -34,6 +34,9 @@ | |||
| 34 | 34 | ||
| 35 | ;;; Code: | 35 | ;;; Code: |
| 36 | 36 | ||
| 37 | (declare-function dired-buffer-more-recently-used-p | ||
| 38 | "dired-x" (buffer1 buffer2)) | ||
| 39 | |||
| 37 | ;;; Customizable variables | 40 | ;;; Customizable variables |
| 38 | 41 | ||
| 39 | (defgroup dired nil | 42 | (defgroup dired nil |
| @@ -1242,26 +1245,25 @@ see `dired-use-ls-dired' for more details.") | |||
| 1242 | (save-excursion | 1245 | (save-excursion |
| 1243 | (goto-char beg) | 1246 | (goto-char beg) |
| 1244 | (while (< (point) end) | 1247 | (while (< (point) end) |
| 1245 | (condition-case nil | 1248 | (ignore-errors |
| 1246 | (if (not (dired-move-to-filename)) | 1249 | (if (not (dired-move-to-filename)) |
| 1247 | (put-text-property (line-beginning-position) | 1250 | (put-text-property (line-beginning-position) |
| 1248 | (1+ (line-end-position)) | 1251 | (1+ (line-end-position)) |
| 1249 | 'invisible 'dired-hide-details-information) | 1252 | 'invisible 'dired-hide-details-information) |
| 1250 | (put-text-property (+ (line-beginning-position) 1) (1- (point)) | 1253 | (put-text-property (+ (line-beginning-position) 1) (1- (point)) |
| 1251 | 'invisible 'dired-hide-details-detail) | 1254 | 'invisible 'dired-hide-details-detail) |
| 1252 | (add-text-properties | 1255 | (add-text-properties |
| 1253 | (point) | 1256 | (point) |
| 1254 | (progn | 1257 | (progn |
| 1255 | (dired-move-to-end-of-filename) | 1258 | (dired-move-to-end-of-filename) |
| 1256 | (point)) | 1259 | (point)) |
| 1257 | '(mouse-face | 1260 | '(mouse-face |
| 1258 | highlight | 1261 | highlight |
| 1259 | dired-filename t | 1262 | dired-filename t |
| 1260 | help-echo "mouse-2: visit this file in other window")) | 1263 | help-echo "mouse-2: visit this file in other window")) |
| 1261 | (when (< (+ (point) 4) (line-end-position)) | 1264 | (when (< (+ (point) 4) (line-end-position)) |
| 1262 | (put-text-property (+ (point) 4) (line-end-position) | 1265 | (put-text-property (+ (point) 4) (line-end-position) |
| 1263 | 'invisible 'dired-hide-details-link))) | 1266 | 'invisible 'dired-hide-details-link)))) |
| 1264 | (error nil)) | ||
| 1265 | (forward-line 1)))) | 1267 | (forward-line 1)))) |
| 1266 | 1268 | ||
| 1267 | ;; Reverting a dired buffer | 1269 | ;; Reverting a dired buffer |
| @@ -1401,11 +1403,9 @@ Do so according to the former subdir alist OLD-SUBDIR-ALIST." | |||
| 1401 | (setq elt (car old-subdir-alist) | 1403 | (setq elt (car old-subdir-alist) |
| 1402 | old-subdir-alist (cdr old-subdir-alist) | 1404 | old-subdir-alist (cdr old-subdir-alist) |
| 1403 | dir (car elt)) | 1405 | dir (car elt)) |
| 1404 | (condition-case () | 1406 | (ignore-errors |
| 1405 | (progn | 1407 | (dired-uncache dir) |
| 1406 | (dired-uncache dir) | 1408 | (dired-insert-subdir dir)))))) |
| 1407 | (dired-insert-subdir dir)) | ||
| 1408 | (error nil)))))) | ||
| 1409 | 1409 | ||
| 1410 | (defun dired-uncache (dir) | 1410 | (defun dired-uncache (dir) |
| 1411 | "Remove directory DIR from any directory cache." | 1411 | "Remove directory DIR from any directory cache." |
| @@ -3849,7 +3849,7 @@ Ask means pop up a menu for the user to select one of copy, move or link." | |||
| 3849 | 3849 | ||
| 3850 | ;;; Start of automatically extracted autoloads. | 3850 | ;;; Start of automatically extracted autoloads. |
| 3851 | 3851 | ||
| 3852 | ;;;### (autoloads nil "dired-aux" "dired-aux.el" "555c067fcab27f5a377536db407803ab") | 3852 | ;;;### (autoloads nil "dired-aux" "dired-aux.el" "04b4cb6bde3220f55574eb1d99ac0d29") |
| 3853 | ;;; Generated autoloads from dired-aux.el | 3853 | ;;; Generated autoloads from dired-aux.el |
| 3854 | 3854 | ||
| 3855 | (autoload 'dired-diff "dired-aux" "\ | 3855 | (autoload 'dired-diff "dired-aux" "\ |
diff --git a/lisp/filenotify.el b/lisp/filenotify.el index d2f37b99107..5a5435bb4cb 100644 --- a/lisp/filenotify.el +++ b/lisp/filenotify.el | |||
| @@ -92,7 +92,7 @@ car of that event, which is the symbol `file-notify'." | |||
| 92 | (pending-event (assoc desc file-notify--pending-events)) | 92 | (pending-event (assoc desc file-notify--pending-events)) |
| 93 | (actions (nth 1 event)) | 93 | (actions (nth 1 event)) |
| 94 | (file (file-notify--event-file-name event)) | 94 | (file (file-notify--event-file-name event)) |
| 95 | file1 cookie callback) | 95 | file1 callback) |
| 96 | 96 | ||
| 97 | ;; Make actions a list. | 97 | ;; Make actions a list. |
| 98 | (unless (consp actions) (setq actions (cons actions nil))) | 98 | (unless (consp actions) (setq actions (cons actions nil))) |
diff --git a/lisp/filesets.el b/lisp/filesets.el index fbf28dbecbc..82891770f12 100644 --- a/lisp/filesets.el +++ b/lisp/filesets.el | |||
| @@ -214,8 +214,8 @@ key is supported." | |||
| 214 | 214 | ||
| 215 | (defun filesets-which-command-p (cmd) | 215 | (defun filesets-which-command-p (cmd) |
| 216 | "Call \"which CMD\" and return non-nil if the command was found." | 216 | "Call \"which CMD\" and return non-nil if the command was found." |
| 217 | (when (string-match (format "\\(/[^/]+\\)?/%s" cmd) | 217 | (when (string-match-p (format "\\(/[^/]+\\)?/%s" cmd) |
| 218 | (filesets-which-command cmd)) | 218 | (filesets-which-command cmd)) |
| 219 | cmd)) | 219 | cmd)) |
| 220 | 220 | ||
| 221 | (defun filesets-message (level &rest args) | 221 | (defun filesets-message (level &rest args) |
| @@ -1082,7 +1082,7 @@ defined in `filesets-ingroup-patterns'." | |||
| 1082 | 1082 | ||
| 1083 | (require 'easymenu) | 1083 | (require 'easymenu) |
| 1084 | 1084 | ||
| 1085 | (defun filesets-error (class &rest args) | 1085 | (defun filesets-error (_class &rest args) |
| 1086 | "`error' wrapper." | 1086 | "`error' wrapper." |
| 1087 | (error "%s" (mapconcat 'identity args " "))) | 1087 | (error "%s" (mapconcat 'identity args " "))) |
| 1088 | 1088 | ||
| @@ -1093,10 +1093,10 @@ defined in `filesets-ingroup-patterns'." | |||
| 1093 | If NEGATIVE is non-nil, remove all directory names." | 1093 | If NEGATIVE is non-nil, remove all directory names." |
| 1094 | (filesets-filter-list lst | 1094 | (filesets-filter-list lst |
| 1095 | (lambda (x) | 1095 | (lambda (x) |
| 1096 | (and (not (string-match "^\\.+/$" x)) | 1096 | (and (not (string-match-p "^\\.+/$" x)) |
| 1097 | (if negative | 1097 | (if negative |
| 1098 | (not (string-match "[:/\\]$" x)) | 1098 | (not (string-match-p "[:/\\]$" x)) |
| 1099 | (string-match "[:/\\]$" x)))))) | 1099 | (string-match-p "[:/\\]$" x)))))) |
| 1100 | 1100 | ||
| 1101 | (defun filesets-conditional-sort (lst &optional access-fn) | 1101 | (defun filesets-conditional-sort (lst &optional access-fn) |
| 1102 | "Return a sorted copy of LST, LST being a list of strings. | 1102 | "Return a sorted copy of LST, LST being a list of strings. |
| @@ -1130,18 +1130,18 @@ Return full path if FULL-FLAG is non-nil." | |||
| 1130 | (dirs nil)) | 1130 | (dirs nil)) |
| 1131 | (dolist (this (file-name-all-completions "" dir)) | 1131 | (dolist (this (file-name-all-completions "" dir)) |
| 1132 | (cond | 1132 | (cond |
| 1133 | ((string-match "^\\.+/$" this) | 1133 | ((string-match-p "^\\.+/$" this) |
| 1134 | nil) | 1134 | nil) |
| 1135 | ((string-match "[:/\\]$" this) | 1135 | ((string-match-p "[:/\\]$" this) |
| 1136 | (when (or (not match-dirs-flag) | 1136 | (when (or (not match-dirs-flag) |
| 1137 | (not pattern) | 1137 | (not pattern) |
| 1138 | (string-match pattern this)) | 1138 | (string-match-p pattern this)) |
| 1139 | (filesets-message 5 "Filesets: matched dir %S with pattern %S" | 1139 | (filesets-message 5 "Filesets: matched dir %S with pattern %S" |
| 1140 | this pattern) | 1140 | this pattern) |
| 1141 | (setq dirs (cons this dirs)))) | 1141 | (setq dirs (cons this dirs)))) |
| 1142 | (t | 1142 | (t |
| 1143 | (when (or (not pattern) | 1143 | (when (or (not pattern) |
| 1144 | (string-match pattern this)) | 1144 | (string-match-p pattern this)) |
| 1145 | (filesets-message 5 "Filesets: matched file %S with pattern %S" | 1145 | (filesets-message 5 "Filesets: matched file %S with pattern %S" |
| 1146 | this pattern) | 1146 | this pattern) |
| 1147 | (setq files (cons (if full-flag | 1147 | (setq files (cons (if full-flag |
| @@ -1249,7 +1249,7 @@ Return full path if FULL-FLAG is non-nil." | |||
| 1249 | (let ((filename (file-name-nondirectory file))) | 1249 | (let ((filename (file-name-nondirectory file))) |
| 1250 | (filesets-some | 1250 | (filesets-some |
| 1251 | (lambda (entry) | 1251 | (lambda (entry) |
| 1252 | (when (and (string-match (nth 0 entry) filename) | 1252 | (when (and (string-match-p (nth 0 entry) filename) |
| 1253 | (filesets-eviewer-constraint-p entry)) | 1253 | (filesets-eviewer-constraint-p entry)) |
| 1254 | entry)) | 1254 | entry)) |
| 1255 | filesets-external-viewers))) | 1255 | filesets-external-viewers))) |
| @@ -2004,7 +2004,7 @@ LOOKUP-NAME is used as lookup name for retrieving fileset specific settings." | |||
| 2004 | (fn (or fun (lambda (a b) | 2004 | (fn (or fun (lambda (a b) |
| 2005 | (and (stringp a) | 2005 | (and (stringp a) |
| 2006 | (stringp b) | 2006 | (stringp b) |
| 2007 | (string-match a b)))))) | 2007 | (string-match-p a b)))))) |
| 2008 | (filesets-some (lambda (x) | 2008 | (filesets-some (lambda (x) |
| 2009 | (if (funcall fn (car x) masterfile) | 2009 | (if (funcall fn (car x) masterfile) |
| 2010 | (nth pos x) | 2010 | (nth pos x) |
diff --git a/lisp/find-file.el b/lisp/find-file.el index 9f7d877ec3b..d9a9f08f19b 100644 --- a/lisp/find-file.el +++ b/lisp/find-file.el | |||
| @@ -528,11 +528,9 @@ the `ff-ignore-include' variable." | |||
| 528 | stub ;; name of the file without extension | 528 | stub ;; name of the file without extension |
| 529 | alist ;; working copy of the list of file extensions | 529 | alist ;; working copy of the list of file extensions |
| 530 | pathname ;; the pathname of the file or the #include line | 530 | pathname ;; the pathname of the file or the #include line |
| 531 | default-name ;; file we should create if none found | ||
| 532 | format ;; what we have to match | 531 | format ;; what we have to match |
| 533 | found ;; name of the file or buffer found - nil if none | 532 | found ;; name of the file or buffer found - nil if none |
| 534 | dirs ;; local value of ff-search-directories | 533 | dirs) ;; local value of ff-search-directories |
| 535 | no-match) ;; whether we know about this kind of file | ||
| 536 | 534 | ||
| 537 | (message "Working...") | 535 | (message "Working...") |
| 538 | 536 | ||
| @@ -545,7 +543,6 @@ the `ff-ignore-include' variable." | |||
| 545 | 543 | ||
| 546 | (cond | 544 | (cond |
| 547 | ((and (not ff-ignore-include) fname) | 545 | ((and (not ff-ignore-include) fname) |
| 548 | (setq default-name fname) | ||
| 549 | (setq found (ff-get-file-name dirs fname nil))) | 546 | (setq found (ff-get-file-name dirs fname nil))) |
| 550 | 547 | ||
| 551 | ;; let's just get the corresponding file | 548 | ;; let's just get the corresponding file |
| @@ -558,7 +555,6 @@ the `ff-ignore-include' variable." | |||
| 558 | "/none.none")) | 555 | "/none.none")) |
| 559 | 556 | ||
| 560 | (setq fname (file-name-nondirectory pathname) | 557 | (setq fname (file-name-nondirectory pathname) |
| 561 | no-match nil | ||
| 562 | match (car alist)) | 558 | match (car alist)) |
| 563 | 559 | ||
| 564 | ;; find the table entry corresponding to this file | 560 | ;; find the table entry corresponding to this file |
| @@ -569,8 +565,7 @@ the `ff-ignore-include' variable." | |||
| 569 | (setq pos (ff-string-match (car match) fname))) | 565 | (setq pos (ff-string-match (car match) fname))) |
| 570 | 566 | ||
| 571 | ;; no point going on if we haven't found anything | 567 | ;; no point going on if we haven't found anything |
| 572 | (if (not match) | 568 | (when match |
| 573 | (setq no-match t) | ||
| 574 | 569 | ||
| 575 | ;; otherwise, suffixes contains what we need | 570 | ;; otherwise, suffixes contains what we need |
| 576 | (setq suffixes (car (cdr match)) | 571 | (setq suffixes (car (cdr match)) |
| @@ -583,8 +578,7 @@ the `ff-ignore-include' variable." | |||
| 583 | (progn | 578 | (progn |
| 584 | (setq suffixes (funcall action (buffer-file-name)) | 579 | (setq suffixes (funcall action (buffer-file-name)) |
| 585 | match (cons (car match) (list suffixes)) | 580 | match (cons (car match) (list suffixes)) |
| 586 | stub nil | 581 | stub nil)) |
| 587 | default-name (car suffixes))) | ||
| 588 | 582 | ||
| 589 | ;; otherwise build our filename stub | 583 | ;; otherwise build our filename stub |
| 590 | (cond | 584 | (cond |
| @@ -599,11 +593,7 @@ the `ff-ignore-include' variable." | |||
| 599 | (setq format (concat "\\(.+\\)" (car match))) | 593 | (setq format (concat "\\(.+\\)" (car match))) |
| 600 | (string-match format fname) | 594 | (string-match format fname) |
| 601 | (setq stub (substring fname (match-beginning 1) (match-end 1))) | 595 | (setq stub (substring fname (match-beginning 1) (match-end 1))) |
| 602 | )) | 596 | ))) |
| 603 | |||
| 604 | ;; if we find nothing, we should try to get a file like this one | ||
| 605 | (setq default-name | ||
| 606 | (concat stub (car (car (cdr match)))))) | ||
| 607 | 597 | ||
| 608 | ;; do the real work - find the file | 598 | ;; do the real work - find the file |
| 609 | (setq found | 599 | (setq found |
| @@ -671,7 +661,7 @@ name of the first file found." | |||
| 671 | (setq buf (buffer-name (car blist))) | 661 | (setq buf (buffer-name (car blist))) |
| 672 | (while (and blist (not found)) | 662 | (while (and blist (not found)) |
| 673 | 663 | ||
| 674 | (if (string-match (concat filename "<[0-9]+>") buf) | 664 | (if (string-match-p (concat filename "<[0-9]+>") buf) |
| 675 | (setq found (buffer-file-name (car blist)))) | 665 | (setq found (buffer-file-name (car blist)))) |
| 676 | 666 | ||
| 677 | (setq blist (cdr blist)) | 667 | (setq blist (cdr blist)) |
| @@ -797,20 +787,18 @@ See variable `ff-special-constructs'." | |||
| 797 | "Get all the directory files under directory HERE. | 787 | "Get all the directory files under directory HERE. |
| 798 | Exclude all files in the optional EXCLUDE list." | 788 | Exclude all files in the optional EXCLUDE list." |
| 799 | (if (file-directory-p here) | 789 | (if (file-directory-p here) |
| 800 | (condition-case nil | 790 | (ignore-errors |
| 801 | (progn | 791 | (let ((files (directory-files here t)) |
| 802 | (let ((files (directory-files here t)) | 792 | (dirlist (list)) |
| 803 | (dirlist (list)) | 793 | file) |
| 804 | file) | 794 | (while files |
| 805 | (while files | 795 | (setq file (car files)) |
| 806 | (setq file (car files)) | 796 | (if (and |
| 807 | (if (and | 797 | (file-directory-p file) |
| 808 | (file-directory-p file) | 798 | (not (member (ff-basename file) exclude))) |
| 809 | (not (member (ff-basename file) exclude))) | 799 | (setq dirlist (cons file dirlist))) |
| 810 | (setq dirlist (cons file dirlist))) | 800 | (setq files (cdr files))) |
| 811 | (setq files (cdr files))) | 801 | (setq dirlist (reverse dirlist)))) |
| 812 | (setq dirlist (reverse dirlist)))) | ||
| 813 | (error nil)) | ||
| 814 | nil)) | 802 | nil)) |
| 815 | 803 | ||
| 816 | (defun ff-switch-file (f1 f2 file &optional in-other-window new-file) | 804 | (defun ff-switch-file (f1 f2 file &optional in-other-window new-file) |
| @@ -892,9 +880,7 @@ Given START and/or END, checks between these characters." | |||
| 892 | Build up a new file list based possibly on part of the directory name | 880 | Build up a new file list based possibly on part of the directory name |
| 893 | and the name of the file passed in." | 881 | and the name of the file passed in." |
| 894 | (ff-string-match "\\(.*\\)/\\([^/]+\\)/\\([^.]+\\).\\([^/]+\\)$" arg) | 882 | (ff-string-match "\\(.*\\)/\\([^/]+\\)/\\([^.]+\\).\\([^/]+\\)$" arg) |
| 895 | (let ((path (if (match-beginning 1) | 883 | (let ((dire (if (match-beginning 2) |
| 896 | (substring arg (match-beginning 1) (match-end 1)) nil)) | ||
| 897 | (dire (if (match-beginning 2) | ||
| 898 | (substring arg (match-beginning 2) (match-end 2)) nil)) | 884 | (substring arg (match-beginning 2) (match-end 2)) nil)) |
| 899 | (file (if (match-beginning 3) | 885 | (file (if (match-beginning 3) |
| 900 | (substring arg (match-beginning 3) (match-end 3)) nil)) | 886 | (substring arg (match-beginning 3) (match-end 3)) nil)) |
diff --git a/lisp/follow.el b/lisp/follow.el index 53b32e57031..3fcdf24f4f2 100644 --- a/lisp/follow.el +++ b/lisp/follow.el | |||
| @@ -515,7 +515,7 @@ Works like `scroll-up' when not in Follow mode." | |||
| 515 | (declare-function comint-adjust-point "comint" (window)) | 515 | (declare-function comint-adjust-point "comint" (window)) |
| 516 | (defvar comint-scroll-show-maximum-output) | 516 | (defvar comint-scroll-show-maximum-output) |
| 517 | 517 | ||
| 518 | (defun follow-comint-scroll-to-bottom (&optional window) | 518 | (defun follow-comint-scroll-to-bottom (&optional _window) |
| 519 | "Scroll the bottom-most window in the current Follow chain. | 519 | "Scroll the bottom-most window in the current Follow chain. |
| 520 | This is to be called by `comint-postoutput-scroll-to-bottom'." | 520 | This is to be called by `comint-postoutput-scroll-to-bottom'." |
| 521 | (let* ((buffer (current-buffer)) | 521 | (let* ((buffer (current-buffer)) |
| @@ -883,15 +883,14 @@ returned by `follow-windows-start-end'." | |||
| 883 | (defun follow-select-if-visible (dest win-start-end) | 883 | (defun follow-select-if-visible (dest win-start-end) |
| 884 | "Select and return a window, if DEST is visible in it. | 884 | "Select and return a window, if DEST is visible in it. |
| 885 | Return the selected window." | 885 | Return the selected window." |
| 886 | (let (win win-end wse) | 886 | (let (win wse) |
| 887 | (while (and (not win) win-start-end) | 887 | (while (and (not win) win-start-end) |
| 888 | ;; Don't select a window that was just moved. This makes it | 888 | ;; Don't select a window that was just moved. This makes it |
| 889 | ;; possible to later select the last window after a | 889 | ;; possible to later select the last window after a |
| 890 | ;; `end-of-buffer' command. | 890 | ;; `end-of-buffer' command. |
| 891 | (setq wse (car win-start-end)) | 891 | (setq wse (car win-start-end)) |
| 892 | (when (follow-pos-visible dest (car wse) win-start-end) | 892 | (when (follow-pos-visible dest (car wse) win-start-end) |
| 893 | (setq win (car wse) | 893 | (setq win (car wse)) |
| 894 | win-end (nth 2 wse)) | ||
| 895 | (select-window win)) | 894 | (select-window win)) |
| 896 | (setq win-start-end (cdr win-start-end))) | 895 | (setq win-start-end (cdr win-start-end))) |
| 897 | win)) | 896 | win)) |
diff --git a/lisp/forms.el b/lisp/forms.el index 37914bf5465..38fc0b320dd 100644 --- a/lisp/forms.el +++ b/lisp/forms.el | |||
| @@ -439,6 +439,8 @@ Also, initial position is at last record." | |||
| 439 | (defvar forms--rw-face nil | 439 | (defvar forms--rw-face nil |
| 440 | "Face used to represent read-write data on the screen.") | 440 | "Face used to represent read-write data on the screen.") |
| 441 | 441 | ||
| 442 | (defvar read-file-filter) ; bound in forms--intuit-from-file | ||
| 443 | |||
| 442 | ;;;###autoload | 444 | ;;;###autoload |
| 443 | (defun forms-mode (&optional primary) | 445 | (defun forms-mode (&optional primary) |
| 444 | "Major mode to visit files in a field-structured manner using a form. | 446 | "Major mode to visit files in a field-structured manner using a form. |
| @@ -913,7 +915,7 @@ Commands: Equivalent keys in read-only mode: | |||
| 913 | `(lambda (arg) | 915 | `(lambda (arg) |
| 914 | (let ((inhibit-read-only t)) | 916 | (let ((inhibit-read-only t)) |
| 915 | ,@(apply 'append | 917 | ,@(apply 'append |
| 916 | (mapcar 'forms--make-format-elt-using-text-properties | 918 | (mapcar #'forms--make-format-elt-using-text-properties |
| 917 | forms-format-list)) | 919 | forms-format-list)) |
| 918 | ;; Prevent insertion before the first text. | 920 | ;; Prevent insertion before the first text. |
| 919 | ,@(if (numberp (car forms-format-list)) | 921 | ,@(if (numberp (car forms-format-list)) |
| @@ -926,7 +928,7 @@ Commands: Equivalent keys in read-only mode: | |||
| 926 | (setq forms--iif-start nil)) | 928 | (setq forms--iif-start nil)) |
| 927 | `(lambda (arg) | 929 | `(lambda (arg) |
| 928 | ,@(apply 'append | 930 | ,@(apply 'append |
| 929 | (mapcar 'forms--make-format-elt forms-format-list))))) | 931 | (mapcar #'forms--make-format-elt forms-format-list))))) |
| 930 | 932 | ||
| 931 | ;; We have tallied the number of markers and dynamic texts, | 933 | ;; We have tallied the number of markers and dynamic texts, |
| 932 | ;; so we can allocate the arrays now. | 934 | ;; so we can allocate the arrays now. |
| @@ -1098,7 +1100,7 @@ Commands: Equivalent keys in read-only mode: | |||
| 1098 | (goto-char (point-min)) | 1100 | (goto-char (point-min)) |
| 1099 | ,@(apply 'append | 1101 | ,@(apply 'append |
| 1100 | (mapcar | 1102 | (mapcar |
| 1101 | 'forms--make-parser-elt | 1103 | #'forms--make-parser-elt |
| 1102 | (append forms-format-list (list nil))))))))) | 1104 | (append forms-format-list (list nil))))))))) |
| 1103 | 1105 | ||
| 1104 | (forms--debug 'forms--parser)) | 1106 | (forms--debug 'forms--parser)) |
| @@ -1198,8 +1200,6 @@ Commands: Equivalent keys in read-only mode: | |||
| 1198 | (setq forms--field nil))) | 1200 | (setq forms--field nil))) |
| 1199 | )) | 1201 | )) |
| 1200 | 1202 | ||
| 1201 | (defvar read-file-filter) ; bound in forms--intuit-from-file | ||
| 1202 | |||
| 1203 | (defun forms--intuit-from-file () | 1203 | (defun forms--intuit-from-file () |
| 1204 | "Get number of fields and a default form using the data file." | 1204 | "Get number of fields and a default form using the data file." |
| 1205 | 1205 | ||
| @@ -1569,10 +1569,10 @@ As a side effect: sets `forms--the-record-list'." | |||
| 1569 | ;; Build new record. | 1569 | ;; Build new record. |
| 1570 | (setq forms--the-record-list (forms--parse-form)) | 1570 | (setq forms--the-record-list (forms--parse-form)) |
| 1571 | (setq the-record | 1571 | (setq the-record |
| 1572 | (mapconcat 'identity forms--the-record-list forms-field-sep)) | 1572 | (mapconcat #'identity forms--the-record-list forms-field-sep)) |
| 1573 | 1573 | ||
| 1574 | (if (string-match (regexp-quote forms-field-sep) | 1574 | (if (string-match-p (regexp-quote forms-field-sep) |
| 1575 | (mapconcat 'identity forms--the-record-list "")) | 1575 | (mapconcat #'identity forms--the-record-list "")) |
| 1576 | (error "Field separator occurs in record - update refused")) | 1576 | (error "Field separator occurs in record - update refused")) |
| 1577 | 1577 | ||
| 1578 | ;; Handle multi-line fields, if allowed. | 1578 | ;; Handle multi-line fields, if allowed. |
| @@ -1580,7 +1580,7 @@ As a side effect: sets `forms--the-record-list'." | |||
| 1580 | (forms--trans the-record "\n" forms-multi-line)) | 1580 | (forms--trans the-record "\n" forms-multi-line)) |
| 1581 | 1581 | ||
| 1582 | ;; A final sanity check before updating. | 1582 | ;; A final sanity check before updating. |
| 1583 | (if (string-match "\n" the-record) | 1583 | (if (string-match-p "\n" the-record) |
| 1584 | (error "Multi-line fields in this record - update refused")) | 1584 | (error "Multi-line fields in this record - update refused")) |
| 1585 | 1585 | ||
| 1586 | (with-current-buffer forms--file-buffer | 1586 | (with-current-buffer forms--file-buffer |
| @@ -1779,11 +1779,7 @@ after the current record." | |||
| 1779 | (setq the-list (cdr (append the-fields nil)))) | 1779 | (setq the-list (cdr (append the-fields nil)))) |
| 1780 | (setq the-list (make-list forms-number-of-fields ""))) | 1780 | (setq the-list (make-list forms-number-of-fields ""))) |
| 1781 | 1781 | ||
| 1782 | (setq the-record | 1782 | (setq the-record (mapconcat #'identity the-list forms-field-sep)) |
| 1783 | (mapconcat | ||
| 1784 | 'identity | ||
| 1785 | the-list | ||
| 1786 | forms-field-sep)) | ||
| 1787 | 1783 | ||
| 1788 | (with-current-buffer forms--file-buffer | 1784 | (with-current-buffer forms--file-buffer |
| 1789 | (forms--goto-record ln) | 1785 | (forms--goto-record ln) |
diff --git a/lisp/help-mode.el b/lisp/help-mode.el index b56adc2a4a9..5553556e03c 100644 --- a/lisp/help-mode.el +++ b/lisp/help-mode.el | |||
| @@ -268,7 +268,7 @@ The format is (FUNCTION ARGS...).") | |||
| 268 | 268 | ||
| 269 | (define-button-type 'help-dir-local-var-def | 269 | (define-button-type 'help-dir-local-var-def |
| 270 | :supertype 'help-xref | 270 | :supertype 'help-xref |
| 271 | 'help-function (lambda (var &optional file) | 271 | 'help-function (lambda (_var &optional file) |
| 272 | ;; FIXME: this should go to the point where the | 272 | ;; FIXME: this should go to the point where the |
| 273 | ;; local variable was defined. | 273 | ;; local variable was defined. |
| 274 | (find-file file)) | 274 | (find-file file)) |
| @@ -541,7 +541,7 @@ that." | |||
| 541 | (while | 541 | (while |
| 542 | (and (not (eobp)) | 542 | (and (not (eobp)) |
| 543 | ;; Stop at a pair of blank lines. | 543 | ;; Stop at a pair of blank lines. |
| 544 | (not (looking-at "\n\\s-*\n"))) | 544 | (not (looking-at-p "\n\\s-*\n"))) |
| 545 | ;; Skip a single blank line. | 545 | ;; Skip a single blank line. |
| 546 | (and (eolp) (forward-line)) | 546 | (and (eolp) (forward-line)) |
| 547 | (end-of-line) | 547 | (end-of-line) |
| @@ -605,26 +605,25 @@ See `help-make-xrefs'." | |||
| 605 | (save-restriction | 605 | (save-restriction |
| 606 | (narrow-to-region from to) | 606 | (narrow-to-region from to) |
| 607 | (goto-char (point-min)) | 607 | (goto-char (point-min)) |
| 608 | (condition-case nil | 608 | (ignore-errors |
| 609 | (while (not (eobp)) | 609 | (while (not (eobp)) |
| 610 | (cond | 610 | (cond |
| 611 | ((looking-at "\"") (forward-sexp 1)) | 611 | ((looking-at-p "\"") (forward-sexp 1)) |
| 612 | ((looking-at "#<") (search-forward ">" nil 'move)) | 612 | ((looking-at-p "#<") (search-forward ">" nil 'move)) |
| 613 | ((looking-at "\\(\\(\\sw\\|\\s_\\)+\\)") | 613 | ((looking-at "\\(\\(\\sw\\|\\s_\\)+\\)") |
| 614 | (let* ((sym (intern-soft (match-string 1))) | 614 | (let* ((sym (intern-soft (match-string 1))) |
| 615 | (type (cond ((fboundp sym) 'help-function) | 615 | (type (cond ((fboundp sym) 'help-function) |
| 616 | ((or (memq sym '(t nil)) | 616 | ((or (memq sym '(t nil)) |
| 617 | (keywordp sym)) | 617 | (keywordp sym)) |
| 618 | nil) | 618 | nil) |
| 619 | ((and sym | 619 | ((and sym |
| 620 | (or (boundp sym) | 620 | (or (boundp sym) |
| 621 | (get sym | 621 | (get sym |
| 622 | 'variable-documentation))) | 622 | 'variable-documentation))) |
| 623 | 'help-variable)))) | 623 | 'help-variable)))) |
| 624 | (when type (help-xref-button 1 type sym))) | 624 | (when type (help-xref-button 1 type sym))) |
| 625 | (goto-char (match-end 1))) | 625 | (goto-char (match-end 1))) |
| 626 | (t (forward-char 1)))) | 626 | (t (forward-char 1)))))))))) |
| 627 | (error nil))))))) | ||
| 628 | 627 | ||
| 629 | 628 | ||
| 630 | ;; Additional functions for (re-)creating types of help buffers. | 629 | ;; Additional functions for (re-)creating types of help buffers. |
diff --git a/lisp/ibuffer.el b/lisp/ibuffer.el index 09d7c143346..ce29505d6f2 100644 --- a/lisp/ibuffer.el +++ b/lisp/ibuffer.el | |||
| @@ -53,6 +53,8 @@ | |||
| 53 | (defvar ibuffer-tmp-hide-regexps) | 53 | (defvar ibuffer-tmp-hide-regexps) |
| 54 | (defvar ibuffer-tmp-show-regexps) | 54 | (defvar ibuffer-tmp-show-regexps) |
| 55 | 55 | ||
| 56 | (declare-function ibuffer-ext-visible-p "ibuf-ext" | ||
| 57 | (buf all &optional ibuffer-buf)) | ||
| 56 | (declare-function ibuffer-mark-on-buffer "ibuf-ext" | 58 | (declare-function ibuffer-mark-on-buffer "ibuf-ext" |
| 57 | (func &optional ibuffer-mark-on-buffer-mark group)) | 59 | (func &optional ibuffer-mark-on-buffer-mark group)) |
| 58 | (declare-function ibuffer-generate-filter-groups "ibuf-ext" | 60 | (declare-function ibuffer-generate-filter-groups "ibuf-ext" |
| @@ -1198,7 +1200,7 @@ a new window in the current frame, splitting vertically." | |||
| 1198 | (and (stringp (cadr err)) | 1200 | (and (stringp (cadr err)) |
| 1199 | ;; This definitely falls in the | 1201 | ;; This definitely falls in the |
| 1200 | ;; ghetto hack category... | 1202 | ;; ghetto hack category... |
| 1201 | (not (string-match "too small" (cadr err))))) | 1203 | (not (string-match-p "too small" (cadr err))))) |
| 1202 | (signal (car err) (cdr err)) | 1204 | (signal (car err) (cdr err)) |
| 1203 | (enlarge-window 3)))))) | 1205 | (enlarge-window 3)))))) |
| 1204 | (select-window (next-window)) | 1206 | (select-window (next-window)) |
diff --git a/lisp/msb.el b/lisp/msb.el index 4bde993ff84..110a4277376 100644 --- a/lisp/msb.el +++ b/lisp/msb.el | |||
| @@ -386,7 +386,7 @@ This is instead of the groups in `msb-menu-cond'." | |||
| 386 | ;;; | 386 | ;;; |
| 387 | ;;; Some example function to be used for `msb-item-handling-function'. | 387 | ;;; Some example function to be used for `msb-item-handling-function'. |
| 388 | ;;; | 388 | ;;; |
| 389 | (defun msb-item-handler (buffer &optional maxbuf) | 389 | (defun msb-item-handler (_buffer &optional _maxbuf) |
| 390 | "Create one string item, concerning BUFFER, for the buffer menu. | 390 | "Create one string item, concerning BUFFER, for the buffer menu. |
| 391 | The item looks like: | 391 | The item looks like: |
| 392 | *% <buffer-name> | 392 | *% <buffer-name> |
| @@ -410,7 +410,7 @@ Optional second argument MAXBUF is completely ignored." | |||
| 410 | (error "Unknown type of `dired-directory' in buffer %s" | 410 | (error "Unknown type of `dired-directory' in buffer %s" |
| 411 | (buffer-name))))) | 411 | (buffer-name))))) |
| 412 | 412 | ||
| 413 | (defun msb-dired-item-handler (buffer &optional maxbuf) | 413 | (defun msb-dired-item-handler (_buffer &optional _maxbuf) |
| 414 | "Create one string item, concerning a dired BUFFER, for the buffer menu. | 414 | "Create one string item, concerning a dired BUFFER, for the buffer menu. |
| 415 | The item looks like: | 415 | The item looks like: |
| 416 | *% <buffer-name> | 416 | *% <buffer-name> |
diff --git a/lisp/ses.el b/lisp/ses.el index bf88364456f..5f48dd2f27e 100644 --- a/lisp/ses.el +++ b/lisp/ses.el | |||
| @@ -703,7 +703,6 @@ for this spreadsheet." | |||
| 703 | (and (string-match "\\`\\([A-Z]+\\)\\([0-9]+\\)\\'" str) | 703 | (and (string-match "\\`\\([A-Z]+\\)\\([0-9]+\\)\\'" str) |
| 704 | (let* ((col-str (match-string-no-properties 1 str)) | 704 | (let* ((col-str (match-string-no-properties 1 str)) |
| 705 | (col 0) | 705 | (col 0) |
| 706 | (col-offset 0) | ||
| 707 | (col-base 1) | 706 | (col-base 1) |
| 708 | (col-idx (1- (length col-str))) | 707 | (col-idx (1- (length col-str))) |
| 709 | (row (1- (string-to-number (match-string-no-properties 2 str))))) | 708 | (row (1- (string-to-number (match-string-no-properties 2 str))))) |
| @@ -740,7 +739,7 @@ row and column of the cell, with numbering starting from 0. | |||
| 740 | Return nil in case of failure." | 739 | Return nil in case of failure." |
| 741 | (unless (local-variable-p sym) | 740 | (unless (local-variable-p sym) |
| 742 | (make-local-variable sym) | 741 | (make-local-variable sym) |
| 743 | (if (let (case-fold-search) (string-match "\\`[A-Z]+[0-9]+\\'" (symbol-name sym))) | 742 | (if (let (case-fold-search) (string-match-p "\\`[A-Z]+[0-9]+\\'" (symbol-name sym))) |
| 744 | (put sym 'ses-cell (cons row col)) | 743 | (put sym 'ses-cell (cons row col)) |
| 745 | (put sym 'ses-cell :ses-named) | 744 | (put sym 'ses-cell :ses-named) |
| 746 | (setq ses--named-cell-hashmap (or ses--named-cell-hashmap (make-hash-table :test 'eq))) | 745 | (setq ses--named-cell-hashmap (or ses--named-cell-hashmap (make-hash-table :test 'eq))) |
| @@ -1474,7 +1473,7 @@ Sets `ses-relocate-return' to 'delete if cell-references were removed." | |||
| 1474 | (let (rowcol result) | 1473 | (let (rowcol result) |
| 1475 | (if (or (atom formula) (eq (car formula) 'quote)) | 1474 | (if (or (atom formula) (eq (car formula) 'quote)) |
| 1476 | (if (and (setq rowcol (ses-sym-rowcol formula)) | 1475 | (if (and (setq rowcol (ses-sym-rowcol formula)) |
| 1477 | (string-match "\\`[A-Z]+[0-9]+\\'" (symbol-name formula))) | 1476 | (string-match-p "\\`[A-Z]+[0-9]+\\'" (symbol-name formula))) |
| 1478 | (ses-relocate-symbol formula rowcol | 1477 | (ses-relocate-symbol formula rowcol |
| 1479 | startrow startcol rowincr colincr) | 1478 | startrow startcol rowincr colincr) |
| 1480 | formula) ; Pass through as-is. | 1479 | formula) ; Pass through as-is. |
| @@ -1735,7 +1734,7 @@ Does not execute cell formulas or print functions." | |||
| 1735 | (search-backward ";; Local Variables:\n" nil t) | 1734 | (search-backward ";; Local Variables:\n" nil t) |
| 1736 | (backward-list 1) | 1735 | (backward-list 1) |
| 1737 | (setq ses--params-marker (point-marker)) | 1736 | (setq ses--params-marker (point-marker)) |
| 1738 | (let ((params (condition-case nil (read (current-buffer)) (error nil)))) | 1737 | (let ((params (ignore-errors (read (current-buffer))))) |
| 1739 | (or (and (= (safe-length params) 3) | 1738 | (or (and (= (safe-length params) 3) |
| 1740 | (numberp (car params)) | 1739 | (numberp (car params)) |
| 1741 | (numberp (cadr params)) | 1740 | (numberp (cadr params)) |
| @@ -1761,7 +1760,7 @@ Does not execute cell formulas or print functions." | |||
| 1761 | ;; Skip over print area, which we assume is correct. | 1760 | ;; Skip over print area, which we assume is correct. |
| 1762 | (goto-char (point-min)) | 1761 | (goto-char (point-min)) |
| 1763 | (forward-line ses--numrows) | 1762 | (forward-line ses--numrows) |
| 1764 | (or (looking-at ses-print-data-boundary) | 1763 | (or (looking-at-p ses-print-data-boundary) |
| 1765 | (error "Missing marker between print and data areas")) | 1764 | (error "Missing marker between print and data areas")) |
| 1766 | (forward-char 1) | 1765 | (forward-char 1) |
| 1767 | (setq ses--data-marker (point-marker)) | 1766 | (setq ses--data-marker (point-marker)) |
| @@ -1774,12 +1773,12 @@ Does not execute cell formulas or print functions." | |||
| 1774 | (dotimes (col ses--numcols) | 1773 | (dotimes (col ses--numcols) |
| 1775 | (let* ((x (read (current-buffer))) | 1774 | (let* ((x (read (current-buffer))) |
| 1776 | (sym (car-safe (cdr-safe x)))) | 1775 | (sym (car-safe (cdr-safe x)))) |
| 1777 | (or (and (looking-at "\n") | 1776 | (or (and (looking-at-p "\n") |
| 1778 | (eq (car-safe x) 'ses-cell) | 1777 | (eq (car-safe x) 'ses-cell) |
| 1779 | (ses-create-cell-variable sym row col)) | 1778 | (ses-create-cell-variable sym row col)) |
| 1780 | (error "Cell-def error")) | 1779 | (error "Cell-def error")) |
| 1781 | (eval x))) | 1780 | (eval x))) |
| 1782 | (or (looking-at "\n\n") | 1781 | (or (looking-at-p "\n\n") |
| 1783 | (error "Missing blank line between rows"))) | 1782 | (error "Missing blank line between rows"))) |
| 1784 | ;; Load global parameters. | 1783 | ;; Load global parameters. |
| 1785 | (let ((widths (read (current-buffer))) | 1784 | (let ((widths (read (current-buffer))) |
| @@ -1805,8 +1804,8 @@ Does not execute cell formulas or print functions." | |||
| 1805 | (1value (eval head-row))) | 1804 | (1value (eval head-row))) |
| 1806 | ;; Should be back at global-params. | 1805 | ;; Should be back at global-params. |
| 1807 | (forward-char 1) | 1806 | (forward-char 1) |
| 1808 | (or (looking-at (replace-regexp-in-string "1" "[0-9]+" | 1807 | (or (looking-at-p (replace-regexp-in-string "1" "[0-9]+" |
| 1809 | ses-initial-global-parameters)) | 1808 | ses-initial-global-parameters)) |
| 1810 | (error "Problem with column-defs or global-params")) | 1809 | (error "Problem with column-defs or global-params")) |
| 1811 | ;; Check for overall newline count in definitions area. | 1810 | ;; Check for overall newline count in definitions area. |
| 1812 | (forward-line 3) | 1811 | (forward-line 3) |
| @@ -2077,9 +2076,8 @@ Based on the current set of columns and `window-hscroll' position." | |||
| 2077 | 2076 | ||
| 2078 | (defun ses-jump-safe (cell) | 2077 | (defun ses-jump-safe (cell) |
| 2079 | "Like `ses-jump', but no error if invalid cell." | 2078 | "Like `ses-jump', but no error if invalid cell." |
| 2080 | (condition-case nil | 2079 | (ignore-errors |
| 2081 | (ses-jump cell) | 2080 | (ses-jump cell))) |
| 2082 | (error))) | ||
| 2083 | 2081 | ||
| 2084 | (defun ses-reprint-all (&optional nonarrow) | 2082 | (defun ses-reprint-all (&optional nonarrow) |
| 2085 | "Recreate the display area. Calls all printer functions. Narrows to | 2083 | "Recreate the display area. Calls all printer functions. Narrows to |
| @@ -2789,7 +2787,7 @@ We clear the killed cells instead of deleting them." | |||
| 2789 | ;; For some reason, the text-read-only error is not caught by `delete-region', | 2787 | ;; For some reason, the text-read-only error is not caught by `delete-region', |
| 2790 | ;; so we have to use subterfuge. | 2788 | ;; so we have to use subterfuge. |
| 2791 | (let ((buffer-read-only t)) | 2789 | (let ((buffer-read-only t)) |
| 2792 | (1value (condition-case x | 2790 | (1value (condition-case nil |
| 2793 | (noreturn (funcall (lookup-key (current-global-map) | 2791 | (noreturn (funcall (lookup-key (current-global-map) |
| 2794 | (this-command-keys)) | 2792 | (this-command-keys)) |
| 2795 | beg end)) | 2793 | beg end)) |
| @@ -3014,13 +3012,13 @@ spot, or error signal if user requests cancel." | |||
| 3014 | (ses-col-printer (1- ses--numcols))))) | 3012 | (ses-col-printer (1- ses--numcols))))) |
| 3015 | rowcol)) | 3013 | rowcol)) |
| 3016 | 3014 | ||
| 3017 | (defun ses-export-tsv (beg end) | 3015 | (defun ses-export-tsv (_beg _end) |
| 3018 | "Export values from the current range, with tabs between columns and | 3016 | "Export values from the current range, with tabs between columns and |
| 3019 | newlines between rows. Result is placed in kill ring." | 3017 | newlines between rows. Result is placed in kill ring." |
| 3020 | (interactive "r") | 3018 | (interactive "r") |
| 3021 | (ses-export-tab nil)) | 3019 | (ses-export-tab nil)) |
| 3022 | 3020 | ||
| 3023 | (defun ses-export-tsf (beg end) | 3021 | (defun ses-export-tsf (_beg _end) |
| 3024 | "Export formulas from the current range, with tabs between columns and | 3022 | "Export formulas from the current range, with tabs between columns and |
| 3025 | newlines between rows. Result is placed in kill ring." | 3023 | newlines between rows. Result is placed in kill ring." |
| 3026 | (interactive "r") | 3024 | (interactive "r") |
| @@ -3298,7 +3296,7 @@ highlighted range in the spreadsheet." | |||
| 3298 | (let* ((x (ses-sym-rowcol ref)) | 3296 | (let* ((x (ses-sym-rowcol ref)) |
| 3299 | (xcell (ses-get-cell (car x) (cdr x)))) | 3297 | (xcell (ses-get-cell (car x) (cdr x)))) |
| 3300 | (ses-cell-references-aset xcell | 3298 | (ses-cell-references-aset xcell |
| 3301 | (cons new-name (delq sym | 3299 | (cons new-name (delq sym |
| 3302 | (ses-cell-references xcell)))))) | 3300 | (ses-cell-references xcell)))))) |
| 3303 | (push new-name ses--renamed-cell-symb-list) | 3301 | (push new-name ses--renamed-cell-symb-list) |
| 3304 | (set new-name (symbol-value sym)) | 3302 | (set new-name (symbol-value sym)) |
| @@ -3579,7 +3577,7 @@ current column and continues until the next nonblank column." | |||
| 3579 | current column and continues until the next nonblank column." | 3577 | current column and continues until the next nonblank column." |
| 3580 | (ses-center-span value ?~)) | 3578 | (ses-center-span value ?~)) |
| 3581 | 3579 | ||
| 3582 | (defun ses-unsafe (value) | 3580 | (defun ses-unsafe (_value) |
| 3583 | "Substitute for an unsafe formula or printer." | 3581 | "Substitute for an unsafe formula or printer." |
| 3584 | (error "Unsafe formula or printer")) | 3582 | (error "Unsafe formula or printer")) |
| 3585 | 3583 | ||
diff --git a/lisp/tabify.el b/lisp/tabify.el index a90bf801bcf..44a233717dd 100644 --- a/lisp/tabify.el +++ b/lisp/tabify.el | |||
| @@ -28,7 +28,7 @@ | |||
| 28 | ;;; Code: | 28 | ;;; Code: |
| 29 | 29 | ||
| 30 | ;;;###autoload | 30 | ;;;###autoload |
| 31 | (defun untabify (start end &optional arg) | 31 | (defun untabify (start end &optional _arg) |
| 32 | "Convert all tabs in region to multiple spaces, preserving columns. | 32 | "Convert all tabs in region to multiple spaces, preserving columns. |
| 33 | If called interactively with prefix ARG, convert for the entire | 33 | If called interactively with prefix ARG, convert for the entire |
| 34 | buffer. | 34 | buffer. |
| @@ -61,7 +61,7 @@ Usually this will be \" [ \\t]+\" to match a space followed by whitespace. | |||
| 61 | \"^\\t* [ \\t]+\" is also useful, for tabifying only initial whitespace.") | 61 | \"^\\t* [ \\t]+\" is also useful, for tabifying only initial whitespace.") |
| 62 | 62 | ||
| 63 | ;;;###autoload | 63 | ;;;###autoload |
| 64 | (defun tabify (start end &optional arg) | 64 | (defun tabify (start end &optional _arg) |
| 65 | "Convert multiple spaces in region to tabs when possible. | 65 | "Convert multiple spaces in region to tabs when possible. |
| 66 | A group of spaces is partially replaced by tabs | 66 | A group of spaces is partially replaced by tabs |
| 67 | when this can be done without changing the column they end at. | 67 | when this can be done without changing the column they end at. |
diff --git a/lisp/thingatpt.el b/lisp/thingatpt.el index b7ecdb513f5..b67a32a24f7 100644 --- a/lisp/thingatpt.el +++ b/lisp/thingatpt.el | |||
| @@ -84,48 +84,47 @@ positions of the thing found." | |||
| 84 | (if (get thing 'bounds-of-thing-at-point) | 84 | (if (get thing 'bounds-of-thing-at-point) |
| 85 | (funcall (get thing 'bounds-of-thing-at-point)) | 85 | (funcall (get thing 'bounds-of-thing-at-point)) |
| 86 | (let ((orig (point))) | 86 | (let ((orig (point))) |
| 87 | (condition-case nil | 87 | (ignore-errors |
| 88 | (save-excursion | 88 | (save-excursion |
| 89 | ;; Try moving forward, then back. | 89 | ;; Try moving forward, then back. |
| 90 | (funcall ;; First move to end. | 90 | (funcall ;; First move to end. |
| 91 | (or (get thing 'end-op) | 91 | (or (get thing 'end-op) |
| 92 | (lambda () (forward-thing thing 1)))) | 92 | (lambda () (forward-thing thing 1)))) |
| 93 | (funcall ;; Then move to beg. | 93 | (funcall ;; Then move to beg. |
| 94 | (or (get thing 'beginning-op) | 94 | (or (get thing 'beginning-op) |
| 95 | (lambda () (forward-thing thing -1)))) | 95 | (lambda () (forward-thing thing -1)))) |
| 96 | (let ((beg (point))) | 96 | (let ((beg (point))) |
| 97 | (if (<= beg orig) | 97 | (if (<= beg orig) |
| 98 | ;; If that brings us all the way back to ORIG, | 98 | ;; If that brings us all the way back to ORIG, |
| 99 | ;; it worked. But END may not be the real end. | 99 | ;; it worked. But END may not be the real end. |
| 100 | ;; So find the real end that corresponds to BEG. | 100 | ;; So find the real end that corresponds to BEG. |
| 101 | ;; FIXME: in which cases can `real-end' differ from `end'? | 101 | ;; FIXME: in which cases can `real-end' differ from `end'? |
| 102 | (let ((real-end | 102 | (let ((real-end |
| 103 | (progn | ||
| 104 | (funcall | ||
| 105 | (or (get thing 'end-op) | ||
| 106 | (lambda () (forward-thing thing 1)))) | ||
| 107 | (point)))) | ||
| 108 | (when (and (<= orig real-end) (< beg real-end)) | ||
| 109 | (cons beg real-end))) | ||
| 110 | (goto-char orig) | ||
| 111 | ;; Try a second time, moving backward first and then forward, | ||
| 112 | ;; so that we can find a thing that ends at ORIG. | ||
| 113 | (funcall ;; First, move to beg. | ||
| 114 | (or (get thing 'beginning-op) | ||
| 115 | (lambda () (forward-thing thing -1)))) | ||
| 116 | (funcall ;; Then move to end. | ||
| 117 | (or (get thing 'end-op) | ||
| 118 | (lambda () (forward-thing thing 1)))) | ||
| 119 | (let ((end (point)) | ||
| 120 | (real-beg | ||
| 121 | (progn | 103 | (progn |
| 122 | (funcall | 104 | (funcall |
| 123 | (or (get thing 'beginning-op) | 105 | (or (get thing 'end-op) |
| 124 | (lambda () (forward-thing thing -1)))) | 106 | (lambda () (forward-thing thing 1)))) |
| 125 | (point)))) | 107 | (point)))) |
| 126 | (if (and (<= real-beg orig) (<= orig end) (< real-beg end)) | 108 | (when (and (<= orig real-end) (< beg real-end)) |
| 127 | (cons real-beg end)))))) | 109 | (cons beg real-end))) |
| 128 | (error nil))))) | 110 | (goto-char orig) |
| 111 | ;; Try a second time, moving backward first and then forward, | ||
| 112 | ;; so that we can find a thing that ends at ORIG. | ||
| 113 | (funcall ;; First, move to beg. | ||
| 114 | (or (get thing 'beginning-op) | ||
| 115 | (lambda () (forward-thing thing -1)))) | ||
| 116 | (funcall ;; Then move to end. | ||
| 117 | (or (get thing 'end-op) | ||
| 118 | (lambda () (forward-thing thing 1)))) | ||
| 119 | (let ((end (point)) | ||
| 120 | (real-beg | ||
| 121 | (progn | ||
| 122 | (funcall | ||
| 123 | (or (get thing 'beginning-op) | ||
| 124 | (lambda () (forward-thing thing -1)))) | ||
| 125 | (point)))) | ||
| 126 | (if (and (<= real-beg orig) (<= orig end) (< real-beg end)) | ||
| 127 | (cons real-beg end)))))))))) | ||
| 129 | 128 | ||
| 130 | ;;;###autoload | 129 | ;;;###autoload |
| 131 | (defun thing-at-point (thing &optional no-properties) | 130 | (defun thing-at-point (thing &optional no-properties) |
| @@ -217,21 +216,19 @@ The bounds of THING are determined by `bounds-of-thing-at-point'." | |||
| 217 | \[Internal function used by `bounds-of-thing-at-point'.]" | 216 | \[Internal function used by `bounds-of-thing-at-point'.]" |
| 218 | (save-excursion | 217 | (save-excursion |
| 219 | (let ((opoint (point)) | 218 | (let ((opoint (point)) |
| 220 | (beg (condition-case nil | 219 | (beg (ignore-errors |
| 221 | (progn (up-list -1) | 220 | (up-list -1) |
| 222 | (point)) | 221 | (point)))) |
| 223 | (error nil)))) | 222 | (ignore-errors |
| 224 | (condition-case nil | 223 | (if beg |
| 225 | (if beg | 224 | (progn (forward-sexp) |
| 226 | (progn (forward-sexp) | 225 | (cons beg (point))) |
| 227 | (cons beg (point))) | 226 | ;; Are we are at the beginning of a top-level sexp? |
| 228 | ;; Are we are at the beginning of a top-level sexp? | 227 | (forward-sexp) |
| 229 | (forward-sexp) | 228 | (let ((end (point))) |
| 230 | (let ((end (point))) | 229 | (backward-sexp) |
| 231 | (backward-sexp) | 230 | (if (>= opoint (point)) |
| 232 | (if (>= opoint (point)) | 231 | (cons opoint end)))))))) |
| 233 | (cons opoint end)))) | ||
| 234 | (error nil))))) | ||
| 235 | 232 | ||
| 236 | ;; Defuns | 233 | ;; Defuns |
| 237 | 234 | ||
| @@ -358,7 +355,7 @@ the bounds of a possible ill-formed URI (one lacking a scheme)." | |||
| 358 | (if found | 355 | (if found |
| 359 | (cons (match-beginning 1) (match-end 1)))))) | 356 | (cons (match-beginning 1) (match-end 1)))))) |
| 360 | 357 | ||
| 361 | (defun thing-at-point--bounds-of-well-formed-url (beg end pt) | 358 | (defun thing-at-point--bounds-of-well-formed-url (beg end _pt) |
| 362 | (save-excursion | 359 | (save-excursion |
| 363 | (goto-char beg) | 360 | (goto-char beg) |
| 364 | (let (url-beg paren-end regexp) | 361 | (let (url-beg paren-end regexp) |
| @@ -453,16 +450,14 @@ looks like an email address, \"ftp://\" if it starts with | |||
| 453 | htb ret) | 450 | htb ret) |
| 454 | (while htbs | 451 | (while htbs |
| 455 | (setq htb (car htbs) htbs (cdr htbs)) | 452 | (setq htb (car htbs) htbs (cdr htbs)) |
| 456 | (condition-case nil | 453 | (ignore-errors |
| 457 | (progn | 454 | ;; errs: htb symbol may be unbound, or not a hash-table. |
| 458 | ;; errs: htb symbol may be unbound, or not a hash-table. | 455 | ;; gnus-gethash is just a macro for intern-soft. |
| 459 | ;; gnus-gethash is just a macro for intern-soft. | 456 | (and (symbol-value htb) |
| 460 | (and (symbol-value htb) | 457 | (intern-soft string (symbol-value htb)) |
| 461 | (intern-soft string (symbol-value htb)) | 458 | (setq ret string htbs nil)) |
| 462 | (setq ret string htbs nil)) | 459 | ;; If we made it this far, gnus is running, so ignore "heads": |
| 463 | ;; If we made it this far, gnus is running, so ignore "heads": | 460 | (setq heads nil))) |
| 464 | (setq heads nil)) | ||
| 465 | (error nil))) | ||
| 466 | (or ret (not heads) | 461 | (or ret (not heads) |
| 467 | (let ((head (string-match "\\`\\([[:lower:]]+\\)\\." string))) | 462 | (let ((head (string-match "\\`\\([[:lower:]]+\\)\\." string))) |
| 468 | (and head (setq head (substring string 0 (match-end 1))) | 463 | (and head (setq head (substring string 0 (match-end 1))) |
| @@ -566,9 +561,8 @@ Signal an error if the entire string was not used." | |||
| 566 | (car read-data)))) | 561 | (car read-data)))) |
| 567 | 562 | ||
| 568 | (defun form-at-point (&optional thing pred) | 563 | (defun form-at-point (&optional thing pred) |
| 569 | (let ((sexp (condition-case nil | 564 | (let ((sexp (ignore-errors |
| 570 | (read-from-whole-string (thing-at-point (or thing 'sexp))) | 565 | (read-from-whole-string (thing-at-point (or thing 'sexp)))))) |
| 571 | (error nil)))) | ||
| 572 | (if (or (not pred) (funcall pred sexp)) sexp))) | 566 | (if (or (not pred) (funcall pred sexp)) sexp))) |
| 573 | 567 | ||
| 574 | ;;;###autoload | 568 | ;;;###autoload |