diff options
| author | Alan Mackenzie | 2017-02-12 10:59:03 +0000 |
|---|---|---|
| committer | Alan Mackenzie | 2017-02-12 10:59:03 +0000 |
| commit | f4d5b687150810129b7a1d5b006e31ccf82b691b (patch) | |
| tree | 4229b13800349032697daae3904dc3773e6b7a80 /lisp | |
| parent | d5514332d4a6092673ce1f78fadcae0c57f7be64 (diff) | |
| parent | 148100d98319499f0ac6f57b8be08cbd14884a5c (diff) | |
| download | emacs-comment-cache.tar.gz emacs-comment-cache.zip | |
Merge branch 'master' into comment-cachecomment-cache
Diffstat (limited to 'lisp')
71 files changed, 1494 insertions, 910 deletions
diff --git a/lisp/auth-source.el b/lisp/auth-source.el index c26935fcc97..7402ab21d74 100644 --- a/lisp/auth-source.el +++ b/lisp/auth-source.el | |||
| @@ -2129,7 +2129,7 @@ MODE can be \"login\" or \"password\"." | |||
| 2129 | (if user | 2129 | (if user |
| 2130 | (auth-source-search | 2130 | (auth-source-search |
| 2131 | :host host | 2131 | :host host |
| 2132 | :user "yourusername" | 2132 | :user user |
| 2133 | :max 1 | 2133 | :max 1 |
| 2134 | :require '(:user :secret) | 2134 | :require '(:user :secret) |
| 2135 | :create nil) | 2135 | :create nil) |
diff --git a/lisp/battery.el b/lisp/battery.el index 71268e59ecd..b1834f06ff8 100644 --- a/lisp/battery.el +++ b/lisp/battery.el | |||
| @@ -542,6 +542,9 @@ The following %-sequences are provided: | |||
| 542 | (t "N/A")))))) | 542 | (t "N/A")))))) |
| 543 | 543 | ||
| 544 | 544 | ||
| 545 | (declare-function dbus-get-property "dbus.el" | ||
| 546 | (bus service path interface property)) | ||
| 547 | |||
| 545 | ;;; `upowerd' interface. | 548 | ;;; `upowerd' interface. |
| 546 | (defsubst battery-upower-prop (pname &optional device) | 549 | (defsubst battery-upower-prop (pname &optional device) |
| 547 | (dbus-get-property | 550 | (dbus-get-property |
diff --git a/lisp/buff-menu.el b/lisp/buff-menu.el index 77b325ff25d..9f618bcb7de 100644 --- a/lisp/buff-menu.el +++ b/lisp/buff-menu.el | |||
| @@ -102,9 +102,6 @@ This is set by the prefix argument to `buffer-menu' and related | |||
| 102 | commands.") | 102 | commands.") |
| 103 | (make-variable-buffer-local 'Buffer-menu-files-only) | 103 | (make-variable-buffer-local 'Buffer-menu-files-only) |
| 104 | 104 | ||
| 105 | (defvar Info-current-file) ; from info.el | ||
| 106 | (defvar Info-current-node) ; from info.el | ||
| 107 | |||
| 108 | (defvar Buffer-menu-mode-map | 105 | (defvar Buffer-menu-mode-map |
| 109 | (let ((map (make-sparse-keymap)) | 106 | (let ((map (make-sparse-keymap)) |
| 110 | (menu-map (make-sparse-keymap))) | 107 | (menu-map (make-sparse-keymap))) |
| @@ -702,21 +699,7 @@ means list those buffers and no others." | |||
| 702 | (defun Buffer-menu--pretty-file-name (file) | 699 | (defun Buffer-menu--pretty-file-name (file) |
| 703 | (cond (file | 700 | (cond (file |
| 704 | (abbreviate-file-name file)) | 701 | (abbreviate-file-name file)) |
| 705 | ((and (boundp 'list-buffers-directory) | 702 | ((bound-and-true-p list-buffers-directory)) |
| 706 | list-buffers-directory) | ||
| 707 | list-buffers-directory) | ||
| 708 | ((eq major-mode 'Info-mode) | ||
| 709 | (Buffer-menu-info-node-description Info-current-file)) | ||
| 710 | (t ""))) | 703 | (t ""))) |
| 711 | 704 | ||
| 712 | (defun Buffer-menu-info-node-description (file) | ||
| 713 | (cond | ||
| 714 | ((equal file "dir") "*Info Directory*") | ||
| 715 | ((eq file 'apropos) "*Info Apropos*") | ||
| 716 | ((eq file 'history) "*Info History*") | ||
| 717 | ((eq file 'toc) "*Info TOC*") | ||
| 718 | ((not (stringp file)) "") ; Avoid errors | ||
| 719 | (t | ||
| 720 | (concat "(" (file-name-nondirectory file) ") " Info-current-node)))) | ||
| 721 | |||
| 722 | ;;; buff-menu.el ends here | 705 | ;;; buff-menu.el ends here |
diff --git a/lisp/calc/calc-misc.el b/lisp/calc/calc-misc.el index 7b7a7208aaa..e6af0920639 100644 --- a/lisp/calc/calc-misc.el +++ b/lisp/calc/calc-misc.el | |||
| @@ -623,7 +623,7 @@ loaded and the keystroke automatically re-typed." | |||
| 623 | (unwind-protect | 623 | (unwind-protect |
| 624 | (progn | 624 | (progn |
| 625 | (sit-for 2) | 625 | (sit-for 2) |
| 626 | (identity 1) ; this forces a call to QUIT; in bytecode.c. | 626 | (identity 1) ; This forces a call to maybe_quit in bytecode.c. |
| 627 | (setq okay t)) | 627 | (setq okay t)) |
| 628 | (progn | 628 | (progn |
| 629 | (delete-region savemax (point-max)) | 629 | (delete-region savemax (point-max)) |
diff --git a/lisp/calendar/parse-time.el b/lisp/calendar/parse-time.el index 7651c5da1f4..b781cb0eb48 100644 --- a/lisp/calendar/parse-time.el +++ b/lisp/calendar/parse-time.el | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | ;;; parse-time.el --- parsing time strings | 1 | ;;; parse-time.el --- parsing time strings -*- lexical-binding: t -*- |
| 2 | 2 | ||
| 3 | ;; Copyright (C) 1996, 2000-2017 Free Software Foundation, Inc. | 3 | ;; Copyright (C) 1996, 2000-2017 Free Software Foundation, Inc. |
| 4 | 4 | ||
| @@ -203,12 +203,9 @@ any values that are unknown are returned as nil." | |||
| 203 | (time-second 2digit) | 203 | (time-second 2digit) |
| 204 | (time-secfrac "\\(\\.[0-9]+\\)?") | 204 | (time-secfrac "\\(\\.[0-9]+\\)?") |
| 205 | (time-numoffset (concat "\\([-+]\\)" time-hour ":?" time-minute "?")) | 205 | (time-numoffset (concat "\\([-+]\\)" time-hour ":?" time-minute "?")) |
| 206 | (time-offset (concat "Z" time-numoffset)) | ||
| 207 | (partial-time (concat time-hour colon time-minute colon time-second | 206 | (partial-time (concat time-hour colon time-minute colon time-second |
| 208 | time-secfrac)) | 207 | time-secfrac)) |
| 209 | (full-date (concat date-fullyear dash date-month dash date-mday)) | 208 | (full-date (concat date-fullyear dash date-month dash date-mday))) |
| 210 | (full-time (concat partial-time time-offset)) | ||
| 211 | (date-time (concat full-date "T" full-time))) | ||
| 212 | (list (concat "^" full-date) | 209 | (list (concat "^" full-date) |
| 213 | (concat "T" partial-time) | 210 | (concat "T" partial-time) |
| 214 | (concat "\\(Z\\|" time-numoffset "\\)"))) | 211 | (concat "\\(Z\\|" time-numoffset "\\)"))) |
| @@ -225,7 +222,7 @@ If DATE-STRING cannot be parsed, it falls back to | |||
| 225 | (time-re (nth 1 parse-time-iso8601-regexp)) | 222 | (time-re (nth 1 parse-time-iso8601-regexp)) |
| 226 | (tz-re (nth 2 parse-time-iso8601-regexp)) | 223 | (tz-re (nth 2 parse-time-iso8601-regexp)) |
| 227 | re-start | 224 | re-start |
| 228 | time seconds minute hour fractional-seconds | 225 | time seconds minute hour |
| 229 | day month year day-of-week dst tz) | 226 | day month year day-of-week dst tz) |
| 230 | ;; We need to populate 'time' with | 227 | ;; We need to populate 'time' with |
| 231 | ;; (SEC MIN HOUR DAY MON YEAR DOW DST TZ) | 228 | ;; (SEC MIN HOUR DAY MON YEAR DOW DST TZ) |
| @@ -240,9 +237,6 @@ If DATE-STRING cannot be parsed, it falls back to | |||
| 240 | (setq hour (string-to-number (match-string 1 date-string)) | 237 | (setq hour (string-to-number (match-string 1 date-string)) |
| 241 | minute (string-to-number (match-string 2 date-string)) | 238 | minute (string-to-number (match-string 2 date-string)) |
| 242 | seconds (string-to-number (match-string 3 date-string)) | 239 | seconds (string-to-number (match-string 3 date-string)) |
| 243 | fractional-seconds (string-to-number (or | ||
| 244 | (match-string 4 date-string) | ||
| 245 | "0")) | ||
| 246 | re-start (match-end 0)) | 240 | re-start (match-end 0)) |
| 247 | (when (string-match tz-re date-string re-start) | 241 | (when (string-match tz-re date-string re-start) |
| 248 | (if (string= "Z" (match-string 1 date-string)) | 242 | (if (string= "Z" (match-string 1 date-string)) |
diff --git a/lisp/cus-start.el b/lisp/cus-start.el index a790419b86f..51c43c7d21a 100644 --- a/lisp/cus-start.el +++ b/lisp/cus-start.el | |||
| @@ -511,6 +511,7 @@ since it could result in memory overflow and make Emacs crash." | |||
| 511 | (scroll-step windows integer) | 511 | (scroll-step windows integer) |
| 512 | (scroll-conservatively windows integer) | 512 | (scroll-conservatively windows integer) |
| 513 | (scroll-margin windows integer) | 513 | (scroll-margin windows integer) |
| 514 | (maximum-scroll-margin windows float "26.1") | ||
| 514 | (hscroll-margin windows integer "22.1") | 515 | (hscroll-margin windows integer "22.1") |
| 515 | (hscroll-step windows number "22.1") | 516 | (hscroll-step windows number "22.1") |
| 516 | (truncate-partial-width-windows | 517 | (truncate-partial-width-windows |
diff --git a/lisp/dired-aux.el b/lisp/dired-aux.el index cabcfcdbd3f..caa3b45705b 100644 --- a/lisp/dired-aux.el +++ b/lisp/dired-aux.el | |||
| @@ -987,6 +987,8 @@ corresponding command. | |||
| 987 | Within CMD, %i denotes the input file(s), and %o denotes the | 987 | Within CMD, %i denotes the input file(s), and %o denotes the |
| 988 | output file. %i path(s) are relative, while %o is absolute.") | 988 | output file. %i path(s) are relative, while %o is absolute.") |
| 989 | 989 | ||
| 990 | (declare-function format-spec "format-spec.el" (format specification)) | ||
| 991 | |||
| 990 | ;;;###autoload | 992 | ;;;###autoload |
| 991 | (defun dired-do-compress-to () | 993 | (defun dired-do-compress-to () |
| 992 | "Compress selected files and directories to an archive. | 994 | "Compress selected files and directories to an archive. |
diff --git a/lisp/dired.el b/lisp/dired.el index 350f6a7d2e3..2733372eb7b 100644 --- a/lisp/dired.el +++ b/lisp/dired.el | |||
| @@ -59,6 +59,10 @@ | |||
| 59 | May contain all other options that don't contradict `-l'; | 59 | May contain all other options that don't contradict `-l'; |
| 60 | may contain even `F', `b', `i' and `s'. See also the variable | 60 | may contain even `F', `b', `i' and `s'. See also the variable |
| 61 | `dired-ls-F-marks-symlinks' concerning the `F' switch. | 61 | `dired-ls-F-marks-symlinks' concerning the `F' switch. |
| 62 | Options that include embedded whitespace must be quoted | ||
| 63 | like this: \\\"--option=value with spaces\\\"; you can use | ||
| 64 | `combine-and-quote-strings' to produce the correct quoting of | ||
| 65 | each option. | ||
| 62 | On systems such as MS-DOS and MS-Windows, which use `ls' emulation in Lisp, | 66 | On systems such as MS-DOS and MS-Windows, which use `ls' emulation in Lisp, |
| 63 | some of the `ls' switches are not supported; see the doc string of | 67 | some of the `ls' switches are not supported; see the doc string of |
| 64 | `insert-directory' in `ls-lisp.el' for more details." | 68 | `insert-directory' in `ls-lisp.el' for more details." |
diff --git a/lisp/doc-view.el b/lisp/doc-view.el index 2c11cd23a7f..172ea163c18 100644 --- a/lisp/doc-view.el +++ b/lisp/doc-view.el | |||
| @@ -442,6 +442,9 @@ Typically \"page-%s.png\".") | |||
| 442 | (defun doc-view-revert-buffer (&optional ignore-auto noconfirm) | 442 | (defun doc-view-revert-buffer (&optional ignore-auto noconfirm) |
| 443 | "Like `revert-buffer', but preserves the buffer's current modes." | 443 | "Like `revert-buffer', but preserves the buffer's current modes." |
| 444 | (interactive (list (not current-prefix-arg))) | 444 | (interactive (list (not current-prefix-arg))) |
| 445 | (if (< undo-outer-limit (* 2 (buffer-size))) | ||
| 446 | ;; It's normal for this operation to result in a very large undo entry. | ||
| 447 | (setq-local undo-outer-limit (* 2 (buffer-size)))) | ||
| 445 | (cl-labels ((revert () | 448 | (cl-labels ((revert () |
| 446 | (let (revert-buffer-function) | 449 | (let (revert-buffer-function) |
| 447 | (revert-buffer ignore-auto noconfirm 'preserve-modes)))) | 450 | (revert-buffer ignore-auto noconfirm 'preserve-modes)))) |
| @@ -1763,6 +1766,8 @@ toggle between displaying the document or editing it as text. | |||
| 1763 | (unless doc-view-doc-type | 1766 | (unless doc-view-doc-type |
| 1764 | (doc-view-set-doc-type)) | 1767 | (doc-view-set-doc-type)) |
| 1765 | (doc-view-set-up-single-converter) | 1768 | (doc-view-set-up-single-converter) |
| 1769 | (unless (memq doc-view-doc-type '(ps)) | ||
| 1770 | (setq-local require-final-newline nil)) | ||
| 1766 | 1771 | ||
| 1767 | (doc-view-make-safe-dir doc-view-cache-directory) | 1772 | (doc-view-make-safe-dir doc-view-cache-directory) |
| 1768 | ;; Handle compressed files, remote files, files inside archives | 1773 | ;; Handle compressed files, remote files, files inside archives |
diff --git a/lisp/emacs-lisp/backquote.el b/lisp/emacs-lisp/backquote.el index 94c561cba0a..bb877dd2c97 100644 --- a/lisp/emacs-lisp/backquote.el +++ b/lisp/emacs-lisp/backquote.el | |||
| @@ -247,4 +247,14 @@ LEVEL is only used internally and indicates the nesting level: | |||
| 247 | tail)) | 247 | tail)) |
| 248 | (t (cons 'list heads))))) | 248 | (t (cons 'list heads))))) |
| 249 | 249 | ||
| 250 | |||
| 251 | ;; Give `,' and `,@' documentation strings which can be examined by C-h f. | ||
| 252 | (put '\, 'function-documentation | ||
| 253 | "See `\\=`' (also `pcase') for the usage of `,'.") | ||
| 254 | (put '\, 'reader-construct t) | ||
| 255 | |||
| 256 | (put '\,@ 'function-documentation | ||
| 257 | "See `\\=`' for the usage of `,@'.") | ||
| 258 | (put '\,@ 'reader-construct t) | ||
| 259 | |||
| 250 | ;;; backquote.el ends here | 260 | ;;; backquote.el ends here |
diff --git a/lisp/emacs-lisp/cl-generic.el b/lisp/emacs-lisp/cl-generic.el index 8d141d7a646..6cc70c4c2f5 100644 --- a/lisp/emacs-lisp/cl-generic.el +++ b/lisp/emacs-lisp/cl-generic.el | |||
| @@ -226,7 +226,13 @@ DEFAULT-BODY, if present, is used as the body of a default method. | |||
| 226 | (when (eq 'setf (car-safe name)) | 226 | (when (eq 'setf (car-safe name)) |
| 227 | (require 'gv) | 227 | (require 'gv) |
| 228 | (setq name (gv-setter (cadr name)))) | 228 | (setq name (gv-setter (cadr name)))) |
| 229 | `(progn | 229 | `(prog1 |
| 230 | (progn | ||
| 231 | (defalias ',name | ||
| 232 | (cl-generic-define ',name ',args ',(nreverse options)) | ||
| 233 | ,(help-add-fundoc-usage doc args)) | ||
| 234 | ,@(mapcar (lambda (method) `(cl-defmethod ,name ,@method)) | ||
| 235 | (nreverse methods))) | ||
| 230 | ,@(mapcar (lambda (declaration) | 236 | ,@(mapcar (lambda (declaration) |
| 231 | (let ((f (cdr (assq (car declaration) | 237 | (let ((f (cdr (assq (car declaration) |
| 232 | defun-declarations-alist)))) | 238 | defun-declarations-alist)))) |
| @@ -235,12 +241,7 @@ DEFAULT-BODY, if present, is used as the body of a default method. | |||
| 235 | (t (message "Warning: Unknown defun property `%S' in %S" | 241 | (t (message "Warning: Unknown defun property `%S' in %S" |
| 236 | (car declaration) name) | 242 | (car declaration) name) |
| 237 | nil)))) | 243 | nil)))) |
| 238 | (cdr declarations)) | 244 | (cdr declarations))))) |
| 239 | (defalias ',name | ||
| 240 | (cl-generic-define ',name ',args ',(nreverse options)) | ||
| 241 | ,(help-add-fundoc-usage doc args)) | ||
| 242 | ,@(mapcar (lambda (method) `(cl-defmethod ,name ,@method)) | ||
| 243 | (nreverse methods))))) | ||
| 244 | 245 | ||
| 245 | ;;;###autoload | 246 | ;;;###autoload |
| 246 | (defun cl-generic-define (name args options) | 247 | (defun cl-generic-define (name args options) |
diff --git a/lisp/emacs-lisp/cl-lib.el b/lisp/emacs-lisp/cl-lib.el index b1db07fe165..5aa8f1bf652 100644 --- a/lisp/emacs-lisp/cl-lib.el +++ b/lisp/emacs-lisp/cl-lib.el | |||
| @@ -413,125 +413,30 @@ Signal an error if X is not a list." | |||
| 413 | (declare (gv-setter (lambda (store) `(setcar (nthcdr 9 ,x) ,store)))) | 413 | (declare (gv-setter (lambda (store) `(setcar (nthcdr 9 ,x) ,store)))) |
| 414 | (nth 9 x)) | 414 | (nth 9 x)) |
| 415 | 415 | ||
| 416 | (defun cl-caaar (x) | 416 | (defalias 'cl-caaar 'caaar) |
| 417 | "Return the `car' of the `car' of the `car' of X." | 417 | (defalias 'cl-caadr 'caadr) |
| 418 | (declare (compiler-macro internal--compiler-macro-cXXr)) | 418 | (defalias 'cl-cadar 'cadar) |
| 419 | (car (car (car x)))) | 419 | (defalias 'cl-caddr 'caddr) |
| 420 | 420 | (defalias 'cl-cdaar 'cdaar) | |
| 421 | (defun cl-caadr (x) | 421 | (defalias 'cl-cdadr 'cdadr) |
| 422 | "Return the `car' of the `car' of the `cdr' of X." | 422 | (defalias 'cl-cddar 'cddar) |
| 423 | (declare (compiler-macro internal--compiler-macro-cXXr)) | 423 | (defalias 'cl-cdddr 'cdddr) |
| 424 | (car (car (cdr x)))) | 424 | (defalias 'cl-caaaar 'caaaar) |
| 425 | 425 | (defalias 'cl-caaadr 'caaadr) | |
| 426 | (defun cl-cadar (x) | 426 | (defalias 'cl-caadar 'caadar) |
| 427 | "Return the `car' of the `cdr' of the `car' of X." | 427 | (defalias 'cl-caaddr 'caaddr) |
| 428 | (declare (compiler-macro internal--compiler-macro-cXXr)) | 428 | (defalias 'cl-cadaar 'cadaar) |
| 429 | (car (cdr (car x)))) | 429 | (defalias 'cl-cadadr 'cadadr) |
| 430 | 430 | (defalias 'cl-caddar 'caddar) | |
| 431 | (defun cl-caddr (x) | 431 | (defalias 'cl-cadddr 'cadddr) |
| 432 | "Return the `car' of the `cdr' of the `cdr' of X." | 432 | (defalias 'cl-cdaaar 'cdaaar) |
| 433 | (declare (compiler-macro internal--compiler-macro-cXXr)) | 433 | (defalias 'cl-cdaadr 'cdaadr) |
| 434 | (car (cdr (cdr x)))) | 434 | (defalias 'cl-cdadar 'cdadar) |
| 435 | 435 | (defalias 'cl-cdaddr 'cdaddr) | |
| 436 | (defun cl-cdaar (x) | 436 | (defalias 'cl-cddaar 'cddaar) |
| 437 | "Return the `cdr' of the `car' of the `car' of X." | 437 | (defalias 'cl-cddadr 'cddadr) |
| 438 | (declare (compiler-macro internal--compiler-macro-cXXr)) | 438 | (defalias 'cl-cdddar 'cdddar) |
| 439 | (cdr (car (car x)))) | 439 | (defalias 'cl-cddddr 'cddddr) |
| 440 | |||
| 441 | (defun cl-cdadr (x) | ||
| 442 | "Return the `cdr' of the `car' of the `cdr' of X." | ||
| 443 | (declare (compiler-macro internal--compiler-macro-cXXr)) | ||
| 444 | (cdr (car (cdr x)))) | ||
| 445 | |||
| 446 | (defun cl-cddar (x) | ||
| 447 | "Return the `cdr' of the `cdr' of the `car' of X." | ||
| 448 | (declare (compiler-macro internal--compiler-macro-cXXr)) | ||
| 449 | (cdr (cdr (car x)))) | ||
| 450 | |||
| 451 | (defun cl-cdddr (x) | ||
| 452 | "Return the `cdr' of the `cdr' of the `cdr' of X." | ||
| 453 | (declare (compiler-macro internal--compiler-macro-cXXr)) | ||
| 454 | (cdr (cdr (cdr x)))) | ||
| 455 | |||
| 456 | (defun cl-caaaar (x) | ||
| 457 | "Return the `car' of the `car' of the `car' of the `car' of X." | ||
| 458 | (declare (compiler-macro internal--compiler-macro-cXXr)) | ||
| 459 | (car (car (car (car x))))) | ||
| 460 | |||
| 461 | (defun cl-caaadr (x) | ||
| 462 | "Return the `car' of the `car' of the `car' of the `cdr' of X." | ||
| 463 | (declare (compiler-macro internal--compiler-macro-cXXr)) | ||
| 464 | (car (car (car (cdr x))))) | ||
| 465 | |||
| 466 | (defun cl-caadar (x) | ||
| 467 | "Return the `car' of the `car' of the `cdr' of the `car' of X." | ||
| 468 | (declare (compiler-macro internal--compiler-macro-cXXr)) | ||
| 469 | (car (car (cdr (car x))))) | ||
| 470 | |||
| 471 | (defun cl-caaddr (x) | ||
| 472 | "Return the `car' of the `car' of the `cdr' of the `cdr' of X." | ||
| 473 | (declare (compiler-macro internal--compiler-macro-cXXr)) | ||
| 474 | (car (car (cdr (cdr x))))) | ||
| 475 | |||
| 476 | (defun cl-cadaar (x) | ||
| 477 | "Return the `car' of the `cdr' of the `car' of the `car' of X." | ||
| 478 | (declare (compiler-macro internal--compiler-macro-cXXr)) | ||
| 479 | (car (cdr (car (car x))))) | ||
| 480 | |||
| 481 | (defun cl-cadadr (x) | ||
| 482 | "Return the `car' of the `cdr' of the `car' of the `cdr' of X." | ||
| 483 | (declare (compiler-macro internal--compiler-macro-cXXr)) | ||
| 484 | (car (cdr (car (cdr x))))) | ||
| 485 | |||
| 486 | (defun cl-caddar (x) | ||
| 487 | "Return the `car' of the `cdr' of the `cdr' of the `car' of X." | ||
| 488 | (declare (compiler-macro internal--compiler-macro-cXXr)) | ||
| 489 | (car (cdr (cdr (car x))))) | ||
| 490 | |||
| 491 | (defun cl-cadddr (x) | ||
| 492 | "Return the `car' of the `cdr' of the `cdr' of the `cdr' of X." | ||
| 493 | (declare (compiler-macro internal--compiler-macro-cXXr)) | ||
| 494 | (car (cdr (cdr (cdr x))))) | ||
| 495 | |||
| 496 | (defun cl-cdaaar (x) | ||
| 497 | "Return the `cdr' of the `car' of the `car' of the `car' of X." | ||
| 498 | (declare (compiler-macro internal--compiler-macro-cXXr)) | ||
| 499 | (cdr (car (car (car x))))) | ||
| 500 | |||
| 501 | (defun cl-cdaadr (x) | ||
| 502 | "Return the `cdr' of the `car' of the `car' of the `cdr' of X." | ||
| 503 | (declare (compiler-macro internal--compiler-macro-cXXr)) | ||
| 504 | (cdr (car (car (cdr x))))) | ||
| 505 | |||
| 506 | (defun cl-cdadar (x) | ||
| 507 | "Return the `cdr' of the `car' of the `cdr' of the `car' of X." | ||
| 508 | (declare (compiler-macro internal--compiler-macro-cXXr)) | ||
| 509 | (cdr (car (cdr (car x))))) | ||
| 510 | |||
| 511 | (defun cl-cdaddr (x) | ||
| 512 | "Return the `cdr' of the `car' of the `cdr' of the `cdr' of X." | ||
| 513 | (declare (compiler-macro internal--compiler-macro-cXXr)) | ||
| 514 | (cdr (car (cdr (cdr x))))) | ||
| 515 | |||
| 516 | (defun cl-cddaar (x) | ||
| 517 | "Return the `cdr' of the `cdr' of the `car' of the `car' of X." | ||
| 518 | (declare (compiler-macro internal--compiler-macro-cXXr)) | ||
| 519 | (cdr (cdr (car (car x))))) | ||
| 520 | |||
| 521 | (defun cl-cddadr (x) | ||
| 522 | "Return the `cdr' of the `cdr' of the `car' of the `cdr' of X." | ||
| 523 | (declare (compiler-macro internal--compiler-macro-cXXr)) | ||
| 524 | (cdr (cdr (car (cdr x))))) | ||
| 525 | |||
| 526 | (defun cl-cdddar (x) | ||
| 527 | "Return the `cdr' of the `cdr' of the `cdr' of the `car' of X." | ||
| 528 | (declare (compiler-macro internal--compiler-macro-cXXr)) | ||
| 529 | (cdr (cdr (cdr (car x))))) | ||
| 530 | |||
| 531 | (defun cl-cddddr (x) | ||
| 532 | "Return the `cdr' of the `cdr' of the `cdr' of the `cdr' of X." | ||
| 533 | (declare (compiler-macro internal--compiler-macro-cXXr)) | ||
| 534 | (cdr (cdr (cdr (cdr x))))) | ||
| 535 | 440 | ||
| 536 | ;;(defun last* (x &optional n) | 441 | ;;(defun last* (x &optional n) |
| 537 | ;; "Returns the last link in the list LIST. | 442 | ;; "Returns the last link in the list LIST. |
diff --git a/lisp/emacs-lisp/cl.el b/lisp/emacs-lisp/cl.el index e33a603d1b0..73eb9a4e866 100644 --- a/lisp/emacs-lisp/cl.el +++ b/lisp/emacs-lisp/cl.el | |||
| @@ -258,30 +258,6 @@ | |||
| 258 | copy-list | 258 | copy-list |
| 259 | ldiff | 259 | ldiff |
| 260 | list* | 260 | list* |
| 261 | cddddr | ||
| 262 | cdddar | ||
| 263 | cddadr | ||
| 264 | cddaar | ||
| 265 | cdaddr | ||
| 266 | cdadar | ||
| 267 | cdaadr | ||
| 268 | cdaaar | ||
| 269 | cadddr | ||
| 270 | caddar | ||
| 271 | cadadr | ||
| 272 | cadaar | ||
| 273 | caaddr | ||
| 274 | caadar | ||
| 275 | caaadr | ||
| 276 | caaaar | ||
| 277 | cdddr | ||
| 278 | cddar | ||
| 279 | cdadr | ||
| 280 | cdaar | ||
| 281 | caddr | ||
| 282 | cadar | ||
| 283 | caadr | ||
| 284 | caaar | ||
| 285 | tenth | 261 | tenth |
| 286 | ninth | 262 | ninth |
| 287 | eighth | 263 | eighth |
diff --git a/lisp/emacs-lisp/edebug.el b/lisp/emacs-lisp/edebug.el index db54d1eeb20..ec0f08de356 100644 --- a/lisp/emacs-lisp/edebug.el +++ b/lisp/emacs-lisp/edebug.el | |||
| @@ -112,6 +112,18 @@ and some not, use `def-edebug-spec' to specify an `edebug-form-spec'." | |||
| 112 | :type 'boolean | 112 | :type 'boolean |
| 113 | :group 'edebug) | 113 | :group 'edebug) |
| 114 | 114 | ||
| 115 | (defcustom edebug-max-depth 150 | ||
| 116 | "Maximum recursion depth when instrumenting code. | ||
| 117 | This limit is intended to stop recursion if an Edebug specification | ||
| 118 | contains an infinite loop. When Edebug is instrumenting code | ||
| 119 | containing very large quoted lists, it may reach this limit and give | ||
| 120 | the error message \"Too deep - perhaps infinite loop in spec?\". | ||
| 121 | Make this limit larger to countermand that, but you may also need to | ||
| 122 | increase `max-lisp-eval-depth' and `max-specpdl-size'." | ||
| 123 | :type 'integer | ||
| 124 | :group 'edebug | ||
| 125 | :version "26.1") | ||
| 126 | |||
| 115 | (defcustom edebug-save-windows t | 127 | (defcustom edebug-save-windows t |
| 116 | "If non-nil, Edebug saves and restores the window configuration. | 128 | "If non-nil, Edebug saves and restores the window configuration. |
| 117 | That takes some time, so if your program does not care what happens to | 129 | That takes some time, so if your program does not care what happens to |
| @@ -1452,7 +1464,6 @@ expressions; a `progn' form will be returned enclosing these forms." | |||
| 1452 | (defvar edebug-after-dotted-spec nil) | 1464 | (defvar edebug-after-dotted-spec nil) |
| 1453 | 1465 | ||
| 1454 | (defvar edebug-matching-depth 0) ;; initial value | 1466 | (defvar edebug-matching-depth 0) ;; initial value |
| 1455 | (defconst edebug-max-depth 150) ;; maximum number of matching recursions. | ||
| 1456 | 1467 | ||
| 1457 | 1468 | ||
| 1458 | ;;; Failure to match | 1469 | ;;; Failure to match |
diff --git a/lisp/emacs-lisp/ert-x.el b/lisp/emacs-lisp/ert-x.el index 7d99cb30274..4cf9d9609e9 100644 --- a/lisp/emacs-lisp/ert-x.el +++ b/lisp/emacs-lisp/ert-x.el | |||
| @@ -97,7 +97,7 @@ To be used in ERT tests. If BODY finishes successfully, the test | |||
| 97 | buffer is killed; if there is an error, the test buffer is kept | 97 | buffer is killed; if there is an error, the test buffer is kept |
| 98 | around on error for further inspection. Its name is derived from | 98 | around on error for further inspection. Its name is derived from |
| 99 | the name of the test and the result of NAME-FORM." | 99 | the name of the test and the result of NAME-FORM." |
| 100 | (declare (debug ((form) body)) | 100 | (declare (debug ((":name" form) body)) |
| 101 | (indent 1)) | 101 | (indent 1)) |
| 102 | `(ert--call-with-test-buffer ,name-form (lambda () ,@body))) | 102 | `(ert--call-with-test-buffer ,name-form (lambda () ,@body))) |
| 103 | 103 | ||
| @@ -285,6 +285,30 @@ BUFFER defaults to current buffer. Does not modify BUFFER." | |||
| 285 | (kill-buffer clone))))))) | 285 | (kill-buffer clone))))))) |
| 286 | 286 | ||
| 287 | 287 | ||
| 288 | (defmacro ert-with-message-capture (var &rest body) | ||
| 289 | "Execute BODY while collecting anything written with `message' in VAR. | ||
| 290 | |||
| 291 | Capture all messages produced by `message' when it is called from | ||
| 292 | Lisp, and concatenate them separated by newlines into one string. | ||
| 293 | |||
| 294 | This is useful for separating the issuance of messages by the | ||
| 295 | code under test from the behavior of the *Messages* buffer." | ||
| 296 | (declare (debug (symbolp body)) | ||
| 297 | (indent 1)) | ||
| 298 | (let ((g-advice (cl-gensym))) | ||
| 299 | `(let* ((,var "") | ||
| 300 | (,g-advice (lambda (func &rest args) | ||
| 301 | (if (or (null args) (equal (car args) "")) | ||
| 302 | (apply func args) | ||
| 303 | (let ((msg (apply #'format-message args))) | ||
| 304 | (setq ,var (concat ,var msg "\n")) | ||
| 305 | (funcall func "%s" msg)))))) | ||
| 306 | (advice-add 'message :around ,g-advice) | ||
| 307 | (unwind-protect | ||
| 308 | (progn ,@body) | ||
| 309 | (advice-remove 'message ,g-advice))))) | ||
| 310 | |||
| 311 | |||
| 288 | (provide 'ert-x) | 312 | (provide 'ert-x) |
| 289 | 313 | ||
| 290 | ;;; ert-x.el ends here | 314 | ;;; ert-x.el ends here |
diff --git a/lisp/emacs-lisp/let-alist.el b/lisp/emacs-lisp/let-alist.el index a45fc0a05c3..cf82fe3ec63 100644 --- a/lisp/emacs-lisp/let-alist.el +++ b/lisp/emacs-lisp/let-alist.el | |||
| @@ -4,7 +4,7 @@ | |||
| 4 | 4 | ||
| 5 | ;; Author: Artur Malabarba <emacs@endlessparentheses.com> | 5 | ;; Author: Artur Malabarba <emacs@endlessparentheses.com> |
| 6 | ;; Package-Requires: ((emacs "24.1")) | 6 | ;; Package-Requires: ((emacs "24.1")) |
| 7 | ;; Version: 1.0.4 | 7 | ;; Version: 1.0.5 |
| 8 | ;; Keywords: extensions lisp | 8 | ;; Keywords: extensions lisp |
| 9 | ;; Prefix: let-alist | 9 | ;; Prefix: let-alist |
| 10 | ;; Separator: - | 10 | ;; Separator: - |
diff --git a/lisp/emacs-lisp/pcase.el b/lisp/emacs-lisp/pcase.el index 54678c5f324..46a5eedd150 100644 --- a/lisp/emacs-lisp/pcase.el +++ b/lisp/emacs-lisp/pcase.el | |||
| @@ -89,7 +89,8 @@ | |||
| 89 | (functionp &rest form) | 89 | (functionp &rest form) |
| 90 | sexp)) | 90 | sexp)) |
| 91 | 91 | ||
| 92 | (def-edebug-spec pcase-MACRO pcase--edebug-match-macro) | 92 | ;; See bug#24717 |
| 93 | (put 'pcase-MACRO 'edebug-form-spec 'pcase--edebug-match-macro) | ||
| 93 | 94 | ||
| 94 | ;; Only called from edebug. | 95 | ;; Only called from edebug. |
| 95 | (declare-function get-edebug-spec "edebug" (symbol)) | 96 | (declare-function get-edebug-spec "edebug" (symbol)) |
diff --git a/lisp/emacs-lisp/subr-x.el b/lisp/emacs-lisp/subr-x.el index 7736225b5fa..f7a846927c0 100644 --- a/lisp/emacs-lisp/subr-x.el +++ b/lisp/emacs-lisp/subr-x.el | |||
| @@ -115,12 +115,16 @@ threading." | |||
| 115 | binding)) | 115 | binding)) |
| 116 | bindings))) | 116 | bindings))) |
| 117 | 117 | ||
| 118 | (defmacro if-let (bindings then &rest else) | 118 | (defmacro if-let* (bindings then &rest else) |
| 119 | "Process BINDINGS and if all values are non-nil eval THEN, else ELSE. | 119 | "Bind variables according to VARLIST and eval THEN or ELSE. |
| 120 | Argument BINDINGS is a list of tuples whose car is a symbol to be | 120 | Each binding is evaluated in turn with `let*', and evaluation |
| 121 | bound and (optionally) used in THEN, and its cadr is a sexp to be | 121 | stops if a binding value is nil. If all are non-nil, the value |
| 122 | evalled to set symbol's value. In the special case you only want | 122 | of THEN is returned, or the last form in ELSE is returned. |
| 123 | to bind a single value, BINDINGS can just be a plain tuple." | 123 | Each element of VARLIST is a symbol (which is bound to nil) |
| 124 | or a list (SYMBOL VALUEFORM) (which binds SYMBOL to the value of VALUEFORM). | ||
| 125 | In the special case you only want to bind a single value, | ||
| 126 | VARLIST can just be a plain tuple. | ||
| 127 | \n(fn VARLIST THEN ELSE...)" | ||
| 124 | (declare (indent 2) | 128 | (declare (indent 2) |
| 125 | (debug ([&or (&rest (symbolp form)) (symbolp form)] form body))) | 129 | (debug ([&or (&rest (symbolp form)) (symbolp form)] form body))) |
| 126 | (when (and (<= (length bindings) 2) | 130 | (when (and (<= (length bindings) 2) |
| @@ -132,15 +136,23 @@ to bind a single value, BINDINGS can just be a plain tuple." | |||
| 132 | ,then | 136 | ,then |
| 133 | ,@else))) | 137 | ,@else))) |
| 134 | 138 | ||
| 135 | (defmacro when-let (bindings &rest body) | 139 | (defmacro when-let* (bindings &rest body) |
| 136 | "Process BINDINGS and if all values are non-nil eval BODY. | 140 | "Bind variables according to VARLIST and conditionally eval BODY. |
| 137 | Argument BINDINGS is a list of tuples whose car is a symbol to be | 141 | Each binding is evaluated in turn with `let*', and evaluation |
| 138 | bound and (optionally) used in BODY, and its cadr is a sexp to be | 142 | stops if a binding value is nil. If all are non-nil, the value |
| 139 | evalled to set symbol's value. In the special case you only want | 143 | of the last form in BODY is returned. |
| 140 | to bind a single value, BINDINGS can just be a plain tuple." | 144 | Each element of VARLIST is a symbol (which is bound to nil) |
| 145 | or a list (SYMBOL VALUEFORM) (which binds SYMBOL to the value of VALUEFORM). | ||
| 146 | In the special case you only want to bind a single value, | ||
| 147 | VARLIST can just be a plain tuple. | ||
| 148 | \n(fn VARLIST BODY...)" | ||
| 141 | (declare (indent 1) (debug if-let)) | 149 | (declare (indent 1) (debug if-let)) |
| 142 | (list 'if-let bindings (macroexp-progn body))) | 150 | (list 'if-let bindings (macroexp-progn body))) |
| 143 | 151 | ||
| 152 | (defalias 'if-let 'if-let*) | ||
| 153 | (defalias 'when-let 'when-let*) | ||
| 154 | (defalias 'and-let* 'when-let*) | ||
| 155 | |||
| 144 | (defsubst hash-table-empty-p (hash-table) | 156 | (defsubst hash-table-empty-p (hash-table) |
| 145 | "Check whether HASH-TABLE is empty (has 0 elements)." | 157 | "Check whether HASH-TABLE is empty (has 0 elements)." |
| 146 | (zerop (hash-table-count hash-table))) | 158 | (zerop (hash-table-count hash-table))) |
| @@ -214,6 +226,11 @@ user enters `recenter', `scroll-up', or `scroll-down' responses, | |||
| 214 | perform the requested window recentering or scrolling and ask | 226 | perform the requested window recentering or scrolling and ask |
| 215 | again. | 227 | again. |
| 216 | 228 | ||
| 229 | When `use-dialog-box' is t (the default), this function can pop | ||
| 230 | up a dialog window to collect the user input. That functionality | ||
| 231 | requires `display-popup-menus-p' to return t. Otherwise, a text | ||
| 232 | dialog will be used. | ||
| 233 | |||
| 217 | The return value is the matching entry from the CHOICES list. | 234 | The return value is the matching entry from the CHOICES list. |
| 218 | 235 | ||
| 219 | Usage example: | 236 | Usage example: |
diff --git a/lisp/emacs-lisp/tabulated-list.el b/lisp/emacs-lisp/tabulated-list.el index eadf79ffd4f..b6b49b1bfa2 100644 --- a/lisp/emacs-lisp/tabulated-list.el +++ b/lisp/emacs-lisp/tabulated-list.el | |||
| @@ -412,8 +412,13 @@ of column descriptors." | |||
| 412 | (inhibit-read-only t)) | 412 | (inhibit-read-only t)) |
| 413 | (if (> tabulated-list-padding 0) | 413 | (if (> tabulated-list-padding 0) |
| 414 | (insert (make-string x ?\s))) | 414 | (insert (make-string x ?\s))) |
| 415 | (dotimes (n ncols) | 415 | (let ((tabulated-list--near-rows ; Bind it if not bound yet (Bug#25506). |
| 416 | (setq x (tabulated-list-print-col n (aref cols n) x))) | 416 | (or (bound-and-true-p tabulated-list--near-rows) |
| 417 | (list (or (tabulated-list-get-entry (point-at-bol 0)) | ||
| 418 | cols) | ||
| 419 | cols)))) | ||
| 420 | (dotimes (n ncols) | ||
| 421 | (setq x (tabulated-list-print-col n (aref cols n) x)))) | ||
| 417 | (insert ?\n) | 422 | (insert ?\n) |
| 418 | ;; Ever so slightly faster than calling `put-text-property' twice. | 423 | ;; Ever so slightly faster than calling `put-text-property' twice. |
| 419 | (add-text-properties | 424 | (add-text-properties |
diff --git a/lisp/emulation/edt-mapper.el b/lisp/emulation/edt-mapper.el index 24a8f039fa5..457ad55dd6c 100644 --- a/lisp/emulation/edt-mapper.el +++ b/lisp/emulation/edt-mapper.el | |||
| @@ -57,9 +57,9 @@ | |||
| 57 | ;; Usage: | 57 | ;; Usage: |
| 58 | 58 | ||
| 59 | ;; Simply load this file into emacs (version 19 or higher) | 59 | ;; Simply load this file into emacs (version 19 or higher) |
| 60 | ;; using the following command. | 60 | ;; and run the function edt-mapper, using the following command. |
| 61 | 61 | ||
| 62 | ;; emacs -q -l edt-mapper.el | 62 | ;; emacs -q -l edt-mapper -f edt-mapper |
| 63 | 63 | ||
| 64 | ;; The "-q" option prevents loading of your init file (commands | 64 | ;; The "-q" option prevents loading of your init file (commands |
| 65 | ;; therein might confuse this program). | 65 | ;; therein might confuse this program). |
| @@ -96,10 +96,6 @@ | |||
| 96 | 96 | ||
| 97 | ;;; Code: | 97 | ;;; Code: |
| 98 | 98 | ||
| 99 | ;; Otherwise it just hangs. This seems preferable. | ||
| 100 | (if noninteractive | ||
| 101 | (error "edt-mapper cannot be loaded in batch mode")) | ||
| 102 | |||
| 103 | ;;; | 99 | ;;; |
| 104 | ;;; Decide Emacs Variant, GNU Emacs or XEmacs (aka Lucid Emacs). | 100 | ;;; Decide Emacs Variant, GNU Emacs or XEmacs (aka Lucid Emacs). |
| 105 | ;;; Determine Window System, and X Server Vendor (if appropriate). | 101 | ;;; Determine Window System, and X Server Vendor (if appropriate). |
| @@ -124,6 +120,8 @@ | |||
| 124 | ;;; | 120 | ;;; |
| 125 | ;;; Key variables | 121 | ;;; Key variables |
| 126 | ;;; | 122 | ;;; |
| 123 | |||
| 124 | ;; FIXME some/all of these should be let-bound, not global. | ||
| 127 | (defvar edt-key nil) | 125 | (defvar edt-key nil) |
| 128 | (defvar edt-enter nil) | 126 | (defvar edt-enter nil) |
| 129 | (defvar edt-return nil) | 127 | (defvar edt-return nil) |
| @@ -137,88 +135,116 @@ | |||
| 137 | (defvar edt-save-function-key-map) | 135 | (defvar edt-save-function-key-map) |
| 138 | 136 | ||
| 139 | ;;; | 137 | ;;; |
| 140 | ;;; Determine Terminal Type (if appropriate). | 138 | ;;; Key mapping functions |
| 141 | ;;; | ||
| 142 | |||
| 143 | (if (and edt-window-system (not (eq edt-window-system 'tty))) | ||
| 144 | (setq edt-term nil) | ||
| 145 | (setq edt-term (getenv "TERM"))) | ||
| 146 | |||
| 147 | ;;; | ||
| 148 | ;;; Implements a workaround for a feature that was added to simple.el. | ||
| 149 | ;;; | ||
| 150 | ;;; Many function keys have no Emacs functions assigned to them by | ||
| 151 | ;;; default. A subset of these are typically assigned functions in the | ||
| 152 | ;;; EDT emulation. This includes all the keypad keys and a some others | ||
| 153 | ;;; like Delete. | ||
| 154 | ;;; | ||
| 155 | ;;; Logic in simple.el maps some of these unassigned function keys to | ||
| 156 | ;;; ordinary typing keys. Where this is the case, a call to | ||
| 157 | ;;; read-key-sequence, below, does not return the name of the function | ||
| 158 | ;;; key pressed by the user but, instead, it returns the name of the | ||
| 159 | ;;; key to which it has been mapped. It needs to know the name of the | ||
| 160 | ;;; key pressed by the user. As a workaround, we assign a function to | ||
| 161 | ;;; each of the unassigned function keys of interest, here. These | ||
| 162 | ;;; assignments override the mapping to other keys and are only | ||
| 163 | ;;; temporary since, when edt-mapper is finished executing, it causes | ||
| 164 | ;;; Emacs to exit. | ||
| 165 | ;;; | ||
| 166 | |||
| 167 | (mapc | ||
| 168 | (lambda (function-key) | ||
| 169 | (if (not (lookup-key (current-global-map) function-key)) | ||
| 170 | (define-key (current-global-map) function-key 'forward-char))) | ||
| 171 | '([kp-0] [kp-1] [kp-2] [kp-3] [kp-4] | ||
| 172 | [kp-5] [kp-6] [kp-7] [kp-8] [kp-9] | ||
| 173 | [kp-space] | ||
| 174 | [kp-tab] | ||
| 175 | [kp-enter] | ||
| 176 | [kp-multiply] | ||
| 177 | [kp-add] | ||
| 178 | [kp-separator] | ||
| 179 | [kp-subtract] | ||
| 180 | [kp-decimal] | ||
| 181 | [kp-divide] | ||
| 182 | [kp-equal] | ||
| 183 | [backspace] | ||
| 184 | [delete] | ||
| 185 | [tab] | ||
| 186 | [linefeed] | ||
| 187 | [clear])) | ||
| 188 | |||
| 189 | ;;; | ||
| 190 | ;;; Make sure the window is big enough to display the instructions, | ||
| 191 | ;;; except where window cannot be re-sized. | ||
| 192 | ;;; | ||
| 193 | |||
| 194 | (if (and edt-window-system (not (eq edt-window-system 'tty))) | ||
| 195 | (set-frame-size (selected-frame) 80 36)) | ||
| 196 | |||
| 197 | ;;; | ||
| 198 | ;;; Create buffers - Directions and Keys | ||
| 199 | ;;; | 139 | ;;; |
| 200 | (if (not (get-buffer "Directions")) (generate-new-buffer "Directions")) | 140 | (defun edt-map-key (ident descrip) |
| 201 | (if (not (get-buffer "Keys")) (generate-new-buffer "Keys")) | 141 | (interactive) |
| 142 | (if (featurep 'xemacs) | ||
| 143 | (progn | ||
| 144 | (setq edt-key-seq (read-key-sequence (format "Press %s%s: " ident descrip))) | ||
| 145 | (setq edt-key (concat "[" (format "%s" (event-key (aref edt-key-seq 0))) "]")) | ||
| 146 | (cond ((not (equal edt-key edt-return)) | ||
| 147 | (set-buffer "Keys") | ||
| 148 | (insert (format " (\"%s\" . %s)\n" ident edt-key)) | ||
| 149 | (set-buffer "Directions")) | ||
| 150 | ;; bogosity to get next prompt to come up, if the user hits <CR>! | ||
| 151 | ;; check periodically to see if this is still needed... | ||
| 152 | (t | ||
| 153 | (set-buffer "Keys") | ||
| 154 | (insert (format " (\"%s\" . \"\" )\n" ident)) | ||
| 155 | (set-buffer "Directions")))) | ||
| 156 | (setq edt-key (read-key-sequence (format "Press %s%s: " ident descrip))) | ||
| 157 | (cond ((not (equal edt-key edt-return)) | ||
| 158 | (set-buffer "Keys") | ||
| 159 | (insert (if (vectorp edt-key) | ||
| 160 | (format " (\"%s\" . %s)\n" ident edt-key) | ||
| 161 | (format " (\"%s\" . \"%s\")\n" ident edt-key))) | ||
| 162 | (set-buffer "Directions")) | ||
| 163 | ;; bogosity to get next prompt to come up, if the user hits <CR>! | ||
| 164 | ;; check periodically to see if this is still needed... | ||
| 165 | (t | ||
| 166 | (set-buffer "Keys") | ||
| 167 | (insert (format " (\"%s\" . \"\" )\n" ident)) | ||
| 168 | (set-buffer "Directions")))) | ||
| 169 | edt-key) | ||
| 202 | 170 | ||
| 203 | ;;; | 171 | (defun edt-mapper () |
| 204 | ;;; Put header in the Keys buffer | 172 | (if noninteractive |
| 205 | ;;; | 173 | (user-error "edt-mapper cannot be loaded in batch mode")) |
| 206 | (set-buffer "Keys") | 174 | ;; Determine Terminal Type (if appropriate). |
| 207 | (insert "\ | 175 | (if (and edt-window-system (not (eq edt-window-system 'tty))) |
| 176 | (setq edt-term nil) | ||
| 177 | (setq edt-term (getenv "TERM"))) | ||
| 178 | ;; | ||
| 179 | ;; Implements a workaround for a feature that was added to simple.el. | ||
| 180 | ;; | ||
| 181 | ;; Many function keys have no Emacs functions assigned to them by | ||
| 182 | ;; default. A subset of these are typically assigned functions in the | ||
| 183 | ;; EDT emulation. This includes all the keypad keys and a some others | ||
| 184 | ;; like Delete. | ||
| 185 | ;; | ||
| 186 | ;; Logic in simple.el maps some of these unassigned function keys to | ||
| 187 | ;; ordinary typing keys. Where this is the case, a call to | ||
| 188 | ;; read-key-sequence, below, does not return the name of the function | ||
| 189 | ;; key pressed by the user but, instead, it returns the name of the | ||
| 190 | ;; key to which it has been mapped. It needs to know the name of the | ||
| 191 | ;; key pressed by the user. As a workaround, we assign a function to | ||
| 192 | ;; each of the unassigned function keys of interest, here. These | ||
| 193 | ;; assignments override the mapping to other keys and are only | ||
| 194 | ;; temporary since, when edt-mapper is finished executing, it causes | ||
| 195 | ;; Emacs to exit. | ||
| 196 | ;; | ||
| 197 | (mapc | ||
| 198 | (lambda (function-key) | ||
| 199 | (if (not (lookup-key (current-global-map) function-key)) | ||
| 200 | (define-key (current-global-map) function-key 'forward-char))) | ||
| 201 | '([kp-0] [kp-1] [kp-2] [kp-3] [kp-4] | ||
| 202 | [kp-5] [kp-6] [kp-7] [kp-8] [kp-9] | ||
| 203 | [kp-space] | ||
| 204 | [kp-tab] | ||
| 205 | [kp-enter] | ||
| 206 | [kp-multiply] | ||
| 207 | [kp-add] | ||
| 208 | [kp-separator] | ||
| 209 | [kp-subtract] | ||
| 210 | [kp-decimal] | ||
| 211 | [kp-divide] | ||
| 212 | [kp-equal] | ||
| 213 | [backspace] | ||
| 214 | [delete] | ||
| 215 | [tab] | ||
| 216 | [linefeed] | ||
| 217 | [clear])) | ||
| 218 | ;; | ||
| 219 | ;; Make sure the window is big enough to display the instructions, | ||
| 220 | ;; except where window cannot be re-sized. | ||
| 221 | ;; | ||
| 222 | (if (and edt-window-system (not (eq edt-window-system 'tty))) | ||
| 223 | (set-frame-size (selected-frame) 80 36)) | ||
| 224 | ;; | ||
| 225 | ;; Create buffers - Directions and Keys | ||
| 226 | ;; | ||
| 227 | (if (not (get-buffer "Directions")) (generate-new-buffer "Directions")) | ||
| 228 | (if (not (get-buffer "Keys")) (generate-new-buffer "Keys")) | ||
| 229 | ;; | ||
| 230 | ;; Put header in the Keys buffer | ||
| 231 | ;; | ||
| 232 | (set-buffer "Keys") | ||
| 233 | (insert "\ | ||
| 208 | ;; | 234 | ;; |
| 209 | ;; Key definitions for the EDT emulation within GNU Emacs | 235 | ;; Key definitions for the EDT emulation within GNU Emacs |
| 210 | ;; | 236 | ;; |
| 211 | 237 | ||
| 212 | (defconst *EDT-keys* | 238 | \(defconst *EDT-keys* |
| 213 | '( | 239 | '( |
| 214 | ") | 240 | ") |
| 215 | 241 | ||
| 216 | ;;; | 242 | ;; |
| 217 | ;;; Display directions | 243 | ;; Display directions |
| 218 | ;;; | 244 | ;; |
| 219 | (switch-to-buffer "Directions") | 245 | (switch-to-buffer "Directions") |
| 220 | (if (and edt-window-system (not (eq edt-window-system 'tty))) | 246 | (if (and edt-window-system (not (eq edt-window-system 'tty))) |
| 221 | (insert " | 247 | (insert " |
| 222 | EDT MAPPER | 248 | EDT MAPPER |
| 223 | 249 | ||
| 224 | You will be asked to press keys to create a custom mapping (under a | 250 | You will be asked to press keys to create a custom mapping (under a |
| @@ -240,7 +266,7 @@ | |||
| 240 | just press RETURN at the prompt. | 266 | just press RETURN at the prompt. |
| 241 | 267 | ||
| 242 | ") | 268 | ") |
| 243 | (insert " | 269 | (insert " |
| 244 | EDT MAPPER | 270 | EDT MAPPER |
| 245 | 271 | ||
| 246 | You will be asked to press keys to create a custom mapping of your | 272 | You will be asked to press keys to create a custom mapping of your |
| @@ -259,39 +285,39 @@ | |||
| 259 | 285 | ||
| 260 | ")) | 286 | ")) |
| 261 | 287 | ||
| 262 | (delete-other-windows) | 288 | (delete-other-windows) |
| 263 | 289 | ||
| 264 | ;;; | 290 | ;; |
| 265 | ;;; Save <CR> for future reference. | 291 | ;; Save <CR> for future reference. |
| 266 | ;;; | 292 | ;; |
| 267 | ;;; For GNU Emacs, running in a Window System, first hide bindings in | 293 | ;; For GNU Emacs, running in a Window System, first hide bindings in |
| 268 | ;;; function-key-map. | 294 | ;; function-key-map. |
| 269 | ;;; | 295 | ;; |
| 270 | (cond | 296 | (cond |
| 271 | ((featurep 'xemacs) | 297 | ((featurep 'xemacs) |
| 272 | (setq edt-return-seq (read-key-sequence "Hit carriage-return <CR> to continue ")) | 298 | (setq edt-return-seq (read-key-sequence "Hit carriage-return <CR> to continue ")) |
| 273 | (setq edt-return (concat "[" (format "%s" (event-key (aref edt-return-seq 0))) "]"))) | 299 | (setq edt-return (concat "[" (format "%s" (event-key (aref edt-return-seq 0))) "]"))) |
| 274 | (t | 300 | (t |
| 275 | (if edt-window-system | 301 | (if edt-window-system |
| 276 | (progn | 302 | (progn |
| 277 | (setq edt-save-function-key-map function-key-map) | 303 | (setq edt-save-function-key-map function-key-map) |
| 278 | (setq function-key-map (make-sparse-keymap)))) | 304 | (setq function-key-map (make-sparse-keymap)))) |
| 279 | (setq edt-return (read-key-sequence "Hit carriage-return <CR> to continue ")))) | 305 | (setq edt-return (read-key-sequence "Hit carriage-return <CR> to continue ")))) |
| 280 | 306 | ||
| 281 | ;;; | 307 | ;; |
| 282 | ;;; Remove prefix-key bindings to F1 and F2 in global-map so they can be | 308 | ;; Remove prefix-key bindings to F1 and F2 in global-map so they can be |
| 283 | ;;; bound in the EDT Emulation mode. | 309 | ;; bound in the EDT Emulation mode. |
| 284 | ;;; | 310 | ;; |
| 285 | (global-unset-key [f1]) | 311 | (global-unset-key [f1]) |
| 286 | (global-unset-key [f2]) | 312 | (global-unset-key [f2]) |
| 287 | 313 | ||
| 288 | ;;; | 314 | ;; |
| 289 | ;;; Display Keypad Diagram and Begin Prompting for Keys | 315 | ;; Display Keypad Diagram and Begin Prompting for Keys |
| 290 | ;;; | 316 | ;; |
| 291 | (set-buffer "Directions") | 317 | (set-buffer "Directions") |
| 292 | (delete-region (point-min) (point-max)) | 318 | (delete-region (point-min) (point-max)) |
| 293 | (if (and edt-window-system (not (eq edt-window-system 'tty))) | 319 | (if (and edt-window-system (not (eq edt-window-system 'tty))) |
| 294 | (insert " | 320 | (insert " |
| 295 | 321 | ||
| 296 | PRESS THE KEY SPECIFIED IN THE MINIBUFFER BELOW. | 322 | PRESS THE KEY SPECIFIED IN THE MINIBUFFER BELOW. |
| 297 | 323 | ||
| @@ -321,11 +347,11 @@ | |||
| 321 | REMEMBER: JUST PRESS RETURN TO SKIP MAPPING A KEY. | 347 | REMEMBER: JUST PRESS RETURN TO SKIP MAPPING A KEY. |
| 322 | 348 | ||
| 323 | ") | 349 | ") |
| 324 | (progn | 350 | (progn |
| 325 | (insert " | 351 | (insert " |
| 326 | GENERATING A CUSTOM CONFIGURATION FILE FOR TERMINAL TYPE: ") | 352 | GENERATING A CUSTOM CONFIGURATION FILE FOR TERMINAL TYPE: ") |
| 327 | (insert (format "%s." edt-term)) | 353 | (insert (format "%s." edt-term)) |
| 328 | (insert " | 354 | (insert " |
| 329 | 355 | ||
| 330 | PRESS THE KEY SPECIFIED IN THE MINIBUFFER BELOW. | 356 | PRESS THE KEY SPECIFIED IN THE MINIBUFFER BELOW. |
| 331 | 357 | ||
| @@ -347,142 +373,109 @@ | |||
| 347 | REMEMBER: JUST PRESS RETURN TO SKIP MAPPING A KEY."))) | 373 | REMEMBER: JUST PRESS RETURN TO SKIP MAPPING A KEY."))) |
| 348 | 374 | ||
| 349 | 375 | ||
| 350 | ;;; | ||
| 351 | ;;; Key mapping functions | ||
| 352 | ;;; | ||
| 353 | (defun edt-map-key (ident descrip) | ||
| 354 | (interactive) | ||
| 355 | (if (featurep 'xemacs) | ||
| 356 | (progn | ||
| 357 | (setq edt-key-seq (read-key-sequence (format "Press %s%s: " ident descrip))) | ||
| 358 | (setq edt-key (concat "[" (format "%s" (event-key (aref edt-key-seq 0))) "]")) | ||
| 359 | (cond ((not (equal edt-key edt-return)) | ||
| 360 | (set-buffer "Keys") | ||
| 361 | (insert (format " (\"%s\" . %s)\n" ident edt-key)) | ||
| 362 | (set-buffer "Directions")) | ||
| 363 | ;; bogosity to get next prompt to come up, if the user hits <CR>! | ||
| 364 | ;; check periodically to see if this is still needed... | ||
| 365 | (t | ||
| 366 | (set-buffer "Keys") | ||
| 367 | (insert (format " (\"%s\" . \"\" )\n" ident)) | ||
| 368 | (set-buffer "Directions")))) | ||
| 369 | (setq edt-key (read-key-sequence (format "Press %s%s: " ident descrip))) | ||
| 370 | (cond ((not (equal edt-key edt-return)) | ||
| 371 | (set-buffer "Keys") | ||
| 372 | (insert (if (vectorp edt-key) | ||
| 373 | (format " (\"%s\" . %s)\n" ident edt-key) | ||
| 374 | (format " (\"%s\" . \"%s\")\n" ident edt-key))) | ||
| 375 | (set-buffer "Directions")) | ||
| 376 | ;; bogosity to get next prompt to come up, if the user hits <CR>! | ||
| 377 | ;; check periodically to see if this is still needed... | ||
| 378 | (t | ||
| 379 | (set-buffer "Keys") | ||
| 380 | (insert (format " (\"%s\" . \"\" )\n" ident)) | ||
| 381 | (set-buffer "Directions")))) | ||
| 382 | edt-key) | ||
| 383 | 376 | ||
| 384 | (set-buffer "Keys") | 377 | (set-buffer "Keys") |
| 385 | (insert " | 378 | (insert " |
| 386 | ;; | 379 | ;; |
| 387 | ;; Arrows | 380 | ;; Arrows |
| 388 | ;; | 381 | ;; |
| 389 | ") | 382 | ") |
| 390 | (set-buffer "Directions") | 383 | (set-buffer "Directions") |
| 391 | 384 | ||
| 392 | (edt-map-key "UP" " - The Up Arrow Key") | 385 | (edt-map-key "UP" " - The Up Arrow Key") |
| 393 | (edt-map-key "DOWN" " - The Down Arrow Key") | 386 | (edt-map-key "DOWN" " - The Down Arrow Key") |
| 394 | (edt-map-key "LEFT" " - The Left Arrow Key") | 387 | (edt-map-key "LEFT" " - The Left Arrow Key") |
| 395 | (edt-map-key "RIGHT" " - The Right Arrow Key") | 388 | (edt-map-key "RIGHT" " - The Right Arrow Key") |
| 396 | 389 | ||
| 397 | 390 | ||
| 398 | (set-buffer "Keys") | 391 | (set-buffer "Keys") |
| 399 | (insert " | 392 | (insert " |
| 400 | ;; | 393 | ;; |
| 401 | ;; PF keys | 394 | ;; PF keys |
| 402 | ;; | 395 | ;; |
| 403 | ") | 396 | ") |
| 404 | (set-buffer "Directions") | 397 | (set-buffer "Directions") |
| 405 | 398 | ||
| 406 | (edt-map-key "PF1" " - The PF1 (GOLD) Key") | 399 | (edt-map-key "PF1" " - The PF1 (GOLD) Key") |
| 407 | (edt-map-key "PF2" " - The Keypad PF2 Key") | 400 | (edt-map-key "PF2" " - The Keypad PF2 Key") |
| 408 | (edt-map-key "PF3" " - The Keypad PF3 Key") | 401 | (edt-map-key "PF3" " - The Keypad PF3 Key") |
| 409 | (edt-map-key "PF4" " - The Keypad PF4 Key") | 402 | (edt-map-key "PF4" " - The Keypad PF4 Key") |
| 410 | 403 | ||
| 411 | (set-buffer "Keys") | 404 | (set-buffer "Keys") |
| 412 | (insert " | 405 | (insert " |
| 413 | ;; | 406 | ;; |
| 414 | ;; KP0-9 KP- KP, KPP and KPE | 407 | ;; KP0-9 KP- KP, KPP and KPE |
| 415 | ;; | 408 | ;; |
| 416 | ") | 409 | ") |
| 417 | (set-buffer "Directions") | 410 | (set-buffer "Directions") |
| 418 | 411 | ||
| 419 | (edt-map-key "KP0" " - The Keypad 0 Key") | 412 | (edt-map-key "KP0" " - The Keypad 0 Key") |
| 420 | (edt-map-key "KP1" " - The Keypad 1 Key") | 413 | (edt-map-key "KP1" " - The Keypad 1 Key") |
| 421 | (edt-map-key "KP2" " - The Keypad 2 Key") | 414 | (edt-map-key "KP2" " - The Keypad 2 Key") |
| 422 | (edt-map-key "KP3" " - The Keypad 3 Key") | 415 | (edt-map-key "KP3" " - The Keypad 3 Key") |
| 423 | (edt-map-key "KP4" " - The Keypad 4 Key") | 416 | (edt-map-key "KP4" " - The Keypad 4 Key") |
| 424 | (edt-map-key "KP5" " - The Keypad 5 Key") | 417 | (edt-map-key "KP5" " - The Keypad 5 Key") |
| 425 | (edt-map-key "KP6" " - The Keypad 6 Key") | 418 | (edt-map-key "KP6" " - The Keypad 6 Key") |
| 426 | (edt-map-key "KP7" " - The Keypad 7 Key") | 419 | (edt-map-key "KP7" " - The Keypad 7 Key") |
| 427 | (edt-map-key "KP8" " - The Keypad 8 Key") | 420 | (edt-map-key "KP8" " - The Keypad 8 Key") |
| 428 | (edt-map-key "KP9" " - The Keypad 9 Key") | 421 | (edt-map-key "KP9" " - The Keypad 9 Key") |
| 429 | (edt-map-key "KP-" " - The Keypad - Key") | 422 | (edt-map-key "KP-" " - The Keypad - Key") |
| 430 | (edt-map-key "KP," " - The Keypad , Key") | 423 | (edt-map-key "KP," " - The Keypad , Key") |
| 431 | (edt-map-key "KPP" " - The Keypad . Key") | 424 | (edt-map-key "KPP" " - The Keypad . Key") |
| 432 | (edt-map-key "KPE" " - The Keypad Enter Key") | 425 | (edt-map-key "KPE" " - The Keypad Enter Key") |
| 433 | ;; Save the enter key | 426 | ;; Save the enter key |
| 434 | (setq edt-enter edt-key) | 427 | (setq edt-enter edt-key) |
| 435 | (setq edt-enter-seq edt-key-seq) | 428 | (setq edt-enter-seq edt-key-seq) |
| 436 | 429 | ||
| 437 | 430 | ||
| 438 | (set-buffer "Keys") | 431 | (set-buffer "Keys") |
| 439 | (insert " | 432 | (insert " |
| 440 | ;; | 433 | ;; |
| 441 | ;; Editing keypad (FIND, INSERT, REMOVE) | 434 | ;; Editing keypad (FIND, INSERT, REMOVE) |
| 442 | ;; (SELECT, PREVIOUS, NEXT) | 435 | ;; (SELECT, PREVIOUS, NEXT) |
| 443 | ;; | 436 | ;; |
| 444 | ") | 437 | ") |
| 445 | (set-buffer "Directions") | 438 | (set-buffer "Directions") |
| 446 | 439 | ||
| 447 | (edt-map-key "FIND" " - The Find key on the editing keypad") | 440 | (edt-map-key "FIND" " - The Find key on the editing keypad") |
| 448 | (edt-map-key "INSERT" " - The Insert key on the editing keypad") | 441 | (edt-map-key "INSERT" " - The Insert key on the editing keypad") |
| 449 | (edt-map-key "REMOVE" " - The Remove key on the editing keypad") | 442 | (edt-map-key "REMOVE" " - The Remove key on the editing keypad") |
| 450 | (edt-map-key "SELECT" " - The Select key on the editing keypad") | 443 | (edt-map-key "SELECT" " - The Select key on the editing keypad") |
| 451 | (edt-map-key "PREVIOUS" " - The Prev Scr key on the editing keypad") | 444 | (edt-map-key "PREVIOUS" " - The Prev Scr key on the editing keypad") |
| 452 | (edt-map-key "NEXT" " - The Next Scr key on the editing keypad") | 445 | (edt-map-key "NEXT" " - The Next Scr key on the editing keypad") |
| 453 | 446 | ||
| 454 | (set-buffer "Keys") | 447 | (set-buffer "Keys") |
| 455 | (insert " | 448 | (insert " |
| 456 | ;; | 449 | ;; |
| 457 | ;; F1-14 Help Do F17-F20 | 450 | ;; F1-14 Help Do F17-F20 |
| 458 | ;; | 451 | ;; |
| 459 | ") | 452 | ") |
| 460 | (set-buffer "Directions") | 453 | (set-buffer "Directions") |
| 461 | 454 | ||
| 462 | (edt-map-key "F1" " - F1 Function Key") | 455 | (edt-map-key "F1" " - F1 Function Key") |
| 463 | (edt-map-key "F2" " - F2 Function Key") | 456 | (edt-map-key "F2" " - F2 Function Key") |
| 464 | (edt-map-key "F3" " - F3 Function Key") | 457 | (edt-map-key "F3" " - F3 Function Key") |
| 465 | (edt-map-key "F4" " - F4 Function Key") | 458 | (edt-map-key "F4" " - F4 Function Key") |
| 466 | (edt-map-key "F5" " - F5 Function Key") | 459 | (edt-map-key "F5" " - F5 Function Key") |
| 467 | (edt-map-key "F6" " - F6 Function Key") | 460 | (edt-map-key "F6" " - F6 Function Key") |
| 468 | (edt-map-key "F7" " - F7 Function Key") | 461 | (edt-map-key "F7" " - F7 Function Key") |
| 469 | (edt-map-key "F8" " - F8 Function Key") | 462 | (edt-map-key "F8" " - F8 Function Key") |
| 470 | (edt-map-key "F9" " - F9 Function Key") | 463 | (edt-map-key "F9" " - F9 Function Key") |
| 471 | (edt-map-key "F10" " - F10 Function Key") | 464 | (edt-map-key "F10" " - F10 Function Key") |
| 472 | (edt-map-key "F11" " - F11 Function Key") | 465 | (edt-map-key "F11" " - F11 Function Key") |
| 473 | (edt-map-key "F12" " - F12 Function Key") | 466 | (edt-map-key "F12" " - F12 Function Key") |
| 474 | (edt-map-key "F13" " - F13 Function Key") | 467 | (edt-map-key "F13" " - F13 Function Key") |
| 475 | (edt-map-key "F14" " - F14 Function Key") | 468 | (edt-map-key "F14" " - F14 Function Key") |
| 476 | (edt-map-key "HELP" " - HELP Function Key") | 469 | (edt-map-key "HELP" " - HELP Function Key") |
| 477 | (edt-map-key "DO" " - DO Function Key") | 470 | (edt-map-key "DO" " - DO Function Key") |
| 478 | (edt-map-key "F17" " - F17 Function Key") | 471 | (edt-map-key "F17" " - F17 Function Key") |
| 479 | (edt-map-key "F18" " - F18 Function Key") | 472 | (edt-map-key "F18" " - F18 Function Key") |
| 480 | (edt-map-key "F19" " - F19 Function Key") | 473 | (edt-map-key "F19" " - F19 Function Key") |
| 481 | (edt-map-key "F20" " - F20 Function Key") | 474 | (edt-map-key "F20" " - F20 Function Key") |
| 482 | 475 | ||
| 483 | (set-buffer "Directions") | 476 | (set-buffer "Directions") |
| 484 | (delete-region (point-min) (point-max)) | 477 | (delete-region (point-min) (point-max)) |
| 485 | (insert " | 478 | (insert " |
| 486 | ADDITIONAL FUNCTION KEYS | 479 | ADDITIONAL FUNCTION KEYS |
| 487 | 480 | ||
| 488 | Your keyboard may have additional function keys which do not correspond | 481 | Your keyboard may have additional function keys which do not correspond |
| @@ -501,53 +494,53 @@ | |||
| 501 | 494 | ||
| 502 | When you are done, just press RETURN at the \"EDT Key Name:\" prompt. | 495 | When you are done, just press RETURN at the \"EDT Key Name:\" prompt. |
| 503 | ") | 496 | ") |
| 504 | (switch-to-buffer "Directions") | 497 | (switch-to-buffer "Directions") |
| 505 | ;;; | 498 | ;; |
| 506 | ;;; Add support for extras keys | 499 | ;; Add support for extras keys |
| 507 | ;;; | 500 | ;; |
| 508 | (set-buffer "Keys") | 501 | (set-buffer "Keys") |
| 509 | (insert "\ | 502 | (insert "\ |
| 510 | ;; | 503 | ;; |
| 511 | ;; Extra Keys | 504 | ;; Extra Keys |
| 512 | ;; | 505 | ;; |
| 513 | ") | 506 | ") |
| 514 | ;;; | 507 | ;; |
| 515 | ;;; Restore function-key-map. | 508 | ;; Restore function-key-map. |
| 516 | ;;; | 509 | ;; |
| 517 | (if (and edt-window-system (not (featurep 'xemacs))) | 510 | (if (and edt-window-system (not (featurep 'xemacs))) |
| 518 | (setq function-key-map edt-save-function-key-map)) | 511 | (setq function-key-map edt-save-function-key-map)) |
| 519 | (setq EDT-key-name "") | 512 | (setq EDT-key-name "") |
| 520 | (while (not | 513 | (while (not |
| 521 | (string-equal (setq EDT-key-name (read-string "EDT Key Name: ")) "")) | 514 | (string-equal (setq EDT-key-name (read-string "EDT Key Name: ")) "")) |
| 522 | (edt-map-key EDT-key-name "")) | 515 | (edt-map-key EDT-key-name "")) |
| 523 | 516 | ||
| 524 | ; | 517 | ;; |
| 525 | ; No more keys to add, so wrap up. | 518 | ;; No more keys to add, so wrap up. |
| 526 | ; | 519 | ;; |
| 527 | (set-buffer "Keys") | 520 | (set-buffer "Keys") |
| 528 | (insert "\ | 521 | (insert "\ |
| 529 | ) | 522 | ) |
| 530 | ) | 523 | ) |
| 531 | ") | 524 | ") |
| 532 | 525 | ||
| 533 | ;;; | 526 | ;; |
| 534 | ;;; Save the key mapping program | 527 | ;; Save the key mapping program |
| 535 | ;;; | 528 | ;; |
| 536 | ;;; | 529 | ;; |
| 537 | ;;; Save the key mapping file | 530 | ;; Save the key mapping file |
| 538 | ;;; | 531 | ;; |
| 539 | (let ((file (concat | 532 | (let ((file (concat |
| 540 | "~/.edt-" (if (featurep 'xemacs) "xemacs" "gnu") | 533 | "~/.edt-" (if (featurep 'xemacs) "xemacs" "gnu") |
| 541 | (if edt-term (concat "-" edt-term)) | 534 | (if edt-term (concat "-" edt-term)) |
| 542 | (if edt-xserver (concat "-" edt-xserver)) | 535 | (if edt-xserver (concat "-" edt-xserver)) |
| 543 | (if edt-window-system (concat "-" (upcase (symbol-name edt-window-system)))) | 536 | (if edt-window-system (concat "-" (upcase (symbol-name edt-window-system)))) |
| 544 | "-keys"))) | 537 | "-keys"))) |
| 545 | (set-visited-file-name | 538 | (set-visited-file-name |
| 546 | (read-file-name (format "Save key mapping to file (default %s): " file) nil file))) | 539 | (read-file-name (format "Save key mapping to file (default %s): " file) nil file))) |
| 547 | (save-buffer) | 540 | (save-buffer) |
| 548 | 541 | ||
| 549 | (message "That's it! Press any key to exit") | 542 | (message "That's it! Press any key to exit") |
| 550 | (sit-for 600) | 543 | (sit-for 600) |
| 551 | (kill-emacs t) | 544 | (kill-emacs t)) |
| 552 | 545 | ||
| 553 | ;;; edt-mapper.el ends here | 546 | ;;; edt-mapper.el ends here |
diff --git a/lisp/emulation/edt.el b/lisp/emulation/edt.el index 31f555b0326..a6b2d785ac5 100644 --- a/lisp/emulation/edt.el +++ b/lisp/emulation/edt.el | |||
| @@ -1928,6 +1928,8 @@ Optional argument NOT-YES changes the default to negative." | |||
| 1928 | ;;; INITIALIZATION COMMANDS. | 1928 | ;;; INITIALIZATION COMMANDS. |
| 1929 | ;;; | 1929 | ;;; |
| 1930 | 1930 | ||
| 1931 | (declare-function edt-mapper "edt-mapper" ()) | ||
| 1932 | |||
| 1931 | ;;; | 1933 | ;;; |
| 1932 | ;;; Function used to load LK-201 key mapping file generated by edt-mapper.el. | 1934 | ;;; Function used to load LK-201 key mapping file generated by edt-mapper.el. |
| 1933 | ;;; | 1935 | ;;; |
| @@ -1968,7 +1970,7 @@ created." | |||
| 1968 | You can do this by quitting Emacs and then invoking Emacs again as | 1970 | You can do this by quitting Emacs and then invoking Emacs again as |
| 1969 | follows: | 1971 | follows: |
| 1970 | 1972 | ||
| 1971 | emacs -q -l edt-mapper | 1973 | emacs -q -l edt-mapper -f edt-mapper |
| 1972 | 1974 | ||
| 1973 | [NOTE: If you do nothing out of the ordinary in your init file, and | 1975 | [NOTE: If you do nothing out of the ordinary in your init file, and |
| 1974 | the search for edt-mapper is successful, you can try running it now.] | 1976 | the search for edt-mapper is successful, you can try running it now.] |
| @@ -1983,7 +1985,9 @@ created." | |||
| 1983 | (insert (format | 1985 | (insert (format |
| 1984 | "Ah yes, there it is, in \n\n %s \n\n" path)) | 1986 | "Ah yes, there it is, in \n\n %s \n\n" path)) |
| 1985 | (if (edt-y-or-n-p "Do you want to run it now? ") | 1987 | (if (edt-y-or-n-p "Do you want to run it now? ") |
| 1986 | (load-file path) | 1988 | (progn |
| 1989 | (load-file path) | ||
| 1990 | (edt-mapper)) | ||
| 1987 | (error "EDT Emulation not configured"))) | 1991 | (error "EDT Emulation not configured"))) |
| 1988 | (insert (substitute-command-keys | 1992 | (insert (substitute-command-keys |
| 1989 | "Nope, I can't seem to find it. :-(\n\n")) | 1993 | "Nope, I can't seem to find it. :-(\n\n")) |
diff --git a/lisp/files.el b/lisp/files.el index f60282b775a..b7d104853c3 100644 --- a/lisp/files.el +++ b/lisp/files.el | |||
| @@ -3723,7 +3723,8 @@ Return the new variables list." | |||
| 3723 | (let* ((file-name (or (buffer-file-name) | 3723 | (let* ((file-name (or (buffer-file-name) |
| 3724 | ;; Handle non-file buffers, too. | 3724 | ;; Handle non-file buffers, too. |
| 3725 | (expand-file-name default-directory))) | 3725 | (expand-file-name default-directory))) |
| 3726 | (sub-file-name (if file-name | 3726 | (sub-file-name (if (and file-name |
| 3727 | (file-name-absolute-p file-name)) | ||
| 3727 | ;; FIXME: Why not use file-relative-name? | 3728 | ;; FIXME: Why not use file-relative-name? |
| 3728 | (substring file-name (length root))))) | 3729 | (substring file-name (length root))))) |
| 3729 | (condition-case err | 3730 | (condition-case err |
| @@ -5133,6 +5134,14 @@ Before and after saving the buffer, this function runs | |||
| 5133 | "Non-nil means `save-some-buffers' should save this buffer without asking.") | 5134 | "Non-nil means `save-some-buffers' should save this buffer without asking.") |
| 5134 | (make-variable-buffer-local 'buffer-save-without-query) | 5135 | (make-variable-buffer-local 'buffer-save-without-query) |
| 5135 | 5136 | ||
| 5137 | (defcustom save-some-buffers-default-predicate nil | ||
| 5138 | "Default predicate for `save-some-buffers'. | ||
| 5139 | This allows you to stop `save-some-buffers' from asking | ||
| 5140 | about certain files that you'd usually rather not save." | ||
| 5141 | :group 'auto-save | ||
| 5142 | :type 'function | ||
| 5143 | :version "26.1") | ||
| 5144 | |||
| 5136 | (defun save-some-buffers (&optional arg pred) | 5145 | (defun save-some-buffers (&optional arg pred) |
| 5137 | "Save some modified file-visiting buffers. Asks user about each one. | 5146 | "Save some modified file-visiting buffers. Asks user about each one. |
| 5138 | You can answer `y' to save, `n' not to save, `C-r' to look at the | 5147 | You can answer `y' to save, `n' not to save, `C-r' to look at the |
| @@ -5148,10 +5157,13 @@ If PRED is nil, all the file-visiting buffers are considered. | |||
| 5148 | If PRED is t, then certain non-file buffers will also be considered. | 5157 | If PRED is t, then certain non-file buffers will also be considered. |
| 5149 | If PRED is a zero-argument function, it indicates for each buffer whether | 5158 | If PRED is a zero-argument function, it indicates for each buffer whether |
| 5150 | to consider it or not when called with that buffer current. | 5159 | to consider it or not when called with that buffer current. |
| 5160 | PRED defaults to the value of `save-some-buffers-default-predicate'. | ||
| 5151 | 5161 | ||
| 5152 | See `save-some-buffers-action-alist' if you want to | 5162 | See `save-some-buffers-action-alist' if you want to |
| 5153 | change the additional actions you can take on files." | 5163 | change the additional actions you can take on files." |
| 5154 | (interactive "P") | 5164 | (interactive "P") |
| 5165 | (unless pred | ||
| 5166 | (setq pred save-some-buffers-default-predicate)) | ||
| 5155 | (save-window-excursion | 5167 | (save-window-excursion |
| 5156 | (let* (queried autosaved-buffers | 5168 | (let* (queried autosaved-buffers |
| 5157 | files-done abbrevs-done) | 5169 | files-done abbrevs-done) |
| @@ -6571,7 +6583,7 @@ normally equivalent short `-D' option is just passed on to | |||
| 6571 | (unless (equal switches "") | 6583 | (unless (equal switches "") |
| 6572 | ;; Split the switches at any spaces so we can | 6584 | ;; Split the switches at any spaces so we can |
| 6573 | ;; pass separate options as separate args. | 6585 | ;; pass separate options as separate args. |
| 6574 | (split-string switches))) | 6586 | (split-string-and-unquote switches))) |
| 6575 | ;; Avoid lossage if FILE starts with `-'. | 6587 | ;; Avoid lossage if FILE starts with `-'. |
| 6576 | '("--") | 6588 | '("--") |
| 6577 | (progn | 6589 | (progn |
| @@ -6811,6 +6823,8 @@ asks whether processes should be killed. | |||
| 6811 | Runs the members of `kill-emacs-query-functions' in turn and stops | 6823 | Runs the members of `kill-emacs-query-functions' in turn and stops |
| 6812 | if any returns nil. If `confirm-kill-emacs' is non-nil, calls it." | 6824 | if any returns nil. If `confirm-kill-emacs' is non-nil, calls it." |
| 6813 | (interactive "P") | 6825 | (interactive "P") |
| 6826 | ;; Don't use save-some-buffers-default-predicate, because we want | ||
| 6827 | ;; to ask about all the buffers before killing Emacs. | ||
| 6814 | (save-some-buffers arg t) | 6828 | (save-some-buffers arg t) |
| 6815 | (let ((confirm confirm-kill-emacs)) | 6829 | (let ((confirm confirm-kill-emacs)) |
| 6816 | (and | 6830 | (and |
diff --git a/lisp/gnus/gnus-art.el b/lisp/gnus/gnus-art.el index e1af859516c..a4ff840f755 100644 --- a/lisp/gnus/gnus-art.el +++ b/lisp/gnus/gnus-art.el | |||
| @@ -251,7 +251,12 @@ This can also be a list of the above values." | |||
| 251 | (integer :value 200) | 251 | (integer :value 200) |
| 252 | (number :value 4.0) | 252 | (number :value 4.0) |
| 253 | function | 253 | function |
| 254 | (regexp :value ".*")) | 254 | (regexp :value ".*") |
| 255 | (repeat (choice (const nil) | ||
| 256 | (integer :value 200) | ||
| 257 | (number :value 4.0) | ||
| 258 | function | ||
| 259 | (regexp :value ".*")))) | ||
| 255 | :group 'gnus-article-signature) | 260 | :group 'gnus-article-signature) |
| 256 | 261 | ||
| 257 | (defcustom gnus-hidden-properties | 262 | (defcustom gnus-hidden-properties |
| @@ -1708,9 +1713,10 @@ regexp." | |||
| 1708 | ;; (modify-syntax-entry ?- "w" table) | 1713 | ;; (modify-syntax-entry ?- "w" table) |
| 1709 | (modify-syntax-entry ?> ")<" table) | 1714 | (modify-syntax-entry ?> ")<" table) |
| 1710 | (modify-syntax-entry ?< "(>" table) | 1715 | (modify-syntax-entry ?< "(>" table) |
| 1711 | ;; make M-. in article buffers work for `foo' strings | 1716 | ;; make M-. in article buffers work for `foo' strings, |
| 1712 | (modify-syntax-entry ?' " " table) | 1717 | ;; and still allow C-s C-w to yank ' to the search ring |
| 1713 | (modify-syntax-entry ?` " " table) | 1718 | (modify-syntax-entry ?' "'" table) |
| 1719 | (modify-syntax-entry ?` "'" table) | ||
| 1714 | table) | 1720 | table) |
| 1715 | "Syntax table used in article mode buffers. | 1721 | "Syntax table used in article mode buffers. |
| 1716 | Initialized from `text-mode-syntax-table'.") | 1722 | Initialized from `text-mode-syntax-table'.") |
| @@ -6841,17 +6847,21 @@ then we display only bindings that start with that prefix." | |||
| 6841 | (let ((keymap (copy-keymap gnus-article-mode-map)) | 6847 | (let ((keymap (copy-keymap gnus-article-mode-map)) |
| 6842 | (map (copy-keymap gnus-article-send-map)) | 6848 | (map (copy-keymap gnus-article-send-map)) |
| 6843 | (sumkeys (where-is-internal 'gnus-article-read-summary-keys)) | 6849 | (sumkeys (where-is-internal 'gnus-article-read-summary-keys)) |
| 6850 | (summap (make-sparse-keymap)) | ||
| 6844 | parent agent draft) | 6851 | parent agent draft) |
| 6845 | (define-key keymap "S" map) | 6852 | (define-key keymap "S" map) |
| 6846 | (define-key map [t] nil) | 6853 | (define-key map [t] nil) |
| 6854 | (define-key summap [t] 'undefined) | ||
| 6847 | (with-current-buffer gnus-article-current-summary | 6855 | (with-current-buffer gnus-article-current-summary |
| 6856 | (dolist (key sumkeys) | ||
| 6857 | (define-key summap key (key-binding key (current-local-map)))) | ||
| 6848 | (set-keymap-parent | 6858 | (set-keymap-parent |
| 6849 | keymap | 6859 | keymap |
| 6850 | (if (setq parent (keymap-parent gnus-article-mode-map)) | 6860 | (if (setq parent (keymap-parent gnus-article-mode-map)) |
| 6851 | (prog1 | 6861 | (prog1 |
| 6852 | (setq parent (copy-keymap parent)) | 6862 | (setq parent (copy-keymap parent)) |
| 6853 | (set-keymap-parent parent (current-local-map))) | 6863 | (set-keymap-parent parent summap)) |
| 6854 | (current-local-map))) | 6864 | summap)) |
| 6855 | (set-keymap-parent map (key-binding "S")) | 6865 | (set-keymap-parent map (key-binding "S")) |
| 6856 | (let (key def gnus-pick-mode) | 6866 | (let (key def gnus-pick-mode) |
| 6857 | (while sumkeys | 6867 | (while sumkeys |
diff --git a/lisp/gnus/gnus-msg.el b/lisp/gnus/gnus-msg.el index 19111171198..a193ab41348 100644 --- a/lisp/gnus/gnus-msg.el +++ b/lisp/gnus/gnus-msg.el | |||
| @@ -546,7 +546,8 @@ instead." | |||
| 546 | (gnus-setup-message 'message | 546 | (gnus-setup-message 'message |
| 547 | (message-mail to subject other-headers continue | 547 | (message-mail to subject other-headers continue |
| 548 | nil yank-action send-actions return-action))) | 548 | nil yank-action send-actions return-action))) |
| 549 | (setq gnus-newsgroup-name group-name)) | 549 | (with-current-buffer buf |
| 550 | (setq gnus-newsgroup-name group-name))) | ||
| 550 | (when switch-action | 551 | (when switch-action |
| 551 | (setq mail-buf (current-buffer)) | 552 | (setq mail-buf (current-buffer)) |
| 552 | (switch-to-buffer buf) | 553 | (switch-to-buffer buf) |
| @@ -1534,11 +1535,7 @@ If YANK is non-nil, include the original article." | |||
| 1534 | (message-pop-to-buffer "*Gnus Bug*")) | 1535 | (message-pop-to-buffer "*Gnus Bug*")) |
| 1535 | (let ((message-this-is-mail t)) | 1536 | (let ((message-this-is-mail t)) |
| 1536 | (message-setup `((To . ,gnus-maintainer) | 1537 | (message-setup `((To . ,gnus-maintainer) |
| 1537 | (Subject . "") | 1538 | (Subject . "")))) |
| 1538 | (X-Debbugs-Package | ||
| 1539 | . ,(format "%s" gnus-bug-package)) | ||
| 1540 | (X-Debbugs-Version | ||
| 1541 | . ,(format "%s" (gnus-continuum-version)))))) | ||
| 1542 | (when gnus-bug-create-help-buffer | 1539 | (when gnus-bug-create-help-buffer |
| 1543 | (push `(gnus-bug-kill-buffer) message-send-actions)) | 1540 | (push `(gnus-bug-kill-buffer) message-send-actions)) |
| 1544 | (goto-char (point-min)) | 1541 | (goto-char (point-min)) |
diff --git a/lisp/gnus/gnus-salt.el b/lisp/gnus/gnus-salt.el index 5361c2b86fc..7037328b7a4 100644 --- a/lisp/gnus/gnus-salt.el +++ b/lisp/gnus/gnus-salt.el | |||
| @@ -131,9 +131,7 @@ It accepts the same format specs that `gnus-summary-line-format' does." | |||
| 131 | (defvar gnus-pick-line-number 1) | 131 | (defvar gnus-pick-line-number 1) |
| 132 | (defun gnus-pick-line-number () | 132 | (defun gnus-pick-line-number () |
| 133 | "Return the current line number." | 133 | "Return the current line number." |
| 134 | (if (bobp) | 134 | (incf gnus-pick-line-number)) |
| 135 | (setq gnus-pick-line-number 1) | ||
| 136 | (incf gnus-pick-line-number))) | ||
| 137 | 135 | ||
| 138 | (defun gnus-pick-start-reading (&optional catch-up) | 136 | (defun gnus-pick-start-reading (&optional catch-up) |
| 139 | "Start reading the picked articles. | 137 | "Start reading the picked articles. |
diff --git a/lisp/gnus/gnus-start.el b/lisp/gnus/gnus-start.el index 47e33af96e8..be46339cd38 100644 --- a/lisp/gnus/gnus-start.el +++ b/lisp/gnus/gnus-start.el | |||
| @@ -2801,8 +2801,13 @@ If FORCE is non-nil, the .newsrc file is read." | |||
| 2801 | (gnus-run-hooks 'gnus-save-newsrc-hook) | 2801 | (gnus-run-hooks 'gnus-save-newsrc-hook) |
| 2802 | (if gnus-slave | 2802 | (if gnus-slave |
| 2803 | (gnus-slave-save-newsrc) | 2803 | (gnus-slave-save-newsrc) |
| 2804 | ;; Save .newsrc. | 2804 | ;; Save .newsrc only if the select method is an NNTP method. |
| 2805 | (when gnus-save-newsrc-file | 2805 | ;; The .newsrc file is for interoperability with other |
| 2806 | ;; newsreaders, so saving non-NNTP groups there doesn't make | ||
| 2807 | ;; much sense. | ||
| 2808 | (when (and gnus-save-newsrc-file | ||
| 2809 | (eq (car (gnus-server-to-method gnus-select-method)) | ||
| 2810 | 'nntp)) | ||
| 2806 | (gnus-message 8 "Saving %s..." gnus-current-startup-file) | 2811 | (gnus-message 8 "Saving %s..." gnus-current-startup-file) |
| 2807 | (gnus-gnus-to-newsrc-format) | 2812 | (gnus-gnus-to-newsrc-format) |
| 2808 | (gnus-message 8 "Saving %s...done" gnus-current-startup-file)) | 2813 | (gnus-message 8 "Saving %s...done" gnus-current-startup-file)) |
diff --git a/lisp/gnus/gnus-sum.el b/lisp/gnus/gnus-sum.el index 72e902a11f8..2631514e425 100644 --- a/lisp/gnus/gnus-sum.el +++ b/lisp/gnus/gnus-sum.el | |||
| @@ -1895,6 +1895,7 @@ increase the score of each group you read." | |||
| 1895 | "\C-c\C-s\C-m\C-n" gnus-summary-sort-by-most-recent-number | 1895 | "\C-c\C-s\C-m\C-n" gnus-summary-sort-by-most-recent-number |
| 1896 | "\C-c\C-s\C-l" gnus-summary-sort-by-lines | 1896 | "\C-c\C-s\C-l" gnus-summary-sort-by-lines |
| 1897 | "\C-c\C-s\C-c" gnus-summary-sort-by-chars | 1897 | "\C-c\C-s\C-c" gnus-summary-sort-by-chars |
| 1898 | "\C-c\C-s\C-m\C-m" gnus-summary-sort-by-marks | ||
| 1898 | "\C-c\C-s\C-a" gnus-summary-sort-by-author | 1899 | "\C-c\C-s\C-a" gnus-summary-sort-by-author |
| 1899 | "\C-c\C-s\C-t" gnus-summary-sort-by-recipient | 1900 | "\C-c\C-s\C-t" gnus-summary-sort-by-recipient |
| 1900 | "\C-c\C-s\C-s" gnus-summary-sort-by-subject | 1901 | "\C-c\C-s\C-s" gnus-summary-sort-by-subject |
| @@ -2748,6 +2749,7 @@ gnus-summary-show-article-from-menu-as-charset-%s" cs)))) | |||
| 2748 | ["Sort by score" gnus-summary-sort-by-score t] | 2749 | ["Sort by score" gnus-summary-sort-by-score t] |
| 2749 | ["Sort by lines" gnus-summary-sort-by-lines t] | 2750 | ["Sort by lines" gnus-summary-sort-by-lines t] |
| 2750 | ["Sort by characters" gnus-summary-sort-by-chars t] | 2751 | ["Sort by characters" gnus-summary-sort-by-chars t] |
| 2752 | ["Sort by marks" gnus-summary-sort-by-marks t] | ||
| 2751 | ["Randomize" gnus-summary-sort-by-random t] | 2753 | ["Randomize" gnus-summary-sort-by-random t] |
| 2752 | ["Original sort" gnus-summary-sort-by-original t]) | 2754 | ["Original sort" gnus-summary-sort-by-original t]) |
| 2753 | ("Help" | 2755 | ("Help" |
| @@ -3976,6 +3978,8 @@ If SELECT-ARTICLES, only select those articles from GROUP." | |||
| 3976 | ;; The group was successfully selected. | 3978 | ;; The group was successfully selected. |
| 3977 | (t | 3979 | (t |
| 3978 | (gnus-set-global-variables) | 3980 | (gnus-set-global-variables) |
| 3981 | (when (boundp 'gnus-pick-line-number) | ||
| 3982 | (setq gnus-pick-line-number 0)) | ||
| 3979 | (when (boundp 'spam-install-hooks) | 3983 | (when (boundp 'spam-install-hooks) |
| 3980 | (spam-initialize)) | 3984 | (spam-initialize)) |
| 3981 | ;; Save the active value in effect when the group was entered. | 3985 | ;; Save the active value in effect when the group was entered. |
| @@ -4037,6 +4041,9 @@ If SELECT-ARTICLES, only select those articles from GROUP." | |||
| 4037 | (when kill-buffer | 4041 | (when kill-buffer |
| 4038 | (gnus-kill-or-deaden-summary kill-buffer)) | 4042 | (gnus-kill-or-deaden-summary kill-buffer)) |
| 4039 | (gnus-summary-auto-select-subject) | 4043 | (gnus-summary-auto-select-subject) |
| 4044 | ;; Don't mark any articles as selected if we haven't done that. | ||
| 4045 | (when no-article | ||
| 4046 | (setq overlay-arrow-position nil)) | ||
| 4040 | ;; Show first unread article if requested. | 4047 | ;; Show first unread article if requested. |
| 4041 | (if (and (not no-article) | 4048 | (if (and (not no-article) |
| 4042 | (not no-display) | 4049 | (not no-display) |
| @@ -4941,6 +4948,16 @@ using some other form will lead to serious barfage." | |||
| 4941 | (gnus-article-sort-by-chars | 4948 | (gnus-article-sort-by-chars |
| 4942 | (gnus-thread-header h1) (gnus-thread-header h2))) | 4949 | (gnus-thread-header h1) (gnus-thread-header h2))) |
| 4943 | 4950 | ||
| 4951 | (defsubst gnus-article-sort-by-marks (h1 h2) | ||
| 4952 | "Sort articles by octet length." | ||
| 4953 | (< (gnus-article-mark (mail-header-number h1)) | ||
| 4954 | (gnus-article-mark (mail-header-number h2)))) | ||
| 4955 | |||
| 4956 | (defun gnus-thread-sort-by-marks (h1 h2) | ||
| 4957 | "Sort threads by root article octet length." | ||
| 4958 | (gnus-article-sort-by-marks | ||
| 4959 | (gnus-thread-header h1) (gnus-thread-header h2))) | ||
| 4960 | |||
| 4944 | (defsubst gnus-article-sort-by-author (h1 h2) | 4961 | (defsubst gnus-article-sort-by-author (h1 h2) |
| 4945 | "Sort articles by root author." | 4962 | "Sort articles by root author." |
| 4946 | (gnus-string< | 4963 | (gnus-string< |
| @@ -11925,6 +11942,12 @@ Argument REVERSE means reverse order." | |||
| 11925 | (interactive "P") | 11942 | (interactive "P") |
| 11926 | (gnus-summary-sort 'chars reverse)) | 11943 | (gnus-summary-sort 'chars reverse)) |
| 11927 | 11944 | ||
| 11945 | (defun gnus-summary-sort-by-mark (&optional reverse) | ||
| 11946 | "Sort the summary buffer by article marks. | ||
| 11947 | Argument REVERSE means reverse order." | ||
| 11948 | (interactive "P") | ||
| 11949 | (gnus-summary-sort 'marks reverse)) | ||
| 11950 | |||
| 11928 | (defun gnus-summary-sort-by-original (&optional reverse) | 11951 | (defun gnus-summary-sort-by-original (&optional reverse) |
| 11929 | "Sort the summary buffer using the default sorting method. | 11952 | "Sort the summary buffer using the default sorting method. |
| 11930 | Argument REVERSE means reverse order." | 11953 | Argument REVERSE means reverse order." |
| @@ -11970,7 +11993,10 @@ save those articles instead. | |||
| 11970 | The variable `gnus-default-article-saver' specifies the saver function. | 11993 | The variable `gnus-default-article-saver' specifies the saver function. |
| 11971 | 11994 | ||
| 11972 | If the optional second argument NOT-SAVED is non-nil, articles saved | 11995 | If the optional second argument NOT-SAVED is non-nil, articles saved |
| 11973 | will not be marked as saved." | 11996 | will not be marked as saved. |
| 11997 | |||
| 11998 | The `gnus-prompt-before-saving' variable says how prompting is | ||
| 11999 | performed." | ||
| 11974 | (interactive "P") | 12000 | (interactive "P") |
| 11975 | (require 'gnus-art) | 12001 | (require 'gnus-art) |
| 11976 | (let* ((articles (gnus-summary-work-articles n)) | 12002 | (let* ((articles (gnus-summary-work-articles n)) |
diff --git a/lisp/gnus/gnus-topic.el b/lisp/gnus/gnus-topic.el index 8ab8f462885..6d6e20dc129 100644 --- a/lisp/gnus/gnus-topic.el +++ b/lisp/gnus/gnus-topic.el | |||
| @@ -1564,7 +1564,7 @@ If UNINDENT, remove an indentation." | |||
| 1564 | (parent (gnus-topic-parent-topic topic)) | 1564 | (parent (gnus-topic-parent-topic topic)) |
| 1565 | (grandparent (gnus-topic-parent-topic parent))) | 1565 | (grandparent (gnus-topic-parent-topic parent))) |
| 1566 | (unless grandparent | 1566 | (unless grandparent |
| 1567 | (error "Nothing to indent %s into" topic)) | 1567 | (error "Can't unindent %s further" topic)) |
| 1568 | (when topic | 1568 | (when topic |
| 1569 | (gnus-topic-goto-topic topic) | 1569 | (gnus-topic-goto-topic topic) |
| 1570 | (gnus-topic-kill-group) | 1570 | (gnus-topic-kill-group) |
diff --git a/lisp/gnus/gnus.el b/lisp/gnus/gnus.el index ef6bd89c36e..bbf85fe584a 100644 --- a/lisp/gnus/gnus.el +++ b/lisp/gnus/gnus.el | |||
| @@ -2654,10 +2654,6 @@ such as a mark that says whether an article is stored in the cache | |||
| 2654 | "submit@debbugs.gnu.org (The Gnus Bugfixing Girls + Boys)" | 2654 | "submit@debbugs.gnu.org (The Gnus Bugfixing Girls + Boys)" |
| 2655 | "The mail address of the Gnus maintainers.") | 2655 | "The mail address of the Gnus maintainers.") |
| 2656 | 2656 | ||
| 2657 | (defconst gnus-bug-package | ||
| 2658 | "gnus" | ||
| 2659 | "The package to use in the bug submission.") | ||
| 2660 | |||
| 2661 | (defvar gnus-info-nodes | 2657 | (defvar gnus-info-nodes |
| 2662 | '((gnus-group-mode "(gnus)Group Buffer") | 2658 | '((gnus-group-mode "(gnus)Group Buffer") |
| 2663 | (gnus-summary-mode "(gnus)Summary Buffer") | 2659 | (gnus-summary-mode "(gnus)Summary Buffer") |
diff --git a/lisp/gnus/message.el b/lisp/gnus/message.el index 4d4ba089434..ce0dad9cb05 100644 --- a/lisp/gnus/message.el +++ b/lisp/gnus/message.el | |||
| @@ -2286,13 +2286,15 @@ body, set `message-archive-note' to nil." | |||
| 2286 | "Mangles FollowUp-To and Newsgroups header to point to TARGET-GROUP. | 2286 | "Mangles FollowUp-To and Newsgroups header to point to TARGET-GROUP. |
| 2287 | With prefix-argument just set Follow-Up, don't cross-post." | 2287 | With prefix-argument just set Follow-Up, don't cross-post." |
| 2288 | (interactive | 2288 | (interactive |
| 2289 | (list ; Completion based on Gnus | 2289 | (list ; Completion based on Gnus |
| 2290 | (completing-read "Followup To: " | 2290 | (replace-regexp-in-string |
| 2291 | (if (boundp 'gnus-newsrc-alist) | 2291 | "\\`.*:" "" |
| 2292 | gnus-newsrc-alist) | 2292 | (completing-read "Followup To: " |
| 2293 | nil nil '("poster" . 0) | 2293 | (if (boundp 'gnus-newsrc-alist) |
| 2294 | (if (boundp 'gnus-group-history) | 2294 | gnus-newsrc-alist) |
| 2295 | 'gnus-group-history)))) | 2295 | nil nil '("poster" . 0) |
| 2296 | (if (boundp 'gnus-group-history) | ||
| 2297 | 'gnus-group-history))))) | ||
| 2296 | (message-remove-header "Follow[Uu]p-[Tt]o" t) | 2298 | (message-remove-header "Follow[Uu]p-[Tt]o" t) |
| 2297 | (message-goto-newsgroups) | 2299 | (message-goto-newsgroups) |
| 2298 | (beginning-of-line) | 2300 | (beginning-of-line) |
| @@ -2361,13 +2363,15 @@ been made to before the user asked for a Crosspost." | |||
| 2361 | "Crossposts message and set Followup-To to TARGET-GROUP. | 2363 | "Crossposts message and set Followup-To to TARGET-GROUP. |
| 2362 | With prefix-argument just set Follow-Up, don't cross-post." | 2364 | With prefix-argument just set Follow-Up, don't cross-post." |
| 2363 | (interactive | 2365 | (interactive |
| 2364 | (list ; Completion based on Gnus | 2366 | (list ; Completion based on Gnus |
| 2365 | (completing-read "Followup To: " | 2367 | (replace-regexp-in-string |
| 2366 | (if (boundp 'gnus-newsrc-alist) | 2368 | "\\`.*:" "" |
| 2367 | gnus-newsrc-alist) | 2369 | (completing-read "Followup To: " |
| 2368 | nil nil '("poster" . 0) | 2370 | (if (boundp 'gnus-newsrc-alist) |
| 2369 | (if (boundp 'gnus-group-history) | 2371 | gnus-newsrc-alist) |
| 2370 | 'gnus-group-history)))) | 2372 | nil nil '("poster" . 0) |
| 2373 | (if (boundp 'gnus-group-history) | ||
| 2374 | 'gnus-group-history))))) | ||
| 2371 | (when (fboundp 'gnus-group-real-name) | 2375 | (when (fboundp 'gnus-group-real-name) |
| 2372 | (setq target-group (gnus-group-real-name target-group))) | 2376 | (setq target-group (gnus-group-real-name target-group))) |
| 2373 | (cond ((not (or (null target-group) ; new subject not empty | 2377 | (cond ((not (or (null target-group) ; new subject not empty |
| @@ -3108,18 +3112,29 @@ M-RET `message-newline-and-reformat' (break the line and reformat)." | |||
| 3108 | (looking-at "[ \t]*\n")) | 3112 | (looking-at "[ \t]*\n")) |
| 3109 | (expand-abbrev)) | 3113 | (expand-abbrev)) |
| 3110 | (push-mark) | 3114 | (push-mark) |
| 3115 | (message-goto-body-1)) | ||
| 3116 | |||
| 3117 | (defun message-goto-body-1 () | ||
| 3118 | "Go to the body and return point." | ||
| 3111 | (goto-char (point-min)) | 3119 | (goto-char (point-min)) |
| 3112 | (or (search-forward (concat "\n" mail-header-separator "\n") nil t) | 3120 | (or (search-forward (concat "\n" mail-header-separator "\n") nil t) |
| 3113 | (search-forward-regexp "[^:]+:\\([^\n]\\|\n[ \t]\\)+\n\n" nil t))) | 3121 | ;; If the message is mangled, find the end of the headers the |
| 3122 | ;; hard way. | ||
| 3123 | (progn | ||
| 3124 | ;; Skip past all headers and continuation lines. | ||
| 3125 | (while (looking-at "[^:]+:\\|[\t ]+[^\t ]") | ||
| 3126 | (forward-line 1)) | ||
| 3127 | ;; We're now at the first empty line, so perhaps move past it. | ||
| 3128 | (when (and (eolp) | ||
| 3129 | (not (eobp))) | ||
| 3130 | (forward-line 1)) | ||
| 3131 | (point)))) | ||
| 3114 | 3132 | ||
| 3115 | (defun message-in-body-p () | 3133 | (defun message-in-body-p () |
| 3116 | "Return t if point is in the message body." | 3134 | "Return t if point is in the message body." |
| 3117 | (>= (point) | 3135 | (>= (point) |
| 3118 | (save-excursion | 3136 | (save-excursion |
| 3119 | (goto-char (point-min)) | 3137 | (message-goto-body-1)))) |
| 3120 | (or (search-forward (concat "\n" mail-header-separator "\n") nil t) | ||
| 3121 | (search-forward-regexp "[^:]+:\\([^\n]\\|\n[ \t]\\)+\n\n" nil t)) | ||
| 3122 | (point)))) | ||
| 3123 | 3138 | ||
| 3124 | (defun message-goto-eoh () | 3139 | (defun message-goto-eoh () |
| 3125 | "Move point to the end of the headers." | 3140 | "Move point to the end of the headers." |
| @@ -3330,6 +3345,8 @@ of lines before the signature intact." | |||
| 3330 | "Insert four newlines, and then reformat if inside quoted text. | 3345 | "Insert four newlines, and then reformat if inside quoted text. |
| 3331 | Prefix arg means justify as well." | 3346 | Prefix arg means justify as well." |
| 3332 | (interactive (list (if current-prefix-arg 'full))) | 3347 | (interactive (list (if current-prefix-arg 'full))) |
| 3348 | (unless (message-in-body-p) | ||
| 3349 | (error "This command only works in the body of the message")) | ||
| 3333 | (let (quoted point beg end leading-space bolp fill-paragraph-function) | 3350 | (let (quoted point beg end leading-space bolp fill-paragraph-function) |
| 3334 | (setq point (point)) | 3351 | (setq point (point)) |
| 3335 | (beginning-of-line) | 3352 | (beginning-of-line) |
| @@ -4102,8 +4119,8 @@ It should typically alter the sending method in some way or other." | |||
| 4102 | (let ((inhibit-read-only t)) | 4119 | (let ((inhibit-read-only t)) |
| 4103 | (put-text-property (point-min) (point-max) 'read-only nil)) | 4120 | (put-text-property (point-min) (point-max) 'read-only nil)) |
| 4104 | (message-fix-before-sending) | 4121 | (message-fix-before-sending) |
| 4105 | (mml-secure-bcc-is-safe) | ||
| 4106 | (run-hooks 'message-send-hook) | 4122 | (run-hooks 'message-send-hook) |
| 4123 | (mml-secure-bcc-is-safe) | ||
| 4107 | (when message-confirm-send | 4124 | (when message-confirm-send |
| 4108 | (or (y-or-n-p "Send message? ") | 4125 | (or (y-or-n-p "Send message? ") |
| 4109 | (keyboard-quit))) | 4126 | (keyboard-quit))) |
| @@ -4539,6 +4556,9 @@ This function could be useful in `message-setup-hook'." | |||
| 4539 | (forward-line 1) | 4556 | (forward-line 1) |
| 4540 | (unless (y-or-n-p "Send anyway? ") | 4557 | (unless (y-or-n-p "Send anyway? ") |
| 4541 | (error "Failed to send the message"))))) | 4558 | (error "Failed to send the message"))))) |
| 4559 | ;; Fold too-long header lines. They should be no longer than | ||
| 4560 | ;; 998 octets long. | ||
| 4561 | (message--fold-long-headers) | ||
| 4542 | ;; Let the user do all of the above. | 4562 | ;; Let the user do all of the above. |
| 4543 | (run-hooks 'message-header-hook)) | 4563 | (run-hooks 'message-header-hook)) |
| 4544 | (setq options message-options) | 4564 | (setq options message-options) |
| @@ -4635,6 +4655,14 @@ If you always want Gnus to send messages in one piece, set | |||
| 4635 | (setq message-options options) | 4655 | (setq message-options options) |
| 4636 | (push 'mail message-sent-message-via))) | 4656 | (push 'mail message-sent-message-via))) |
| 4637 | 4657 | ||
| 4658 | (defun message--fold-long-headers () | ||
| 4659 | (goto-char (point-min)) | ||
| 4660 | (while (not (eobp)) | ||
| 4661 | (when (and (looking-at "[^:]+:") | ||
| 4662 | (> (- (line-end-position) (point)) 998)) | ||
| 4663 | (mail-header-fold-field)) | ||
| 4664 | (forward-line 1))) | ||
| 4665 | |||
| 4638 | (defvar sendmail-program) | 4666 | (defvar sendmail-program) |
| 4639 | (defvar smtpmail-smtp-server) | 4667 | (defvar smtpmail-smtp-server) |
| 4640 | (defvar smtpmail-smtp-service) | 4668 | (defvar smtpmail-smtp-service) |
| @@ -5380,16 +5408,13 @@ Otherwise, generate and save a value for `canlock-password' first." | |||
| 5380 | "Process Fcc headers in the current buffer." | 5408 | "Process Fcc headers in the current buffer." |
| 5381 | (let ((case-fold-search t) | 5409 | (let ((case-fold-search t) |
| 5382 | (buf (current-buffer)) | 5410 | (buf (current-buffer)) |
| 5383 | list file | 5411 | (mml-externalize-attachments message-fcc-externalize-attachments) |
| 5384 | (mml-externalize-attachments message-fcc-externalize-attachments)) | 5412 | (file (message-field-value "fcc" t)) |
| 5385 | (save-excursion | 5413 | list) |
| 5386 | (save-restriction | 5414 | (when file |
| 5387 | (message-narrow-to-headers) | 5415 | (with-temp-buffer |
| 5388 | (setq file (message-fetch-field "fcc" t))) | ||
| 5389 | (when file | ||
| 5390 | (set-buffer (get-buffer-create " *message temp*")) | ||
| 5391 | (erase-buffer) | ||
| 5392 | (insert-buffer-substring buf) | 5416 | (insert-buffer-substring buf) |
| 5417 | (message-clone-locals buf) | ||
| 5393 | (message-encode-message-body) | 5418 | (message-encode-message-body) |
| 5394 | (save-restriction | 5419 | (save-restriction |
| 5395 | (message-narrow-to-headers) | 5420 | (message-narrow-to-headers) |
| @@ -5429,8 +5454,7 @@ Otherwise, generate and save a value for `canlock-password' first." | |||
| 5429 | (if (and (file-readable-p file) (mail-file-babyl-p file)) | 5454 | (if (and (file-readable-p file) (mail-file-babyl-p file)) |
| 5430 | (rmail-output file 1 nil t) | 5455 | (rmail-output file 1 nil t) |
| 5431 | (let ((mail-use-rfc822 t)) | 5456 | (let ((mail-use-rfc822 t)) |
| 5432 | (rmail-output file 1 t t)))))) | 5457 | (rmail-output file 1 t t)))))))))) |
| 5433 | (kill-buffer (current-buffer)))))) | ||
| 5434 | 5458 | ||
| 5435 | (defun message-output (filename) | 5459 | (defun message-output (filename) |
| 5436 | "Append this article to Unix/babyl mail file FILENAME." | 5460 | "Append this article to Unix/babyl mail file FILENAME." |
| @@ -5761,7 +5785,7 @@ give as trustworthy answer as possible." | |||
| 5761 | (not (string-match message-bogus-system-names message-user-fqdn))) | 5785 | (not (string-match message-bogus-system-names message-user-fqdn))) |
| 5762 | ;; `message-user-fqdn' seems to be valid | 5786 | ;; `message-user-fqdn' seems to be valid |
| 5763 | message-user-fqdn) | 5787 | message-user-fqdn) |
| 5764 | ((and (string-match message-bogus-system-names sysname)) | 5788 | ((not (string-match message-bogus-system-names sysname)) |
| 5765 | ;; `system-name' returned the right result. | 5789 | ;; `system-name' returned the right result. |
| 5766 | sysname) | 5790 | sysname) |
| 5767 | ;; Try `mail-host-address'. | 5791 | ;; Try `mail-host-address'. |
| @@ -6644,29 +6668,27 @@ OTHER-HEADERS is an alist of header/value pairs. CONTINUE says whether | |||
| 6644 | to continue editing a message already being composed. SWITCH-FUNCTION | 6668 | to continue editing a message already being composed. SWITCH-FUNCTION |
| 6645 | is a function used to switch to and display the mail buffer." | 6669 | is a function used to switch to and display the mail buffer." |
| 6646 | (interactive) | 6670 | (interactive) |
| 6647 | (let ((message-this-is-mail t)) | 6671 | (let ((message-this-is-mail t) |
| 6648 | (unless (message-mail-user-agent) | 6672 | message-buffers) |
| 6649 | (message-pop-to-buffer | 6673 | ;; Search for the existing message buffer if `continue' is non-nil. |
| 6650 | ;; Search for the existing message buffer if `continue' is non-nil. | 6674 | (if (and continue |
| 6651 | (let ((message-generate-new-buffers | 6675 | (setq message-buffers (message-buffers))) |
| 6652 | (when (or (not continue) | 6676 | (pop-to-buffer (car message-buffers)) |
| 6653 | (eq message-generate-new-buffers 'standard) | 6677 | ;; Start a new buffer. |
| 6654 | (functionp message-generate-new-buffers)) | 6678 | (unless (message-mail-user-agent) |
| 6655 | message-generate-new-buffers))) | 6679 | (message-pop-to-buffer (message-buffer-name "mail" to) switch-function)) |
| 6656 | (message-buffer-name "mail" to)) | 6680 | (message-setup |
| 6657 | switch-function)) | 6681 | (nconc |
| 6658 | (message-setup | 6682 | `((To . ,(or to "")) (Subject . ,(or subject ""))) |
| 6659 | (nconc | 6683 | ;; C-h f compose-mail says that headers should be specified as |
| 6660 | `((To . ,(or to "")) (Subject . ,(or subject ""))) | 6684 | ;; (string . value); however all the rest of message expects |
| 6661 | ;; C-h f compose-mail says that headers should be specified as | 6685 | ;; headers to be symbols, not strings (eg message-header-format-alist). |
| 6662 | ;; (string . value); however all the rest of message expects | 6686 | ;; http://lists.gnu.org/archive/html/emacs-devel/2011-01/msg00337.html |
| 6663 | ;; headers to be symbols, not strings (eg message-header-format-alist). | 6687 | ;; We need to convert any string input, eg from rmail-start-mail. |
| 6664 | ;; http://lists.gnu.org/archive/html/emacs-devel/2011-01/msg00337.html | 6688 | (dolist (h other-headers other-headers) |
| 6665 | ;; We need to convert any string input, eg from rmail-start-mail. | 6689 | (if (stringp (car h)) (setcar h (intern (capitalize (car h))))))) |
| 6666 | (dolist (h other-headers other-headers) | 6690 | yank-action send-actions continue switch-function |
| 6667 | (if (stringp (car h)) (setcar h (intern (capitalize (car h))))))) | 6691 | return-action)))) |
| 6668 | yank-action send-actions continue switch-function | ||
| 6669 | return-action))) | ||
| 6670 | 6692 | ||
| 6671 | ;;;###autoload | 6693 | ;;;###autoload |
| 6672 | (defun message-news (&optional newsgroups subject) | 6694 | (defun message-news (&optional newsgroups subject) |
diff --git a/lisp/gnus/mml.el b/lisp/gnus/mml.el index 6d13d892b5a..3a31349d378 100644 --- a/lisp/gnus/mml.el +++ b/lisp/gnus/mml.el | |||
| @@ -486,7 +486,8 @@ be \"related\" or \"alternate\"." | |||
| 486 | (equal (cdr (assq 'type (car cont))) "text/html")) | 486 | (equal (cdr (assq 'type (car cont))) "text/html")) |
| 487 | (setq cont (mml-expand-html-into-multipart-related (car cont)))) | 487 | (setq cont (mml-expand-html-into-multipart-related (car cont)))) |
| 488 | (prog1 | 488 | (prog1 |
| 489 | (mm-with-multibyte-buffer | 489 | (with-temp-buffer |
| 490 | (set-buffer-multibyte nil) | ||
| 490 | (setq message-options options) | 491 | (setq message-options options) |
| 491 | (cond | 492 | (cond |
| 492 | ((and (consp (car cont)) | 493 | ((and (consp (car cont)) |
| @@ -605,28 +606,38 @@ be \"related\" or \"alternate\"." | |||
| 605 | (intern (downcase charset)))))) | 606 | (intern (downcase charset)))))) |
| 606 | (if (and (not raw) | 607 | (if (and (not raw) |
| 607 | (member (car (split-string type "/")) '("text" "message"))) | 608 | (member (car (split-string type "/")) '("text" "message"))) |
| 609 | ;; We have a text-like MIME part, so we need to do | ||
| 610 | ;; charset encoding. | ||
| 608 | (progn | 611 | (progn |
| 609 | (with-temp-buffer | 612 | (with-temp-buffer |
| 610 | (cond | 613 | (set-buffer-multibyte nil) |
| 611 | ((cdr (assq 'buffer cont)) | 614 | ;; First insert the data into the buffer. |
| 612 | (insert-buffer-substring (cdr (assq 'buffer cont)))) | 615 | (if (and filename |
| 613 | ((and filename | 616 | (not (equal (cdr (assq 'nofile cont)) "yes"))) |
| 614 | (not (equal (cdr (assq 'nofile cont)) "yes"))) | 617 | (mm-insert-file-contents filename) |
| 615 | (let ((coding-system-for-read coding)) | 618 | (insert |
| 616 | (mm-insert-file-contents filename))) | 619 | (with-temp-buffer |
| 617 | ((eq 'mml (car cont)) | 620 | (cond |
| 618 | (insert (cdr (assq 'contents cont)))) | 621 | ((cdr (assq 'buffer cont)) |
| 619 | (t | 622 | (insert-buffer-substring (cdr (assq 'buffer cont)))) |
| 620 | (save-restriction | 623 | ((eq 'mml (car cont)) |
| 621 | (narrow-to-region (point) (point)) | 624 | (insert (cdr (assq 'contents cont)))) |
| 622 | (insert (cdr (assq 'contents cont))) | 625 | (t |
| 623 | ;; Remove quotes from quoted tags. | 626 | (insert (cdr (assq 'contents cont))) |
| 624 | (goto-char (point-min)) | 627 | ;; Remove quotes from quoted tags. |
| 625 | (while (re-search-forward | 628 | (goto-char (point-min)) |
| 626 | "<#!+/?\\(part\\|multipart\\|external\\|mml\\|secure\\)" | 629 | (while (re-search-forward |
| 627 | nil t) | 630 | "<#!+/?\\(part\\|multipart\\|external\\|mml\\|secure\\)" |
| 628 | (delete-region (+ (match-beginning 0) 2) | 631 | nil t) |
| 629 | (+ (match-beginning 0) 3)))))) | 632 | (delete-region (+ (match-beginning 0) 2) |
| 633 | (+ (match-beginning 0) 3))))) | ||
| 634 | (setq charset | ||
| 635 | (mm-coding-system-to-mime-charset | ||
| 636 | (detect-coding-region | ||
| 637 | (point-min) (point-max) t))) | ||
| 638 | (encode-coding-region (point-min) (point-max) | ||
| 639 | charset) | ||
| 640 | (buffer-string)))) | ||
| 630 | (cond | 641 | (cond |
| 631 | ((eq (car cont) 'mml) | 642 | ((eq (car cont) 'mml) |
| 632 | (let ((mml-boundary (mml-compute-boundary cont)) | 643 | (let ((mml-boundary (mml-compute-boundary cont)) |
| @@ -667,21 +678,22 @@ be \"related\" or \"alternate\"." | |||
| 667 | ;; insert a "; format=flowed" string unless the | 678 | ;; insert a "; format=flowed" string unless the |
| 668 | ;; user has already specified it. | 679 | ;; user has already specified it. |
| 669 | (setq flowed (null (assq 'format cont))))) | 680 | (setq flowed (null (assq 'format cont))))) |
| 670 | ;; Prefer `utf-8' for text/calendar parts. | 681 | (unless charset |
| 671 | (if (or charset | 682 | (setq charset |
| 672 | (not (string= type "text/calendar"))) | 683 | ;; Prefer `utf-8' for text/calendar parts. |
| 673 | (setq charset (mm-encode-body charset)) | 684 | (if (string= type "text/calendar") |
| 674 | (let ((mm-coding-system-priorities | 685 | 'utf-8 |
| 675 | (cons 'utf-8 mm-coding-system-priorities))) | 686 | (mm-coding-system-to-mime-charset |
| 676 | (setq charset (mm-encode-body)))) | 687 | (detect-coding-region |
| 677 | (mm-disable-multibyte) | 688 | (point-min) (point-max) t))))) |
| 678 | (setq encoding (mm-body-encoding | 689 | (setq encoding (mm-body-encoding |
| 679 | charset (cdr (assq 'encoding cont)))))) | 690 | charset (cdr (assq 'encoding cont)))))) |
| 680 | (setq coded (buffer-string))) | 691 | (setq coded (buffer-string))) |
| 681 | (mml-insert-mime-headers cont type charset encoding flowed) | 692 | (mml-insert-mime-headers cont type charset encoding flowed) |
| 682 | (insert "\n") | 693 | (insert "\n") |
| 683 | (insert coded)) | 694 | (insert coded)) |
| 684 | (mm-with-unibyte-buffer | 695 | (with-temp-buffer |
| 696 | (set-buffer-multibyte nil) | ||
| 685 | (cond | 697 | (cond |
| 686 | ((cdr (assq 'buffer cont)) | 698 | ((cdr (assq 'buffer cont)) |
| 687 | (insert (string-as-unibyte | 699 | (insert (string-as-unibyte |
| @@ -690,11 +702,7 @@ be \"related\" or \"alternate\"." | |||
| 690 | ((and filename | 702 | ((and filename |
| 691 | (not (equal (cdr (assq 'nofile cont)) "yes"))) | 703 | (not (equal (cdr (assq 'nofile cont)) "yes"))) |
| 692 | (let ((coding-system-for-read mm-binary-coding-system)) | 704 | (let ((coding-system-for-read mm-binary-coding-system)) |
| 693 | (mm-insert-file-contents filename nil nil nil nil t)) | 705 | (mm-insert-file-contents filename nil nil nil nil t))) |
| 694 | (unless charset | ||
| 695 | (setq charset (mm-coding-system-to-mime-charset | ||
| 696 | (mm-find-buffer-file-coding-system | ||
| 697 | filename))))) | ||
| 698 | (t | 706 | (t |
| 699 | (let ((contents (cdr (assq 'contents cont)))) | 707 | (let ((contents (cdr (assq 'contents cont)))) |
| 700 | (if (multibyte-string-p contents) | 708 | (if (multibyte-string-p contents) |
| @@ -1244,6 +1252,7 @@ If not set, `default-directory' will be used." | |||
| 1244 | 1252 | ||
| 1245 | (defun mml-minibuffer-read-file (prompt) | 1253 | (defun mml-minibuffer-read-file (prompt) |
| 1246 | (let* ((completion-ignored-extensions nil) | 1254 | (let* ((completion-ignored-extensions nil) |
| 1255 | (buffer-file-name nil) | ||
| 1247 | (file (read-file-name prompt | 1256 | (file (read-file-name prompt |
| 1248 | (or mml-default-directory default-directory) | 1257 | (or mml-default-directory default-directory) |
| 1249 | nil t))) | 1258 | nil t))) |
| @@ -1378,12 +1387,23 @@ content-type, a string of the form \"type/subtype\". DESCRIPTION | |||
| 1378 | is a one-line description of the attachment. The DISPOSITION | 1387 | is a one-line description of the attachment. The DISPOSITION |
| 1379 | specifies how the attachment is intended to be displayed. It can | 1388 | specifies how the attachment is intended to be displayed. It can |
| 1380 | be either \"inline\" (displayed automatically within the message | 1389 | be either \"inline\" (displayed automatically within the message |
| 1381 | body) or \"attachment\" (separate from the body)." | 1390 | body) or \"attachment\" (separate from the body). |
| 1391 | |||
| 1392 | If given a prefix interactively, no prompting will be done for | ||
| 1393 | the TYPE, DESCRIPTION or DISPOSITION values. Instead defaults | ||
| 1394 | will be computed and used." | ||
| 1382 | (interactive | 1395 | (interactive |
| 1383 | (let* ((file (mml-minibuffer-read-file "Attach file: ")) | 1396 | (let* ((file (mml-minibuffer-read-file "Attach file: ")) |
| 1384 | (type (mml-minibuffer-read-type file)) | 1397 | (type (if current-prefix-arg |
| 1385 | (description (mml-minibuffer-read-description)) | 1398 | (or (mm-default-file-encoding file) |
| 1386 | (disposition (mml-minibuffer-read-disposition type nil file))) | 1399 | "application/octet-stream") |
| 1400 | (mml-minibuffer-read-type file))) | ||
| 1401 | (description (if current-prefix-arg | ||
| 1402 | nil | ||
| 1403 | (mml-minibuffer-read-description))) | ||
| 1404 | (disposition (if current-prefix-arg | ||
| 1405 | (mml-content-disposition type file) | ||
| 1406 | (mml-minibuffer-read-disposition type nil file)))) | ||
| 1387 | (list file type description disposition))) | 1407 | (list file type description disposition))) |
| 1388 | ;; If in the message header, attach at the end and leave point unchanged. | 1408 | ;; If in the message header, attach at the end and leave point unchanged. |
| 1389 | (let ((head (unless (message-in-body-p) (point)))) | 1409 | (let ((head (unless (message-in-body-p) (point)))) |
diff --git a/lisp/gnus/nndoc.el b/lisp/gnus/nndoc.el index ede118d6eb6..7f7db8721db 100644 --- a/lisp/gnus/nndoc.el +++ b/lisp/gnus/nndoc.el | |||
| @@ -356,14 +356,18 @@ from the document.") | |||
| 356 | (setq nndoc-dissection-alist nil) | 356 | (setq nndoc-dissection-alist nil) |
| 357 | (with-current-buffer nndoc-current-buffer | 357 | (with-current-buffer nndoc-current-buffer |
| 358 | (erase-buffer) | 358 | (erase-buffer) |
| 359 | (if (and (stringp nndoc-address) | 359 | (condition-case error |
| 360 | (string-match nndoc-binary-file-names nndoc-address)) | 360 | (if (and (stringp nndoc-address) |
| 361 | (let ((coding-system-for-read 'binary)) | 361 | (string-match nndoc-binary-file-names nndoc-address)) |
| 362 | (mm-insert-file-contents nndoc-address)) | 362 | (let ((coding-system-for-read 'binary)) |
| 363 | (if (stringp nndoc-address) | 363 | (mm-insert-file-contents nndoc-address)) |
| 364 | (nnheader-insert-file-contents nndoc-address) | 364 | (if (stringp nndoc-address) |
| 365 | (insert-buffer-substring nndoc-address)) | 365 | (nnheader-insert-file-contents nndoc-address) |
| 366 | (run-hooks 'nndoc-open-document-hook))))) | 366 | (insert-buffer-substring nndoc-address)) |
| 367 | (run-hooks 'nndoc-open-document-hook)) | ||
| 368 | (file-error | ||
| 369 | (nnheader-report 'nndoc "Couldn't open %s: %s" | ||
| 370 | group error)))))) | ||
| 367 | ;; Initialize the nndoc structures according to this new document. | 371 | ;; Initialize the nndoc structures according to this new document. |
| 368 | (when (and nndoc-current-buffer | 372 | (when (and nndoc-current-buffer |
| 369 | (not nndoc-dissection-alist)) | 373 | (not nndoc-dissection-alist)) |
diff --git a/lisp/gnus/nnimap.el b/lisp/gnus/nnimap.el index 700e86a0c57..2943c8dc7d2 100644 --- a/lisp/gnus/nnimap.el +++ b/lisp/gnus/nnimap.el | |||
| @@ -67,7 +67,11 @@ back on `network'.") | |||
| 67 | (if (listp imap-shell-program) | 67 | (if (listp imap-shell-program) |
| 68 | (car imap-shell-program) | 68 | (car imap-shell-program) |
| 69 | imap-shell-program) | 69 | imap-shell-program) |
| 70 | "ssh %s imapd")) | 70 | "ssh %s imapd") |
| 71 | "What command to execute to connect to an IMAP server. | ||
| 72 | This will only be used if the connection type is `shell'. See | ||
| 73 | the `open-network-stream' documentation for an explanation of | ||
| 74 | the format.") | ||
| 71 | 75 | ||
| 72 | (defvoo nnimap-inbox nil | 76 | (defvoo nnimap-inbox nil |
| 73 | "The mail box where incoming mail arrives and should be split out of. | 77 | "The mail box where incoming mail arrives and should be split out of. |
diff --git a/lisp/help-fns.el b/lisp/help-fns.el index fa16fa0bb67..742c66919af 100644 --- a/lisp/help-fns.el +++ b/lisp/help-fns.el | |||
| @@ -115,13 +115,15 @@ When called from lisp, FUNCTION may also be a function object." | |||
| 115 | (if fn | 115 | (if fn |
| 116 | (format "Describe function (default %s): " fn) | 116 | (format "Describe function (default %s): " fn) |
| 117 | "Describe function: ") | 117 | "Describe function: ") |
| 118 | #'help--symbol-completion-table #'fboundp t nil nil | 118 | #'help--symbol-completion-table |
| 119 | (lambda (f) (or (fboundp f) (get f 'function-documentation))) | ||
| 120 | t nil nil | ||
| 119 | (and fn (symbol-name fn))))) | 121 | (and fn (symbol-name fn))))) |
| 120 | (unless (equal val "") | 122 | (unless (equal val "") |
| 121 | (setq fn (intern val))) | 123 | (setq fn (intern val))) |
| 122 | (unless (and fn (symbolp fn)) | 124 | (unless (and fn (symbolp fn)) |
| 123 | (user-error "You didn't specify a function symbol")) | 125 | (user-error "You didn't specify a function symbol")) |
| 124 | (unless (fboundp fn) | 126 | (unless (or (fboundp fn) (get fn 'function-documentation)) |
| 125 | (user-error "Symbol's function definition is void: %s" fn)) | 127 | (user-error "Symbol's function definition is void: %s" fn)) |
| 126 | (list fn))) | 128 | (list fn))) |
| 127 | 129 | ||
| @@ -144,7 +146,9 @@ When called from lisp, FUNCTION may also be a function object." | |||
| 144 | 146 | ||
| 145 | (save-excursion | 147 | (save-excursion |
| 146 | (with-help-window (help-buffer) | 148 | (with-help-window (help-buffer) |
| 147 | (prin1 function) | 149 | (if (get function 'reader-construct) |
| 150 | (princ function) | ||
| 151 | (prin1 function)) | ||
| 148 | ;; Use " is " instead of a colon so that | 152 | ;; Use " is " instead of a colon so that |
| 149 | ;; it is easier to get out the function name using forward-sexp. | 153 | ;; it is easier to get out the function name using forward-sexp. |
| 150 | (princ " is ") | 154 | (princ " is ") |
| @@ -469,7 +473,8 @@ suitable file is found, return nil." | |||
| 469 | (let ((fill-begin (point)) | 473 | (let ((fill-begin (point)) |
| 470 | (high-usage (car high)) | 474 | (high-usage (car high)) |
| 471 | (high-doc (cdr high))) | 475 | (high-doc (cdr high))) |
| 472 | (insert high-usage "\n") | 476 | (unless (get function 'reader-construct) |
| 477 | (insert high-usage "\n")) | ||
| 473 | (fill-region fill-begin (point)) | 478 | (fill-region fill-begin (point)) |
| 474 | high-doc))))) | 479 | high-doc))))) |
| 475 | 480 | ||
| @@ -565,18 +570,21 @@ FILE is the file where FUNCTION was probably defined." | |||
| 565 | (or (and advised | 570 | (or (and advised |
| 566 | (advice--cd*r (advice--symbol-function function))) | 571 | (advice--cd*r (advice--symbol-function function))) |
| 567 | function)) | 572 | function)) |
| 568 | ;; Get the real definition. | 573 | ;; Get the real definition, if any. |
| 569 | (def (if (symbolp real-function) | 574 | (def (if (symbolp real-function) |
| 570 | (or (symbol-function real-function) | 575 | (cond ((symbol-function real-function)) |
| 571 | (signal 'void-function (list real-function))) | 576 | ((get real-function 'function-documentation) |
| 577 | nil) | ||
| 578 | (t (signal 'void-function (list real-function)))) | ||
| 572 | real-function)) | 579 | real-function)) |
| 573 | (aliased (or (symbolp def) | 580 | (aliased (and def |
| 574 | ;; Advised & aliased function. | 581 | (or (symbolp def) |
| 575 | (and advised (symbolp real-function) | 582 | ;; Advised & aliased function. |
| 576 | (not (eq 'autoload (car-safe def)))) | 583 | (and advised (symbolp real-function) |
| 577 | (and (subrp def) | 584 | (not (eq 'autoload (car-safe def)))) |
| 578 | (not (string= (subr-name def) | 585 | (and (subrp def) |
| 579 | (symbol-name function)))))) | 586 | (not (string= (subr-name def) |
| 587 | (symbol-name function))))))) | ||
| 580 | (real-def (cond | 588 | (real-def (cond |
| 581 | ((and aliased (not (subrp def))) | 589 | ((and aliased (not (subrp def))) |
| 582 | (let ((f real-function)) | 590 | (let ((f real-function)) |
| @@ -605,6 +613,8 @@ FILE is the file where FUNCTION was probably defined." | |||
| 605 | ;; Print what kind of function-like object FUNCTION is. | 613 | ;; Print what kind of function-like object FUNCTION is. |
| 606 | (princ (cond ((or (stringp def) (vectorp def)) | 614 | (princ (cond ((or (stringp def) (vectorp def)) |
| 607 | "a keyboard macro") | 615 | "a keyboard macro") |
| 616 | ((get function 'reader-construct) | ||
| 617 | "a reader construct") | ||
| 608 | ;; Aliases are Lisp functions, so we need to check | 618 | ;; Aliases are Lisp functions, so we need to check |
| 609 | ;; aliases before functions. | 619 | ;; aliases before functions. |
| 610 | (aliased | 620 | (aliased |
| @@ -842,7 +852,7 @@ it is displayed along with the global value." | |||
| 842 | (terpri) | 852 | (terpri) |
| 843 | (pp val) | 853 | (pp val) |
| 844 | ;; Remove trailing newline. | 854 | ;; Remove trailing newline. |
| 845 | (delete-char -1)) | 855 | (and (= (char-before) ?\n) (delete-char -1))) |
| 846 | (let* ((sv (get variable 'standard-value)) | 856 | (let* ((sv (get variable 'standard-value)) |
| 847 | (origval (and (consp sv) | 857 | (origval (and (consp sv) |
| 848 | (condition-case nil | 858 | (condition-case nil |
diff --git a/lisp/help-mode.el b/lisp/help-mode.el index a8d7294a5cc..3fb793e7aa5 100644 --- a/lisp/help-mode.el +++ b/lisp/help-mode.el | |||
| @@ -328,7 +328,7 @@ Commands: | |||
| 328 | "\\(source \\(?:code \\)?\\(?:of\\|for\\)\\)\\)" | 328 | "\\(source \\(?:code \\)?\\(?:of\\|for\\)\\)\\)" |
| 329 | "[ \t\n]+\\)?" | 329 | "[ \t\n]+\\)?" |
| 330 | ;; Note starting with word-syntax character: | 330 | ;; Note starting with word-syntax character: |
| 331 | "['`‘]\\(\\sw\\(\\sw\\|\\s_\\)+\\)['’]")) | 331 | "['`‘]\\(\\sw\\(\\sw\\|\\s_\\)+\\|`\\)['’]")) |
| 332 | "Regexp matching doc string references to symbols. | 332 | "Regexp matching doc string references to symbols. |
| 333 | 333 | ||
| 334 | The words preceding the quoted symbol can be used in doc strings to | 334 | The words preceding the quoted symbol can be used in doc strings to |
diff --git a/lisp/hl-line.el b/lisp/hl-line.el index 4cf0573089f..38fe683785a 100644 --- a/lisp/hl-line.el +++ b/lisp/hl-line.el | |||
| @@ -189,7 +189,8 @@ Specifically, when `hl-line-sticky-flag' is nil deactivate all | |||
| 189 | such overlays in all buffers except the current one." | 189 | such overlays in all buffers except the current one." |
| 190 | (let ((hlob hl-line-overlay-buffer) | 190 | (let ((hlob hl-line-overlay-buffer) |
| 191 | (curbuf (current-buffer))) | 191 | (curbuf (current-buffer))) |
| 192 | (when (and (not hl-line-sticky-flag) | 192 | (when (and (buffer-live-p hlob) |
| 193 | (not hl-line-sticky-flag) | ||
| 193 | (not (eq curbuf hlob)) | 194 | (not (eq curbuf hlob)) |
| 194 | (not (minibufferp))) | 195 | (not (minibufferp))) |
| 195 | (with-current-buffer hlob | 196 | (with-current-buffer hlob |
diff --git a/lisp/htmlfontify.el b/lisp/htmlfontify.el index 21aac1ab216..74393ffbaeb 100644 --- a/lisp/htmlfontify.el +++ b/lisp/htmlfontify.el | |||
| @@ -365,9 +365,15 @@ commands in `hfy-etags-cmd-alist'." | |||
| 365 | 365 | ||
| 366 | (defun hfy-which-etags () | 366 | (defun hfy-which-etags () |
| 367 | "Return a string indicating which flavor of etags we are using." | 367 | "Return a string indicating which flavor of etags we are using." |
| 368 | (let ((v (shell-command-to-string (concat hfy-etags-bin " --version")))) | 368 | (with-temp-buffer |
| 369 | (cond ((string-match "exube" v) "exuberant ctags") | 369 | (condition-case nil |
| 370 | ((string-match "GNU E" v) "emacs etags" )) )) | 370 | (when (eq (call-process hfy-etags-bin nil t nil "--version") 0) |
| 371 | (goto-char (point-min)) | ||
| 372 | (cond | ||
| 373 | ((looking-at-p "exube") "exuberant ctags") | ||
| 374 | ((looking-at-p "GNU E") "emacs etags"))) | ||
| 375 | ;; Return nil if the etags binary isn't executable (Bug#25468). | ||
| 376 | (file-error nil)))) | ||
| 371 | 377 | ||
| 372 | (defcustom hfy-etags-cmd | 378 | (defcustom hfy-etags-cmd |
| 373 | ;; We used to wrap this in a `eval-and-compile', but: | 379 | ;; We used to wrap this in a `eval-and-compile', but: |
diff --git a/lisp/ibuffer.el b/lisp/ibuffer.el index c6e5e471a36..71bf1d6dcc2 100644 --- a/lisp/ibuffer.el +++ b/lisp/ibuffer.el | |||
| @@ -1319,13 +1319,14 @@ a new window in the current frame, splitting vertically." | |||
| 1319 | (cl-assert (derived-mode-p 'ibuffer-mode))) | 1319 | (cl-assert (derived-mode-p 'ibuffer-mode))) |
| 1320 | 1320 | ||
| 1321 | (defun ibuffer-buffer-file-name () | 1321 | (defun ibuffer-buffer-file-name () |
| 1322 | (or buffer-file-name | 1322 | (cond |
| 1323 | (let ((dirname (or (and (boundp 'dired-directory) | 1323 | ((buffer-file-name)) |
| 1324 | (if (stringp dired-directory) | 1324 | ((bound-and-true-p list-buffers-directory)) |
| 1325 | dired-directory | 1325 | ((let ((dirname (and (boundp 'dired-directory) |
| 1326 | (car dired-directory))) | 1326 | (if (stringp dired-directory) |
| 1327 | (bound-and-true-p list-buffers-directory)))) | 1327 | dired-directory |
| 1328 | (and dirname (expand-file-name dirname))))) | 1328 | (car dired-directory))))) |
| 1329 | (and dirname (expand-file-name dirname)))))) | ||
| 1329 | 1330 | ||
| 1330 | (define-ibuffer-op ibuffer-do-save () | 1331 | (define-ibuffer-op ibuffer-do-save () |
| 1331 | "Save marked buffers as with `save-buffer'." | 1332 | "Save marked buffers as with `save-buffer'." |
diff --git a/lisp/image-dired.el b/lisp/image-dired.el index 901225fa2e9..2a4064560a7 100644 --- a/lisp/image-dired.el +++ b/lisp/image-dired.el | |||
| @@ -94,6 +94,7 @@ | |||
| 94 | ;; * WARNING: The "database" format used might be changed so keep a | 94 | ;; * WARNING: The "database" format used might be changed so keep a |
| 95 | ;; backup of `image-dired-db-file' when testing new versions. | 95 | ;; backup of `image-dired-db-file' when testing new versions. |
| 96 | ;; | 96 | ;; |
| 97 | ;; * `image-dired-display-image-mode' does not support animation | ||
| 97 | ;; | 98 | ;; |
| 98 | ;; TODO | 99 | ;; TODO |
| 99 | ;; ==== | 100 | ;; ==== |
| @@ -228,7 +229,7 @@ Used together with `image-dired-cmd-create-thumbnail-options'." | |||
| 228 | :group 'image-dired) | 229 | :group 'image-dired) |
| 229 | 230 | ||
| 230 | (defcustom image-dired-cmd-create-thumbnail-options | 231 | (defcustom image-dired-cmd-create-thumbnail-options |
| 231 | '("-size" "%wx%h" "%f" "-resize" "%wx%h>" "-strip" "jpeg:%t") | 232 | '("-size" "%wx%h" "%f[0]" "-resize" "%wx%h>" "-strip" "jpeg:%t") |
| 232 | "Options of command used to create thumbnail image. | 233 | "Options of command used to create thumbnail image. |
| 233 | Used with `image-dired-cmd-create-thumbnail-program'. | 234 | Used with `image-dired-cmd-create-thumbnail-program'. |
| 234 | Available format specifiers are: %w which is replaced by | 235 | Available format specifiers are: %w which is replaced by |
| @@ -246,7 +247,7 @@ Used together with `image-dired-cmd-create-temp-image-options'." | |||
| 246 | :group 'image-dired) | 247 | :group 'image-dired) |
| 247 | 248 | ||
| 248 | (defcustom image-dired-cmd-create-temp-image-options | 249 | (defcustom image-dired-cmd-create-temp-image-options |
| 249 | '("-size" "%wx%h" "%f" "-resize" "%wx%h>" "-strip" "jpeg:%t") | 250 | '("-size" "%wx%h" "%f[0]" "-resize" "%wx%h>" "-strip" "jpeg:%t") |
| 250 | "Options of command used to create temporary image for display window. | 251 | "Options of command used to create temporary image for display window. |
| 251 | Used together with `image-dired-cmd-create-temp-image-program', | 252 | Used together with `image-dired-cmd-create-temp-image-program', |
| 252 | Available format specifiers are: %w and %h which are replaced by | 253 | Available format specifiers are: %w and %h which are replaced by |
| @@ -316,7 +317,7 @@ Available format specifiers are described in | |||
| 316 | :group 'image-dired) | 317 | :group 'image-dired) |
| 317 | 318 | ||
| 318 | (defcustom image-dired-cmd-create-standard-thumbnail-options | 319 | (defcustom image-dired-cmd-create-standard-thumbnail-options |
| 319 | (append '("-size" "%wx%h" "%f") | 320 | (append '("-size" "%wx%h" "%f[0]") |
| 320 | (unless (or image-dired-cmd-pngcrush-program | 321 | (unless (or image-dired-cmd-pngcrush-program |
| 321 | image-dired-cmd-pngnq-program) | 322 | image-dired-cmd-pngnq-program) |
| 322 | (list | 323 | (list |
| @@ -1626,6 +1627,7 @@ Resized or in full-size." | |||
| 1626 | :group 'image-dired | 1627 | :group 'image-dired |
| 1627 | (buffer-disable-undo) | 1628 | (buffer-disable-undo) |
| 1628 | (image-mode-setup-winprops) | 1629 | (image-mode-setup-winprops) |
| 1630 | (setq cursor-type nil) | ||
| 1629 | (add-hook 'file-name-at-point-functions 'image-dired-file-name-at-point nil t)) | 1631 | (add-hook 'file-name-at-point-functions 'image-dired-file-name-at-point nil t)) |
| 1630 | 1632 | ||
| 1631 | (defvar image-dired-minor-mode-map | 1633 | (defvar image-dired-minor-mode-map |
diff --git a/lisp/indent.el b/lisp/indent.el index db31f0454ce..fdd184c7998 100644 --- a/lisp/indent.el +++ b/lisp/indent.el | |||
| @@ -487,9 +487,9 @@ line, but does not move past any whitespace that was explicitly inserted | |||
| 487 | (if (memq (current-justification) '(center right)) | 487 | (if (memq (current-justification) '(center right)) |
| 488 | (skip-chars-forward " \t"))) | 488 | (skip-chars-forward " \t"))) |
| 489 | 489 | ||
| 490 | (defvar indent-region-function nil | 490 | (defvar indent-region-function #'indent-region-line-by-line |
| 491 | "Short cut function to indent region using `indent-according-to-mode'. | 491 | "Short cut function to indent region using `indent-according-to-mode'. |
| 492 | A value of nil means really run `indent-according-to-mode' on each line.") | 492 | Default is to really run `indent-according-to-mode' on each line.") |
| 493 | 493 | ||
| 494 | (defun indent-region (start end &optional column) | 494 | (defun indent-region (start end &optional column) |
| 495 | "Indent each nonblank line in the region. | 495 | "Indent each nonblank line in the region. |
| @@ -541,24 +541,26 @@ column to indent to; if it is nil, use one of the three methods above." | |||
| 541 | (funcall indent-region-function start end)) | 541 | (funcall indent-region-function start end)) |
| 542 | ;; Else, use a default implementation that calls indent-line-function on | 542 | ;; Else, use a default implementation that calls indent-line-function on |
| 543 | ;; each line. | 543 | ;; each line. |
| 544 | (t | 544 | (t (indent-region-line-by-line start end))) |
| 545 | (save-excursion | ||
| 546 | (setq end (copy-marker end)) | ||
| 547 | (goto-char start) | ||
| 548 | (let ((pr (unless (minibufferp) | ||
| 549 | (make-progress-reporter "Indenting region..." (point) end)))) | ||
| 550 | (while (< (point) end) | ||
| 551 | (or (and (bolp) (eolp)) | ||
| 552 | (indent-according-to-mode)) | ||
| 553 | (forward-line 1) | ||
| 554 | (and pr (progress-reporter-update pr (point)))) | ||
| 555 | (and pr (progress-reporter-done pr)) | ||
| 556 | (move-marker end nil))))) | ||
| 557 | ;; In most cases, reindenting modifies the buffer, but it may also | 545 | ;; In most cases, reindenting modifies the buffer, but it may also |
| 558 | ;; leave it unmodified, in which case we have to deactivate the mark | 546 | ;; leave it unmodified, in which case we have to deactivate the mark |
| 559 | ;; by hand. | 547 | ;; by hand. |
| 560 | (setq deactivate-mark t)) | 548 | (setq deactivate-mark t)) |
| 561 | 549 | ||
| 550 | (defun indent-region-line-by-line (start end) | ||
| 551 | (save-excursion | ||
| 552 | (setq end (copy-marker end)) | ||
| 553 | (goto-char start) | ||
| 554 | (let ((pr (unless (minibufferp) | ||
| 555 | (make-progress-reporter "Indenting region..." (point) end)))) | ||
| 556 | (while (< (point) end) | ||
| 557 | (or (and (bolp) (eolp)) | ||
| 558 | (indent-according-to-mode)) | ||
| 559 | (forward-line 1) | ||
| 560 | (and pr (progress-reporter-update pr (point)))) | ||
| 561 | (and pr (progress-reporter-done pr)) | ||
| 562 | (move-marker end nil)))) | ||
| 563 | |||
| 562 | (define-obsolete-function-alias 'indent-relative-maybe | 564 | (define-obsolete-function-alias 'indent-relative-maybe |
| 563 | 'indent-relative-first-indent-point "26.1") | 565 | 'indent-relative-first-indent-point "26.1") |
| 564 | 566 | ||
diff --git a/lisp/info.el b/lisp/info.el index e32b6b35632..0cfcec32f82 100644 --- a/lisp/info.el +++ b/lisp/info.el | |||
| @@ -1599,6 +1599,16 @@ escaped (\\\",\\\\)." | |||
| 1599 | parameter-alist)) | 1599 | parameter-alist)) |
| 1600 | parameter-alist)) | 1600 | parameter-alist)) |
| 1601 | 1601 | ||
| 1602 | (defun Info-node-description (file) | ||
| 1603 | (cond | ||
| 1604 | ((equal file "dir") "*Info Directory*") | ||
| 1605 | ((eq file 'apropos) "*Info Apropos*") | ||
| 1606 | ((eq file 'history) "*Info History*") | ||
| 1607 | ((eq file 'toc) "*Info TOC*") | ||
| 1608 | ((not (stringp file)) "") ; Avoid errors | ||
| 1609 | (t | ||
| 1610 | (concat "(" (file-name-nondirectory file) ") " Info-current-node)))) | ||
| 1611 | |||
| 1602 | (defun Info-display-images-node () | 1612 | (defun Info-display-images-node () |
| 1603 | "Display images in current node." | 1613 | "Display images in current node." |
| 1604 | (save-excursion | 1614 | (save-excursion |
| @@ -1693,6 +1703,7 @@ escaped (\\\",\\\\)." | |||
| 1693 | (setq Info-history-forward nil)) | 1703 | (setq Info-history-forward nil)) |
| 1694 | (if (not (eq Info-fontify-maximum-menu-size nil)) | 1704 | (if (not (eq Info-fontify-maximum-menu-size nil)) |
| 1695 | (Info-fontify-node)) | 1705 | (Info-fontify-node)) |
| 1706 | (setq list-buffers-directory (Info-node-description Info-current-file)) | ||
| 1696 | (Info-display-images-node) | 1707 | (Info-display-images-node) |
| 1697 | (Info-hide-cookies-node) | 1708 | (Info-hide-cookies-node) |
| 1698 | (run-hooks 'Info-selection-hook))))) | 1709 | (run-hooks 'Info-selection-hook))))) |
diff --git a/lisp/mail/ietf-drums.el b/lisp/mail/ietf-drums.el index a3e53cfe793..fd793a28309 100644 --- a/lisp/mail/ietf-drums.el +++ b/lisp/mail/ietf-drums.el | |||
| @@ -192,6 +192,17 @@ the Content-Transfer-Encoding header of a mail." | |||
| 192 | (ietf-drums-init string) | 192 | (ietf-drums-init string) |
| 193 | (while (not (eobp)) | 193 | (while (not (eobp)) |
| 194 | (setq c (char-after)) | 194 | (setq c (char-after)) |
| 195 | ;; If we have an uneven number of quote characters, | ||
| 196 | ;; `forward-sexp' will fail. In these cases, just delete the | ||
| 197 | ;; final of these quote characters. | ||
| 198 | (when (and (eq c ?\") | ||
| 199 | (not | ||
| 200 | (save-excursion | ||
| 201 | (ignore-errors | ||
| 202 | (forward-sexp 1) | ||
| 203 | t)))) | ||
| 204 | (delete-char 1) | ||
| 205 | (setq c (char-after))) | ||
| 195 | (cond | 206 | (cond |
| 196 | ((or (eq c ? ) | 207 | ((or (eq c ? ) |
| 197 | (eq c ?\t)) | 208 | (eq c ?\t)) |
diff --git a/lisp/mail/rfc2047.el b/lisp/mail/rfc2047.el index 2a8160921a6..bcbdc17631d 100644 --- a/lisp/mail/rfc2047.el +++ b/lisp/mail/rfc2047.el | |||
| @@ -281,17 +281,7 @@ Should be called narrowed to the head of the message." | |||
| 281 | (encode-coding-region | 281 | (encode-coding-region |
| 282 | (point-min) (point-max) | 282 | (point-min) (point-max) |
| 283 | (mm-charset-to-coding-system | 283 | (mm-charset-to-coding-system |
| 284 | (car message-posting-charset)))) | 284 | (car message-posting-charset))))) |
| 285 | ;; No encoding necessary, but folding is nice | ||
| 286 | (when nil | ||
| 287 | (rfc2047-fold-region | ||
| 288 | (save-excursion | ||
| 289 | (goto-char (point-min)) | ||
| 290 | (skip-chars-forward "^:") | ||
| 291 | (when (looking-at ": ") | ||
| 292 | (forward-char 2)) | ||
| 293 | (point)) | ||
| 294 | (point-max)))) | ||
| 295 | ;; We found something that may perhaps be encoded. | 285 | ;; We found something that may perhaps be encoded. |
| 296 | (re-search-forward "^[^:]+: *" nil t) | 286 | (re-search-forward "^[^:]+: *" nil t) |
| 297 | (cond | 287 | (cond |
diff --git a/lisp/mh-e/mh-compat.el b/lisp/mh-e/mh-compat.el index aae751e8d2d..3f3990e8695 100644 --- a/lisp/mh-e/mh-compat.el +++ b/lisp/mh-e/mh-compat.el | |||
| @@ -283,16 +283,6 @@ DOCSTRING arguments." | |||
| 283 | See documentation for `make-obsolete-variable' for a description | 283 | See documentation for `make-obsolete-variable' for a description |
| 284 | of the arguments OBSOLETE-NAME, CURRENT-NAME, and perhaps WHEN | 284 | of the arguments OBSOLETE-NAME, CURRENT-NAME, and perhaps WHEN |
| 285 | and ACCESS-TYPE. This macro is used by XEmacs that lacks WHEN and | 285 | and ACCESS-TYPE. This macro is used by XEmacs that lacks WHEN and |
| 286 | ACCESS-TYPE arguments." | ||
| 287 | (if (featurep 'xemacs) | ||
| 288 | `(make-obsolete-variable ,obsolete-name ,current-name) | ||
| 289 | `(make-obsolete-variable ,obsolete-name ,current-name ,when ,access-type))) | ||
| 290 | |||
| 291 | (defmacro mh-make-obsolete-variable (obsolete-name current-name &optional when access-type) | ||
| 292 | "Make the byte-compiler warn that OBSOLETE-NAME is obsolete. | ||
| 293 | See documentation for `make-obsolete-variable' for a description | ||
| 294 | of the arguments OBSOLETE-NAME, CURRENT-NAME, and perhaps WHEN | ||
| 295 | and ACCESS-TYPE. This macro is used by XEmacs that lacks WHEN and | ||
| 296 | ACCESS-TYPE arguments and by Emacs versions that lack ACCESS-TYPE, | 286 | ACCESS-TYPE arguments and by Emacs versions that lack ACCESS-TYPE, |
| 297 | introduced in Emacs 24." | 287 | introduced in Emacs 24." |
| 298 | (if (featurep 'xemacs) | 288 | (if (featurep 'xemacs) |
diff --git a/lisp/net/eww.el b/lisp/net/eww.el index d42180719dc..f7e06341443 100644 --- a/lisp/net/eww.el +++ b/lisp/net/eww.el | |||
| @@ -59,7 +59,7 @@ | |||
| 59 | "Directory where files will downloaded." | 59 | "Directory where files will downloaded." |
| 60 | :version "24.4" | 60 | :version "24.4" |
| 61 | :group 'eww | 61 | :group 'eww |
| 62 | :type 'string) | 62 | :type 'directory) |
| 63 | 63 | ||
| 64 | ;;;###autoload | 64 | ;;;###autoload |
| 65 | (defcustom eww-suggest-uris | 65 | (defcustom eww-suggest-uris |
| @@ -81,7 +81,7 @@ duplicate entries (if any) removed." | |||
| 81 | "Directory where bookmark files will be stored." | 81 | "Directory where bookmark files will be stored." |
| 82 | :version "25.1" | 82 | :version "25.1" |
| 83 | :group 'eww | 83 | :group 'eww |
| 84 | :type 'string) | 84 | :type 'directory) |
| 85 | 85 | ||
| 86 | (defcustom eww-desktop-remove-duplicates t | 86 | (defcustom eww-desktop-remove-duplicates t |
| 87 | "Whether to remove duplicates from the history when saving desktop data. | 87 | "Whether to remove duplicates from the history when saving desktop data. |
| @@ -251,6 +251,29 @@ word(s) will be searched for via `eww-search-prefix'." | |||
| 251 | (if uris (format " (default %s)" (car uris)) "") | 251 | (if uris (format " (default %s)" (car uris)) "") |
| 252 | ": "))) | 252 | ": "))) |
| 253 | (list (read-string prompt nil nil uris)))) | 253 | (list (read-string prompt nil nil uris)))) |
| 254 | (setq url (eww--dwim-expand-url url)) | ||
| 255 | (pop-to-buffer-same-window | ||
| 256 | (if (eq major-mode 'eww-mode) | ||
| 257 | (current-buffer) | ||
| 258 | (get-buffer-create "*eww*"))) | ||
| 259 | (eww-setup-buffer) | ||
| 260 | ;; Check whether the domain only uses "Highly Restricted" Unicode | ||
| 261 | ;; IDNA characters. If not, transform to punycode to indicate that | ||
| 262 | ;; there may be funny business going on. | ||
| 263 | (let ((parsed (url-generic-parse-url url))) | ||
| 264 | (unless (puny-highly-restrictive-domain-p (url-host parsed)) | ||
| 265 | (setf (url-host parsed) (puny-encode-domain (url-host parsed))) | ||
| 266 | (setq url (url-recreate-url parsed)))) | ||
| 267 | (plist-put eww-data :url url) | ||
| 268 | (plist-put eww-data :title "") | ||
| 269 | (eww-update-header-line-format) | ||
| 270 | (let ((inhibit-read-only t)) | ||
| 271 | (insert (format "Loading %s..." url)) | ||
| 272 | (goto-char (point-min))) | ||
| 273 | (url-retrieve url 'eww-render | ||
| 274 | (list url nil (current-buffer)))) | ||
| 275 | |||
| 276 | (defun eww--dwim-expand-url (url) | ||
| 254 | (setq url (string-trim url)) | 277 | (setq url (string-trim url)) |
| 255 | (cond ((string-match-p "\\`file:/" url)) | 278 | (cond ((string-match-p "\\`file:/" url)) |
| 256 | ;; Don't mangle file: URLs at all. | 279 | ;; Don't mangle file: URLs at all. |
| @@ -275,26 +298,7 @@ word(s) will be searched for via `eww-search-prefix'." | |||
| 275 | (setq url (concat url "/")))) | 298 | (setq url (concat url "/")))) |
| 276 | (setq url (concat eww-search-prefix | 299 | (setq url (concat eww-search-prefix |
| 277 | (replace-regexp-in-string " " "+" url)))))) | 300 | (replace-regexp-in-string " " "+" url)))))) |
| 278 | (pop-to-buffer-same-window | 301 | url) |
| 279 | (if (eq major-mode 'eww-mode) | ||
| 280 | (current-buffer) | ||
| 281 | (get-buffer-create "*eww*"))) | ||
| 282 | (eww-setup-buffer) | ||
| 283 | ;; Check whether the domain only uses "Highly Restricted" Unicode | ||
| 284 | ;; IDNA characters. If not, transform to punycode to indicate that | ||
| 285 | ;; there may be funny business going on. | ||
| 286 | (let ((parsed (url-generic-parse-url url))) | ||
| 287 | (unless (puny-highly-restrictive-domain-p (url-host parsed)) | ||
| 288 | (setf (url-host parsed) (puny-encode-domain (url-host parsed))) | ||
| 289 | (setq url (url-recreate-url parsed)))) | ||
| 290 | (plist-put eww-data :url url) | ||
| 291 | (plist-put eww-data :title "") | ||
| 292 | (eww-update-header-line-format) | ||
| 293 | (let ((inhibit-read-only t)) | ||
| 294 | (insert (format "Loading %s..." url)) | ||
| 295 | (goto-char (point-min))) | ||
| 296 | (url-retrieve url 'eww-render | ||
| 297 | (list url nil (current-buffer)))) | ||
| 298 | 302 | ||
| 299 | ;;;###autoload (defalias 'browse-web 'eww) | 303 | ;;;###autoload (defalias 'browse-web 'eww) |
| 300 | 304 | ||
| @@ -351,16 +355,25 @@ Currently this means either text/html or application/xhtml+xml." | |||
| 351 | "utf-8")))) | 355 | "utf-8")))) |
| 352 | (data-buffer (current-buffer)) | 356 | (data-buffer (current-buffer)) |
| 353 | last-coding-system-used) | 357 | last-coding-system-used) |
| 354 | ;; Save the https peer status. | ||
| 355 | (with-current-buffer buffer | 358 | (with-current-buffer buffer |
| 356 | (plist-put eww-data :peer (plist-get status :peer))) | 359 | ;; Save the https peer status. |
| 360 | (plist-put eww-data :peer (plist-get status :peer)) | ||
| 361 | ;; Make buffer listings more informative. | ||
| 362 | (setq list-buffers-directory url)) | ||
| 357 | (unwind-protect | 363 | (unwind-protect |
| 358 | (progn | 364 | (progn |
| 359 | (cond | 365 | (cond |
| 360 | ((and eww-use-external-browser-for-content-type | 366 | ((and eww-use-external-browser-for-content-type |
| 361 | (string-match-p eww-use-external-browser-for-content-type | 367 | (string-match-p eww-use-external-browser-for-content-type |
| 362 | (car content-type))) | 368 | (car content-type))) |
| 363 | (eww-browse-with-external-browser url)) | 369 | (erase-buffer) |
| 370 | (insert "<title>Unsupported content type</title>") | ||
| 371 | (insert (format "<h1>Content-type %s is unsupported</h1>" | ||
| 372 | (car content-type))) | ||
| 373 | (insert (format "<a href=%S>Direct link to the document</a>" | ||
| 374 | url)) | ||
| 375 | (goto-char (point-min)) | ||
| 376 | (eww-display-html charset url nil point buffer encode)) | ||
| 364 | ((eww-html-p (car content-type)) | 377 | ((eww-html-p (car content-type)) |
| 365 | (eww-display-html charset url nil point buffer encode)) | 378 | (eww-display-html charset url nil point buffer encode)) |
| 366 | ((equal (car content-type) "application/pdf") | 379 | ((equal (car content-type) "application/pdf") |
| @@ -804,7 +817,10 @@ the like." | |||
| 804 | ;;;###autoload | 817 | ;;;###autoload |
| 805 | (defun eww-browse-url (url &optional new-window) | 818 | (defun eww-browse-url (url &optional new-window) |
| 806 | (when new-window | 819 | (when new-window |
| 807 | (pop-to-buffer-same-window (generate-new-buffer "*eww*")) | 820 | (pop-to-buffer-same-window |
| 821 | (generate-new-buffer | ||
| 822 | (format "*eww-%s*" (url-host (url-generic-parse-url | ||
| 823 | (eww--dwim-expand-url url)))))) | ||
| 808 | (eww-mode)) | 824 | (eww-mode)) |
| 809 | (eww url)) | 825 | (eww url)) |
| 810 | 826 | ||
| @@ -835,6 +851,8 @@ the like." | |||
| 835 | (erase-buffer) | 851 | (erase-buffer) |
| 836 | (insert text) | 852 | (insert text) |
| 837 | (goto-char (plist-get elem :point)) | 853 | (goto-char (plist-get elem :point)) |
| 854 | ;; Make buffer listings more informative. | ||
| 855 | (setq list-buffers-directory (plist-get elem :url)) | ||
| 838 | (eww-update-header-line-format)))) | 856 | (eww-update-header-line-format)))) |
| 839 | 857 | ||
| 840 | (defun eww-next-url () | 858 | (defun eww-next-url () |
| @@ -1483,6 +1501,7 @@ Differences in #targets are ignored." | |||
| 1483 | (defun eww-download () | 1501 | (defun eww-download () |
| 1484 | "Download URL under point to `eww-download-directory'." | 1502 | "Download URL under point to `eww-download-directory'." |
| 1485 | (interactive) | 1503 | (interactive) |
| 1504 | (access-file eww-download-directory "Download failed") | ||
| 1486 | (let ((url (get-text-property (point) 'shr-url))) | 1505 | (let ((url (get-text-property (point) 'shr-url))) |
| 1487 | (if (not url) | 1506 | (if (not url) |
| 1488 | (message "No URL under point") | 1507 | (message "No URL under point") |
diff --git a/lisp/net/network-stream.el b/lisp/net/network-stream.el index 93e1bae5fc2..bf60eee673c 100644 --- a/lisp/net/network-stream.el +++ b/lisp/net/network-stream.el | |||
| @@ -139,6 +139,10 @@ a greeting from the server. | |||
| 139 | :nowait, if non-nil, says the connection should be made | 139 | :nowait, if non-nil, says the connection should be made |
| 140 | asynchronously, if possible. | 140 | asynchronously, if possible. |
| 141 | 141 | ||
| 142 | :shell-command is a format-spec string that can be used if :type | ||
| 143 | is `shell'. It has two specs, %s for host and %p for port | ||
| 144 | number. Example: \"ssh gateway nc %s %p\". | ||
| 145 | |||
| 142 | :tls-parameters is a list that should be supplied if you're | 146 | :tls-parameters is a list that should be supplied if you're |
| 143 | opening a TLS connection. The first element is the TLS | 147 | opening a TLS connection. The first element is the TLS |
| 144 | type (either `gnutls-x509pki' or `gnutls-anon'), and the | 148 | type (either `gnutls-x509pki' or `gnutls-anon'), and the |
diff --git a/lisp/net/shr.el b/lisp/net/shr.el index e0bb3dbb2b7..b7c48288494 100644 --- a/lisp/net/shr.el +++ b/lisp/net/shr.el | |||
| @@ -96,8 +96,9 @@ If nil, don't draw horizontal table lines." | |||
| 96 | (defcustom shr-width nil | 96 | (defcustom shr-width nil |
| 97 | "Frame width to use for rendering. | 97 | "Frame width to use for rendering. |
| 98 | May either be an integer specifying a fixed width in characters, | 98 | May either be an integer specifying a fixed width in characters, |
| 99 | or nil, meaning that the full width of the window should be | 99 | or nil, meaning that the full width of the window should be used. |
| 100 | used." | 100 | If `shr-use-fonts' is set, the mean character width is used to |
| 101 | compute the pixel width, which is used instead." | ||
| 101 | :version "25.1" | 102 | :version "25.1" |
| 102 | :type '(choice (integer :tag "Fixed width in characters") | 103 | :type '(choice (integer :tag "Fixed width in characters") |
| 103 | (const :tag "Use the width of the window" nil)) | 104 | (const :tag "Use the width of the window" nil)) |
| @@ -978,7 +979,7 @@ element is the data blob and the second element is the content-type." | |||
| 978 | (create-image data nil t :ascent 100 | 979 | (create-image data nil t :ascent 100 |
| 979 | :format content-type)) | 980 | :format content-type)) |
| 980 | ((eq content-type 'image/svg+xml) | 981 | ((eq content-type 'image/svg+xml) |
| 981 | (create-image data 'svg t :ascent 100)) | 982 | (create-image data 'imagemagick t :ascent 100)) |
| 982 | ((eq size 'full) | 983 | ((eq size 'full) |
| 983 | (ignore-errors | 984 | (ignore-errors |
| 984 | (shr-rescale-image data content-type | 985 | (shr-rescale-image data content-type |
| @@ -1011,18 +1012,25 @@ element is the data blob and the second element is the content-type." | |||
| 1011 | image) | 1012 | image) |
| 1012 | (insert (or alt "")))) | 1013 | (insert (or alt "")))) |
| 1013 | 1014 | ||
| 1014 | (defun shr-rescale-image (data content-type width height) | 1015 | (defun shr-rescale-image (data content-type width height |
| 1016 | &optional max-width max-height) | ||
| 1015 | "Rescale DATA, if too big, to fit the current buffer. | 1017 | "Rescale DATA, if too big, to fit the current buffer. |
| 1016 | WIDTH and HEIGHT are the sizes given in the HTML data, if any." | 1018 | WIDTH and HEIGHT are the sizes given in the HTML data, if any. |
| 1019 | |||
| 1020 | The size of the displayed image will not exceed | ||
| 1021 | MAX-WIDTH/MAX-HEIGHT. If not given, use the current window | ||
| 1022 | width/height instead." | ||
| 1017 | (if (or (not (fboundp 'imagemagick-types)) | 1023 | (if (or (not (fboundp 'imagemagick-types)) |
| 1018 | (not (get-buffer-window (current-buffer)))) | 1024 | (not (get-buffer-window (current-buffer)))) |
| 1019 | (create-image data nil t :ascent 100) | 1025 | (create-image data nil t :ascent 100) |
| 1020 | (let* ((edges (window-inside-pixel-edges | 1026 | (let* ((edges (window-inside-pixel-edges |
| 1021 | (get-buffer-window (current-buffer)))) | 1027 | (get-buffer-window (current-buffer)))) |
| 1022 | (max-width (truncate (* shr-max-image-proportion | 1028 | (max-width (truncate (* shr-max-image-proportion |
| 1023 | (- (nth 2 edges) (nth 0 edges))))) | 1029 | (or max-width |
| 1030 | (- (nth 2 edges) (nth 0 edges)))))) | ||
| 1024 | (max-height (truncate (* shr-max-image-proportion | 1031 | (max-height (truncate (* shr-max-image-proportion |
| 1025 | (- (nth 3 edges) (nth 1 edges))))) | 1032 | (or max-height |
| 1033 | (- (nth 3 edges) (nth 1 edges)))))) | ||
| 1026 | (scaling (image-compute-scaling-factor image-scaling-factor))) | 1034 | (scaling (image-compute-scaling-factor image-scaling-factor))) |
| 1027 | (when (or (and width | 1035 | (when (or (and width |
| 1028 | (> width max-width)) | 1036 | (> width max-width)) |
| @@ -1059,8 +1067,7 @@ Return a string with image data." | |||
| 1059 | (when (ignore-errors | 1067 | (when (ignore-errors |
| 1060 | (url-cache-extract (url-cache-create-filename (shr-encode-url url))) | 1068 | (url-cache-extract (url-cache-create-filename (shr-encode-url url))) |
| 1061 | t) | 1069 | t) |
| 1062 | (when (or (search-forward "\n\n" nil t) | 1070 | (when (re-search-forward "\r?\n\r?\n" nil t) |
| 1063 | (search-forward "\r\n\r\n" nil t)) | ||
| 1064 | (shr-parse-image-data))))) | 1071 | (shr-parse-image-data))))) |
| 1065 | 1072 | ||
| 1066 | (declare-function libxml-parse-xml-region "xml.c" | 1073 | (declare-function libxml-parse-xml-region "xml.c" |
| @@ -1079,9 +1086,12 @@ Return a string with image data." | |||
| 1079 | obarray))))))) | 1086 | obarray))))))) |
| 1080 | ;; SVG images may contain references to further images that we may | 1087 | ;; SVG images may contain references to further images that we may |
| 1081 | ;; want to block. So special-case these by parsing the XML data | 1088 | ;; want to block. So special-case these by parsing the XML data |
| 1082 | ;; and remove the blocked bits. | 1089 | ;; and remove anything that looks like a blocked bit. |
| 1083 | (when (eq content-type 'image/svg+xml) | 1090 | (when (and shr-blocked-images |
| 1091 | (eq content-type 'image/svg+xml)) | ||
| 1084 | (setq data | 1092 | (setq data |
| 1093 | ;; Note that libxml2 doesn't parse everything perfectly, | ||
| 1094 | ;; so glitches may occur during this transformation. | ||
| 1085 | (shr-dom-to-xml | 1095 | (shr-dom-to-xml |
| 1086 | (libxml-parse-xml-region (point) (point-max))))) | 1096 | (libxml-parse-xml-region (point) (point-max))))) |
| 1087 | (list data content-type))) | 1097 | (list data content-type))) |
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index fc7fdd30850..48dcd5edd11 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el | |||
| @@ -3614,18 +3614,36 @@ connection buffer." | |||
| 3614 | 3614 | ||
| 3615 | ;;; Utility functions: | 3615 | ;;; Utility functions: |
| 3616 | 3616 | ||
| 3617 | (defun tramp-accept-process-output (&optional proc timeout timeout-msecs) | 3617 | (defun tramp-accept-process-output (proc timeout) |
| 3618 | "Like `accept-process-output' for Tramp processes. | 3618 | "Like `accept-process-output' for Tramp processes. |
| 3619 | This is needed in order to hide `last-coding-system-used', which is set | 3619 | This is needed in order to hide `last-coding-system-used', which is set |
| 3620 | for process communication also." | 3620 | for process communication also." |
| 3621 | ;; FIXME: There are problems, when an asynchronous process runs in | ||
| 3622 | ;; parallel, and also timers are active. See | ||
| 3623 | ;; <http://lists.gnu.org/archive/html/tramp-devel/2017-01/msg00010.html>. | ||
| 3624 | (when (and timer-event-last | ||
| 3625 | (string-prefix-p "*tramp/" (process-name proc)) | ||
| 3626 | (let (result) | ||
| 3627 | (maphash | ||
| 3628 | (lambda (key _value) | ||
| 3629 | (and (processp key) | ||
| 3630 | (not (string-prefix-p "*tramp/" (process-name key))) | ||
| 3631 | (tramp-compat-process-live-p key) | ||
| 3632 | (setq result t))) | ||
| 3633 | tramp-cache-data) | ||
| 3634 | result)) | ||
| 3635 | (sit-for 0.01 'nodisp)) | ||
| 3621 | (with-current-buffer (process-buffer proc) | 3636 | (with-current-buffer (process-buffer proc) |
| 3622 | (let (buffer-read-only last-coding-system-used) | 3637 | (let (buffer-read-only last-coding-system-used) |
| 3623 | ;; Under Windows XP, accept-process-output doesn't return | 3638 | ;; Under Windows XP, accept-process-output doesn't return |
| 3624 | ;; sometimes. So we add an additional timeout. | 3639 | ;; sometimes. So we add an additional timeout. JUST-THIS-ONE |
| 3625 | (with-timeout ((or timeout 1)) | 3640 | ;; is set due to Bug#12145. |
| 3626 | (accept-process-output proc timeout timeout-msecs (and proc t))) | 3641 | (tramp-message |
| 3627 | (tramp-message proc 10 "%s %s\n%s" | 3642 | proc 10 "%s %s %s\n%s" |
| 3628 | proc (process-status proc) (buffer-string))))) | 3643 | proc (process-status proc) |
| 3644 | (with-timeout (timeout) | ||
| 3645 | (accept-process-output proc timeout nil t)) | ||
| 3646 | (buffer-string))))) | ||
| 3629 | 3647 | ||
| 3630 | (defun tramp-check-for-regexp (proc regexp) | 3648 | (defun tramp-check-for-regexp (proc regexp) |
| 3631 | "Check, whether REGEXP is contained in process buffer of PROC. | 3649 | "Check, whether REGEXP is contained in process buffer of PROC. |
diff --git a/lisp/net/zeroconf.el b/lisp/net/zeroconf.el index 37816bb8881..393f3a549f9 100644 --- a/lisp/net/zeroconf.el +++ b/lisp/net/zeroconf.el | |||
| @@ -256,7 +256,7 @@ supported keys depend on the service type.") | |||
| 256 | "Returns all discovered Avahi service names as list." | 256 | "Returns all discovered Avahi service names as list." |
| 257 | (let (result) | 257 | (let (result) |
| 258 | (maphash | 258 | (maphash |
| 259 | (lambda (key value) (add-to-list 'result (zeroconf-service-name value))) | 259 | (lambda (_key value) (add-to-list 'result (zeroconf-service-name value))) |
| 260 | zeroconf-services-hash) | 260 | zeroconf-services-hash) |
| 261 | result)) | 261 | result)) |
| 262 | 262 | ||
| @@ -264,7 +264,7 @@ supported keys depend on the service type.") | |||
| 264 | "Returns all discovered Avahi service types as list." | 264 | "Returns all discovered Avahi service types as list." |
| 265 | (let (result) | 265 | (let (result) |
| 266 | (maphash | 266 | (maphash |
| 267 | (lambda (key value) (add-to-list 'result (zeroconf-service-type value))) | 267 | (lambda (_key value) (add-to-list 'result (zeroconf-service-type value))) |
| 268 | zeroconf-services-hash) | 268 | zeroconf-services-hash) |
| 269 | result)) | 269 | result)) |
| 270 | 270 | ||
| @@ -276,7 +276,7 @@ The service type is one of the returned values of | |||
| 276 | format of SERVICE." | 276 | format of SERVICE." |
| 277 | (let (result) | 277 | (let (result) |
| 278 | (maphash | 278 | (maphash |
| 279 | (lambda (key value) | 279 | (lambda (_key value) |
| 280 | (when (equal type (zeroconf-service-type value)) | 280 | (when (equal type (zeroconf-service-type value)) |
| 281 | (add-to-list 'result value))) | 281 | (add-to-list 'result value))) |
| 282 | zeroconf-services-hash) | 282 | zeroconf-services-hash) |
diff --git a/lisp/play/dunnet.el b/lisp/play/dunnet.el index 981b8464aaa..ed5b4c65068 100644 --- a/lisp/play/dunnet.el +++ b/lisp/play/dunnet.el | |||
| @@ -267,7 +267,7 @@ on your head.") | |||
| 267 | (dun-mprincl "You can't drop anything while on the bus.") | 267 | (dun-mprincl "You can't drop anything while on the bus.") |
| 268 | (let (objnum) | 268 | (let (objnum) |
| 269 | (when (setq objnum (dun-objnum-from-args-std obj)) | 269 | (when (setq objnum (dun-objnum-from-args-std obj)) |
| 270 | (if (not (setq ptr (member objnum dun-inventory))) | 270 | (if (not (member objnum dun-inventory)) |
| 271 | (dun-mprincl "You don't have that.") | 271 | (dun-mprincl "You don't have that.") |
| 272 | (progn | 272 | (progn |
| 273 | (dun-remove-obj-from-inven objnum) | 273 | (dun-remove-obj-from-inven objnum) |
diff --git a/lisp/progmodes/cc-align.el b/lisp/progmodes/cc-align.el index 7cb36c4396b..0f7e4b598dc 100644 --- a/lisp/progmodes/cc-align.el +++ b/lisp/progmodes/cc-align.el | |||
| @@ -1221,6 +1221,18 @@ Works with: arglist-cont, arglist-cont-nonempty." | |||
| 1221 | 1221 | ||
| 1222 | (vector (progn (goto-char alignto) (current-column))))))) | 1222 | (vector (progn (goto-char alignto) (current-column))))))) |
| 1223 | 1223 | ||
| 1224 | (defun c-lineup-under-anchor (langelem) | ||
| 1225 | "Line up the current line directly under the anchor position in LANGELEM. | ||
| 1226 | |||
| 1227 | This is like 0, except it supersedes any indentation already calculated for | ||
| 1228 | previous syntactic elements in the syntactic context. | ||
| 1229 | |||
| 1230 | Works with: Any syntactic symbol which has an anchor position." | ||
| 1231 | (save-excursion | ||
| 1232 | (goto-char (c-langelem-pos langelem)) | ||
| 1233 | (vector (current-column)))) | ||
| 1234 | |||
| 1235 | |||
| 1224 | (defun c-lineup-dont-change (langelem) | 1236 | (defun c-lineup-dont-change (langelem) |
| 1225 | "Do not change the indentation of the current line. | 1237 | "Do not change the indentation of the current line. |
| 1226 | 1238 | ||
diff --git a/lisp/progmodes/cc-engine.el b/lisp/progmodes/cc-engine.el index f214242bdd9..7f49557c7a6 100644 --- a/lisp/progmodes/cc-engine.el +++ b/lisp/progmodes/cc-engine.el | |||
| @@ -10260,13 +10260,22 @@ comment at the start of cc-engine.el for more info." | |||
| 10260 | (t nil))))) | 10260 | (t nil))))) |
| 10261 | 10261 | ||
| 10262 | (setq pos (point)) | 10262 | (setq pos (point)) |
| 10263 | (if (and after-type-id-pos | 10263 | (cond |
| 10264 | (goto-char after-type-id-pos) | 10264 | ((and after-type-id-pos |
| 10265 | (setq res (c-back-over-member-initializers)) | 10265 | (goto-char after-type-id-pos) |
| 10266 | (goto-char res) | 10266 | (setq res (c-back-over-member-initializers)) |
| 10267 | (eq (car (c-beginning-of-decl-1 lim)) 'same)) | 10267 | (goto-char res) |
| 10268 | (cons (point) nil) ; Return value. | 10268 | (eq (car (c-beginning-of-decl-1 lim)) 'same)) |
| 10269 | (cons (point) nil)) ; Return value. | ||
| 10270 | |||
| 10271 | ((and after-type-id-pos | ||
| 10272 | (progn | ||
| 10273 | (c-backward-syntactic-ws) | ||
| 10274 | (eq (char-before) ?\())) | ||
| 10275 | ;; Single identifier between '(' and '{'. We have a bracelist. | ||
| 10276 | (cons after-type-id-pos nil)) | ||
| 10269 | 10277 | ||
| 10278 | (t | ||
| 10270 | (goto-char pos) | 10279 | (goto-char pos) |
| 10271 | ;; Checks to do on all sexps before the brace, up to the | 10280 | ;; Checks to do on all sexps before the brace, up to the |
| 10272 | ;; beginning of the statement. | 10281 | ;; beginning of the statement. |
| @@ -10368,7 +10377,7 @@ comment at the start of cc-engine.el for more info." | |||
| 10368 | ; languages where | 10377 | ; languages where |
| 10369 | ; `c-opt-inexpr-brace-list-key' is | 10378 | ; `c-opt-inexpr-brace-list-key' is |
| 10370 | ; non-nil and we have macros. | 10379 | ; non-nil and we have macros. |
| 10371 | (t t))) ;; The caller can go up one level. | 10380 | (t t)))) ;; The caller can go up one level. |
| 10372 | ))) | 10381 | ))) |
| 10373 | 10382 | ||
| 10374 | (defun c-inside-bracelist-p (containing-sexp paren-state) | 10383 | (defun c-inside-bracelist-p (containing-sexp paren-state) |
| @@ -10493,6 +10502,30 @@ comment at the start of cc-engine.el for more info." | |||
| 10493 | (c-at-statement-start-p)) | 10502 | (c-at-statement-start-p)) |
| 10494 | (make-obsolete 'c-looking-at-bos 'c-at-statement-start-p "22.1") | 10503 | (make-obsolete 'c-looking-at-bos 'c-at-statement-start-p "22.1") |
| 10495 | 10504 | ||
| 10505 | (defun c-looking-at-statement-block () | ||
| 10506 | ;; Point is at an opening brace. If this is a statement block (i.e. the | ||
| 10507 | ;; elements in it are terminated by semicolons) return t. Otherwise, return | ||
| 10508 | ;; nil. | ||
| 10509 | (let ((here (point))) | ||
| 10510 | (prog1 | ||
| 10511 | (if (c-go-list-forward) | ||
| 10512 | (let ((there (point))) | ||
| 10513 | (backward-char) | ||
| 10514 | (c-syntactic-skip-backward | ||
| 10515 | "^;," here t) | ||
| 10516 | (cond | ||
| 10517 | ((eq (char-before) ?\;) t) | ||
| 10518 | ((eq (char-before) ?,) nil) | ||
| 10519 | (t (goto-char here) | ||
| 10520 | (forward-char) | ||
| 10521 | (and (c-syntactic-re-search-forward "{" there t t) | ||
| 10522 | (progn (backward-char) | ||
| 10523 | (c-looking-at-statement-block)))))) | ||
| 10524 | (forward-char) | ||
| 10525 | (and (c-syntactic-re-search-forward "[;,]" nil t t) | ||
| 10526 | (eq (char-before) ?\;))) | ||
| 10527 | (goto-char here)))) | ||
| 10528 | |||
| 10496 | (defun c-looking-at-inexpr-block (lim containing-sexp &optional check-at-end) | 10529 | (defun c-looking-at-inexpr-block (lim containing-sexp &optional check-at-end) |
| 10497 | ;; Return non-nil if we're looking at the beginning of a block | 10530 | ;; Return non-nil if we're looking at the beginning of a block |
| 10498 | ;; inside an expression. The value returned is actually a cons of | 10531 | ;; inside an expression. The value returned is actually a cons of |
| @@ -10648,15 +10681,7 @@ comment at the start of cc-engine.el for more info." | |||
| 10648 | (and (c-major-mode-is 'c++-mode) | 10681 | (and (c-major-mode-is 'c++-mode) |
| 10649 | (save-excursion | 10682 | (save-excursion |
| 10650 | (goto-char block-follows) | 10683 | (goto-char block-follows) |
| 10651 | (if (c-go-list-forward) | 10684 | (not (c-looking-at-statement-block))))) |
| 10652 | (progn | ||
| 10653 | (backward-char) | ||
| 10654 | (c-syntactic-skip-backward | ||
| 10655 | "^;," block-follows t) | ||
| 10656 | (not (eq (char-before) ?\;))) | ||
| 10657 | (or (not (c-syntactic-re-search-forward | ||
| 10658 | "[;,]" nil t t)) | ||
| 10659 | (not (eq (char-before) ?\;))))))) | ||
| 10660 | nil | 10685 | nil |
| 10661 | (cons 'inexpr-statement (point))))) | 10686 | (cons 'inexpr-statement (point))))) |
| 10662 | 10687 | ||
| @@ -10792,17 +10817,20 @@ comment at the start of cc-engine.el for more info." | |||
| 10792 | syntax-extra-args | 10817 | syntax-extra-args |
| 10793 | stop-at-boi-only | 10818 | stop-at-boi-only |
| 10794 | containing-sexp | 10819 | containing-sexp |
| 10795 | paren-state) | 10820 | paren-state |
| 10821 | &optional fixed-anchor) | ||
| 10796 | ;; Add the indicated SYNTAX-SYMBOL to `c-syntactic-context', extending it as | 10822 | ;; Add the indicated SYNTAX-SYMBOL to `c-syntactic-context', extending it as |
| 10797 | ;; needed with further syntax elements of the types `substatement', | 10823 | ;; needed with further syntax elements of the types `substatement', |
| 10798 | ;; `inexpr-statement', `arglist-cont-nonempty', `statement-block-intro', and | 10824 | ;; `inexpr-statement', `arglist-cont-nonempty', `statement-block-intro', |
| 10799 | ;; `defun-block-intro'. | 10825 | ;; `defun-block-intro', and `brace-list-intro'. |
| 10800 | ;; | 10826 | ;; |
| 10801 | ;; Do the generic processing to anchor the given syntax symbol on | 10827 | ;; Do the generic processing to anchor the given syntax symbol on the |
| 10802 | ;; the preceding statement: Skip over any labels and containing | 10828 | ;; preceding statement: First skip over any labels and containing statements |
| 10803 | ;; statements on the same line, and then search backward until we | 10829 | ;; on the same line. If FIXED-ANCHOR is non-nil, use this as the |
| 10804 | ;; find a statement or block start that begins at boi without a | 10830 | ;; anchor-point for the given syntactic symbol, and don't make syntactic |
| 10805 | ;; label or comment. | 10831 | ;; entries for constructs beginning on lines before that containing |
| 10832 | ;; ANCHOR-POINT. Otherwise search backward until we find a statement or | ||
| 10833 | ;; block start that begins at boi without a label or comment. | ||
| 10806 | ;; | 10834 | ;; |
| 10807 | ;; Point is assumed to be at the prospective anchor point for the | 10835 | ;; Point is assumed to be at the prospective anchor point for the |
| 10808 | ;; given SYNTAX-SYMBOL. More syntax entries are added if we need to | 10836 | ;; given SYNTAX-SYMBOL. More syntax entries are added if we need to |
| @@ -10831,6 +10859,7 @@ comment at the start of cc-engine.el for more info." | |||
| 10831 | 10859 | ||
| 10832 | (let ((syntax-last c-syntactic-context) | 10860 | (let ((syntax-last c-syntactic-context) |
| 10833 | (boi (c-point 'boi)) | 10861 | (boi (c-point 'boi)) |
| 10862 | (anchor-boi (c-point 'boi)) | ||
| 10834 | ;; Set when we're on a label, so that we don't stop there. | 10863 | ;; Set when we're on a label, so that we don't stop there. |
| 10835 | ;; FIXME: To be complete we should check if we're on a label | 10864 | ;; FIXME: To be complete we should check if we're on a label |
| 10836 | ;; now at the start. | 10865 | ;; now at the start. |
| @@ -10908,7 +10937,9 @@ comment at the start of cc-engine.el for more info." | |||
| 10908 | (c-add-syntax 'substatement nil)))) | 10937 | (c-add-syntax 'substatement nil)))) |
| 10909 | ))) | 10938 | ))) |
| 10910 | 10939 | ||
| 10911 | containing-sexp) | 10940 | containing-sexp |
| 10941 | (or (null fixed-anchor) | ||
| 10942 | (> containing-sexp anchor-boi))) | ||
| 10912 | 10943 | ||
| 10913 | ;; Now we have to go out of this block. | 10944 | ;; Now we have to go out of this block. |
| 10914 | (goto-char containing-sexp) | 10945 | (goto-char containing-sexp) |
| @@ -10982,6 +11013,14 @@ comment at the start of cc-engine.el for more info." | |||
| 10982 | (cdr (assoc (match-string 1) | 11013 | (cdr (assoc (match-string 1) |
| 10983 | c-other-decl-block-key-in-symbols-alist)) | 11014 | c-other-decl-block-key-in-symbols-alist)) |
| 10984 | (max (c-point 'boi paren-pos) (point)))) | 11015 | (max (c-point 'boi paren-pos) (point)))) |
| 11016 | ((save-excursion | ||
| 11017 | (goto-char paren-pos) | ||
| 11018 | (c-looking-at-or-maybe-in-bracelist containing-sexp)) | ||
| 11019 | (if (save-excursion | ||
| 11020 | (goto-char paren-pos) | ||
| 11021 | (c-looking-at-statement-block)) | ||
| 11022 | (c-add-syntax 'defun-block-intro nil) | ||
| 11023 | (c-add-syntax 'brace-list-intro nil))) | ||
| 10985 | (t (c-add-syntax 'defun-block-intro nil)))) | 11024 | (t (c-add-syntax 'defun-block-intro nil)))) |
| 10986 | 11025 | ||
| 10987 | (c-add-syntax 'statement-block-intro nil))) | 11026 | (c-add-syntax 'statement-block-intro nil))) |
| @@ -11001,7 +11040,10 @@ comment at the start of cc-engine.el for more info." | |||
| 11001 | (setq q (cdr (car p))) ; e.g. (nil 28) [from (arglist-cont-nonempty nil 28)] | 11040 | (setq q (cdr (car p))) ; e.g. (nil 28) [from (arglist-cont-nonempty nil 28)] |
| 11002 | (while q | 11041 | (while q |
| 11003 | (unless (car q) | 11042 | (unless (car q) |
| 11004 | (setcar q (point))) | 11043 | (setcar q (if (or (cdr p) |
| 11044 | (null fixed-anchor)) | ||
| 11045 | (point) | ||
| 11046 | fixed-anchor))) | ||
| 11005 | (setq q (cdr q))) | 11047 | (setq q (cdr q))) |
| 11006 | (setq p (cdr p)))) | 11048 | (setq p (cdr p)))) |
| 11007 | ))) | 11049 | ))) |
| @@ -12354,7 +12396,8 @@ comment at the start of cc-engine.el for more info." | |||
| 12354 | (c-forward-syntactic-ws (c-point 'eol)) | 12396 | (c-forward-syntactic-ws (c-point 'eol)) |
| 12355 | (c-looking-at-special-brace-list (point))))) | 12397 | (c-looking-at-special-brace-list (point))))) |
| 12356 | (c-add-syntax 'brace-entry-open (point)) | 12398 | (c-add-syntax 'brace-entry-open (point)) |
| 12357 | (c-add-syntax 'brace-list-entry (point)) | 12399 | (c-add-stmt-syntax 'brace-list-entry nil t containing-sexp |
| 12400 | paren-state (point)) | ||
| 12358 | )) | 12401 | )) |
| 12359 | )))) | 12402 | )))) |
| 12360 | 12403 | ||
| @@ -12848,7 +12891,7 @@ Cannot combine absolute offsets %S and %S in `add' method" | |||
| 12848 | ;; | 12891 | ;; |
| 12849 | ;; Note that topmost-intro always has an anchor position at bol, for | 12892 | ;; Note that topmost-intro always has an anchor position at bol, for |
| 12850 | ;; historical reasons. It's often used together with other symbols | 12893 | ;; historical reasons. It's often used together with other symbols |
| 12851 | ;; that has more sane positions. Since we always use the first | 12894 | ;; that have more sane positions. Since we always use the first |
| 12852 | ;; found anchor position, we rely on that these other symbols always | 12895 | ;; found anchor position, we rely on that these other symbols always |
| 12853 | ;; precede topmost-intro in the LANGELEMS list. | 12896 | ;; precede topmost-intro in the LANGELEMS list. |
| 12854 | ;; | 12897 | ;; |
diff --git a/lisp/progmodes/cc-styles.el b/lisp/progmodes/cc-styles.el index d3505490505..b3848a74f97 100644 --- a/lisp/progmodes/cc-styles.el +++ b/lisp/progmodes/cc-styles.el | |||
| @@ -67,6 +67,7 @@ | |||
| 67 | (arglist-close . c-lineup-arglist) | 67 | (arglist-close . c-lineup-arglist) |
| 68 | (inline-open . 0) | 68 | (inline-open . 0) |
| 69 | (brace-list-open . +) | 69 | (brace-list-open . +) |
| 70 | (brace-list-intro . c-lineup-arglist-intro-after-paren) | ||
| 70 | (topmost-intro-cont | 71 | (topmost-intro-cont |
| 71 | . (first c-lineup-topmost-intro-cont | 72 | . (first c-lineup-topmost-intro-cont |
| 72 | c-lineup-gnu-DEFUN-intro-cont)))) | 73 | c-lineup-gnu-DEFUN-intro-cont)))) |
diff --git a/lisp/progmodes/cc-vars.el b/lisp/progmodes/cc-vars.el index a6a96d15188..1114b21381d 100644 --- a/lisp/progmodes/cc-vars.el +++ b/lisp/progmodes/cc-vars.el | |||
| @@ -1115,7 +1115,7 @@ can always override the use of `c-default-style' by making calls to | |||
| 1115 | ;; Anchor pos: At the brace list decl start(*). | 1115 | ;; Anchor pos: At the brace list decl start(*). |
| 1116 | (brace-list-intro . +) | 1116 | (brace-list-intro . +) |
| 1117 | ;; Anchor pos: At the brace list decl start(*). | 1117 | ;; Anchor pos: At the brace list decl start(*). |
| 1118 | (brace-list-entry . 0) | 1118 | (brace-list-entry . c-lineup-under-anchor) |
| 1119 | ;; Anchor pos: At the first non-ws char after the open paren if | 1119 | ;; Anchor pos: At the first non-ws char after the open paren if |
| 1120 | ;; the first token is on the same line, otherwise boi at that | 1120 | ;; the first token is on the same line, otherwise boi at that |
| 1121 | ;; token. | 1121 | ;; token. |
diff --git a/lisp/progmodes/hideshow.el b/lisp/progmodes/hideshow.el index 0e4e67018ed..5328526abd9 100644 --- a/lisp/progmodes/hideshow.el +++ b/lisp/progmodes/hideshow.el | |||
| @@ -582,7 +582,7 @@ and then further adjusted to be at the end of the line." | |||
| 582 | (setq p (line-end-position))) | 582 | (setq p (line-end-position))) |
| 583 | ;; `q' is the point at the end of the block | 583 | ;; `q' is the point at the end of the block |
| 584 | (hs-forward-sexp mdata 1) | 584 | (hs-forward-sexp mdata 1) |
| 585 | (setq q (if (looking-back hs-block-end-regexp) | 585 | (setq q (if (looking-back hs-block-end-regexp nil) |
| 586 | (match-beginning 0) | 586 | (match-beginning 0) |
| 587 | (point))) | 587 | (point))) |
| 588 | (when (and (< p q) (> (count-lines p q) 1)) | 588 | (when (and (< p q) (> (count-lines p q) 1)) |
diff --git a/lisp/progmodes/js.el b/lisp/progmodes/js.el index 2e5c6ae119b..e42e01481b6 100644 --- a/lisp/progmodes/js.el +++ b/lisp/progmodes/js.el | |||
| @@ -574,8 +574,8 @@ then the \".\"s will be lined up: | |||
| 574 | (define-key keymap [(control ?c) (control ?j)] #'js-set-js-context) | 574 | (define-key keymap [(control ?c) (control ?j)] #'js-set-js-context) |
| 575 | (define-key keymap [(control meta ?x)] #'js-eval-defun) | 575 | (define-key keymap [(control meta ?x)] #'js-eval-defun) |
| 576 | (define-key keymap [(meta ?.)] #'js-find-symbol) | 576 | (define-key keymap [(meta ?.)] #'js-find-symbol) |
| 577 | (easy-menu-define nil keymap "Javascript Menu" | 577 | (easy-menu-define nil keymap "JavaScript Menu" |
| 578 | '("Javascript" | 578 | '("JavaScript" |
| 579 | ["Select New Mozilla Context..." js-set-js-context | 579 | ["Select New Mozilla Context..." js-set-js-context |
| 580 | (fboundp #'inferior-moz-process)] | 580 | (fboundp #'inferior-moz-process)] |
| 581 | ["Evaluate Expression in Mozilla Context..." js-eval | 581 | ["Evaluate Expression in Mozilla Context..." js-eval |
| @@ -1712,7 +1712,7 @@ This performs fontification according to `js--class-styles'." | |||
| 1712 | nil)))))) | 1712 | nil)))))) |
| 1713 | 1713 | ||
| 1714 | (defun js-syntax-propertize (start end) | 1714 | (defun js-syntax-propertize (start end) |
| 1715 | ;; Javascript allows immediate regular expression objects, written /.../. | 1715 | ;; JavaScript allows immediate regular expression objects, written /.../. |
| 1716 | (goto-char start) | 1716 | (goto-char start) |
| 1717 | (js-syntax-propertize-regexp end) | 1717 | (js-syntax-propertize-regexp end) |
| 1718 | (funcall | 1718 | (funcall |
| @@ -2710,7 +2710,7 @@ current buffer. Pushes a mark onto the tag ring just like | |||
| 2710 | ;;; MozRepl integration | 2710 | ;;; MozRepl integration |
| 2711 | 2711 | ||
| 2712 | (define-error 'js-moz-bad-rpc "Mozilla RPC Error") ;; '(timeout error)) | 2712 | (define-error 'js-moz-bad-rpc "Mozilla RPC Error") ;; '(timeout error)) |
| 2713 | (define-error 'js-js-error "Javascript Error") ;; '(js-error error)) | 2713 | (define-error 'js-js-error "JavaScript Error") ;; '(js-error error)) |
| 2714 | 2714 | ||
| 2715 | (defun js--wait-for-matching-output | 2715 | (defun js--wait-for-matching-output |
| 2716 | (process regexp timeout &optional start) | 2716 | (process regexp timeout &optional start) |
| @@ -3214,7 +3214,7 @@ with `js--js-encode-value'." | |||
| 3214 | Inside the lexical scope of `with-js', `js?', `js!', | 3214 | Inside the lexical scope of `with-js', `js?', `js!', |
| 3215 | `js-new', `js-eval', `js-list', `js<', `js>', `js-get-service', | 3215 | `js-new', `js-eval', `js-list', `js<', `js>', `js-get-service', |
| 3216 | `js-create-instance', and `js-qi' are defined." | 3216 | `js-create-instance', and `js-qi' are defined." |
| 3217 | 3217 | (declare (indent 0) (debug t)) | |
| 3218 | `(progn | 3218 | `(progn |
| 3219 | (js--js-enter-repl) | 3219 | (js--js-enter-repl) |
| 3220 | (unwind-protect | 3220 | (unwind-protect |
| @@ -3391,7 +3391,7 @@ With argument, run even if no intervening GC has happened." | |||
| 3391 | 3391 | ||
| 3392 | (defun js-eval (js) | 3392 | (defun js-eval (js) |
| 3393 | "Evaluate the JavaScript in JS and return JSON-decoded result." | 3393 | "Evaluate the JavaScript in JS and return JSON-decoded result." |
| 3394 | (interactive "MJavascript to evaluate: ") | 3394 | (interactive "MJavaScript to evaluate: ") |
| 3395 | (with-js | 3395 | (with-js |
| 3396 | (let* ((content-window (js--js-content-window | 3396 | (let* ((content-window (js--js-content-window |
| 3397 | (js--get-js-context))) | 3397 | (js--get-js-context))) |
| @@ -3431,11 +3431,8 @@ left-to-right." | |||
| 3431 | (eq (cl-fifth window-info) 2)) | 3431 | (eq (cl-fifth window-info) 2)) |
| 3432 | do (push window-info windows)) | 3432 | do (push window-info windows)) |
| 3433 | 3433 | ||
| 3434 | (cl-loop for window-info in windows | 3434 | (cl-loop for (window title location) in windows |
| 3435 | for window = (cl-first window-info) | 3435 | collect (list title location window) |
| 3436 | collect (list (cl-second window-info) | ||
| 3437 | (cl-third window-info) | ||
| 3438 | window) | ||
| 3439 | 3436 | ||
| 3440 | for gbrowser = (js< window "gBrowser") | 3437 | for gbrowser = (js< window "gBrowser") |
| 3441 | if (js-handle? gbrowser) | 3438 | if (js-handle? gbrowser) |
| @@ -3668,7 +3665,7 @@ Change with `js-set-js-context'.") | |||
| 3668 | (defun js-set-js-context (context) | 3665 | (defun js-set-js-context (context) |
| 3669 | "Set the JavaScript context to CONTEXT. | 3666 | "Set the JavaScript context to CONTEXT. |
| 3670 | When called interactively, prompt for CONTEXT." | 3667 | When called interactively, prompt for CONTEXT." |
| 3671 | (interactive (list (js--read-tab "Javascript Context: "))) | 3668 | (interactive (list (js--read-tab "JavaScript Context: "))) |
| 3672 | (setq js--js-context context)) | 3669 | (setq js--js-context context)) |
| 3673 | 3670 | ||
| 3674 | (defun js--get-js-context () | 3671 | (defun js--get-js-context () |
| @@ -3682,7 +3679,7 @@ If one hasn't been set, or if it's stale, prompt for a new one." | |||
| 3682 | (`browser (not (js? (js< (cdr js--js-context) | 3679 | (`browser (not (js? (js< (cdr js--js-context) |
| 3683 | "contentDocument")))) | 3680 | "contentDocument")))) |
| 3684 | (x (error "Unmatched case in js--get-js-context: %S" x)))) | 3681 | (x (error "Unmatched case in js--get-js-context: %S" x)))) |
| 3685 | (setq js--js-context (js--read-tab "Javascript Context: "))) | 3682 | (setq js--js-context (js--read-tab "JavaScript Context: "))) |
| 3686 | js--js-context)) | 3683 | js--js-context)) |
| 3687 | 3684 | ||
| 3688 | (defun js--js-content-window (context) | 3685 | (defun js--js-content-window (context) |
| @@ -3852,6 +3849,7 @@ If one hasn't been set, or if it's stale, prompt for a new one." | |||
| 3852 | comment-start-skip "\\(//+\\|/\\*+\\)\\s *") | 3849 | comment-start-skip "\\(//+\\|/\\*+\\)\\s *") |
| 3853 | (setq-local comment-line-break-function #'c-indent-new-comment-line) | 3850 | (setq-local comment-line-break-function #'c-indent-new-comment-line) |
| 3854 | (setq-local c-block-comment-start-regexp "/\\*") | 3851 | (setq-local c-block-comment-start-regexp "/\\*") |
| 3852 | (setq-local comment-multi-line t) | ||
| 3855 | 3853 | ||
| 3856 | (setq-local electric-indent-chars | 3854 | (setq-local electric-indent-chars |
| 3857 | (append "{}():;," electric-indent-chars)) ;FIXME: js2-mode adds "[]*". | 3855 | (append "{}():;," electric-indent-chars)) ;FIXME: js2-mode adds "[]*". |
diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index d8262dd0a75..90b5e4e0dc6 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el | |||
| @@ -4693,7 +4693,8 @@ likely an invalid python file." | |||
| 4693 | (let ((dedenter-pos (python-info-dedenter-statement-p))) | 4693 | (let ((dedenter-pos (python-info-dedenter-statement-p))) |
| 4694 | (when dedenter-pos | 4694 | (when dedenter-pos |
| 4695 | (goto-char dedenter-pos) | 4695 | (goto-char dedenter-pos) |
| 4696 | (let* ((pairs '(("elif" "elif" "if") | 4696 | (let* ((cur-line (line-beginning-position)) |
| 4697 | (pairs '(("elif" "elif" "if") | ||
| 4697 | ("else" "if" "elif" "except" "for" "while") | 4698 | ("else" "if" "elif" "except" "for" "while") |
| 4698 | ("except" "except" "try") | 4699 | ("except" "except" "try") |
| 4699 | ("finally" "else" "except" "try"))) | 4700 | ("finally" "else" "except" "try"))) |
| @@ -4709,7 +4710,22 @@ likely an invalid python file." | |||
| 4709 | (let ((indentation (current-indentation))) | 4710 | (let ((indentation (current-indentation))) |
| 4710 | (when (and (not (memq indentation collected-indentations)) | 4711 | (when (and (not (memq indentation collected-indentations)) |
| 4711 | (or (not collected-indentations) | 4712 | (or (not collected-indentations) |
| 4712 | (< indentation (apply #'min collected-indentations)))) | 4713 | (< indentation (apply #'min collected-indentations))) |
| 4714 | ;; There must be no line with indentation | ||
| 4715 | ;; smaller than `indentation' (except for | ||
| 4716 | ;; blank lines) between the found opening | ||
| 4717 | ;; block and the current line, otherwise it | ||
| 4718 | ;; is not an opening block. | ||
| 4719 | (save-excursion | ||
| 4720 | (forward-line) | ||
| 4721 | (let ((no-back-indent t)) | ||
| 4722 | (save-match-data | ||
| 4723 | (while (and (< (point) cur-line) | ||
| 4724 | (setq no-back-indent | ||
| 4725 | (or (> (current-indentation) indentation) | ||
| 4726 | (python-info-current-line-empty-p)))) | ||
| 4727 | (forward-line))) | ||
| 4728 | no-back-indent))) | ||
| 4713 | (setq collected-indentations | 4729 | (setq collected-indentations |
| 4714 | (cons indentation collected-indentations)) | 4730 | (cons indentation collected-indentations)) |
| 4715 | (when (member (match-string-no-properties 0) | 4731 | (when (member (match-string-no-properties 0) |
diff --git a/lisp/progmodes/sql.el b/lisp/progmodes/sql.el index 71563486ecd..88683431290 100644 --- a/lisp/progmodes/sql.el +++ b/lisp/progmodes/sql.el | |||
| @@ -2790,7 +2790,7 @@ local variable." | |||
| 2790 | ;; Iterate until we've moved the desired number of stmt ends | 2790 | ;; Iterate until we've moved the desired number of stmt ends |
| 2791 | (while (not (= (cl-signum arg) 0)) | 2791 | (while (not (= (cl-signum arg) 0)) |
| 2792 | ;; if we're looking at the terminator, jump by 2 | 2792 | ;; if we're looking at the terminator, jump by 2 |
| 2793 | (if (or (and (> 0 arg) (looking-back term)) | 2793 | (if (or (and (> 0 arg) (looking-back term nil)) |
| 2794 | (and (< 0 arg) (looking-at term))) | 2794 | (and (< 0 arg) (looking-at term))) |
| 2795 | (setq n 2) | 2795 | (setq n 2) |
| 2796 | (setq n 1)) | 2796 | (setq n 1)) |
diff --git a/lisp/progmodes/vhdl-mode.el b/lisp/progmodes/vhdl-mode.el index 0e8ff525e62..6c76d7e4ad2 100644 --- a/lisp/progmodes/vhdl-mode.el +++ b/lisp/progmodes/vhdl-mode.el | |||
| @@ -126,6 +126,14 @@ | |||
| 126 | 126 | ||
| 127 | ;;; Code: | 127 | ;;; Code: |
| 128 | 128 | ||
| 129 | (eval-when-compile (require 'cl)) | ||
| 130 | (eval-and-compile | ||
| 131 | ;; Before Emacs-24.4, `pushnew' expands to runtime calls to `cl-adjoin' | ||
| 132 | ;; even for relatively simple cases such as used here. We only test <25 | ||
| 133 | ;; because it's easier and sufficient. | ||
| 134 | (when (or (featurep 'xemacs) (< emacs-major-version 25)) | ||
| 135 | (require 'cl))) | ||
| 136 | |||
| 129 | ;; Emacs 21+ handling | 137 | ;; Emacs 21+ handling |
| 130 | (defconst vhdl-emacs-21 (and (<= 21 emacs-major-version) (not (featurep 'xemacs))) | 138 | (defconst vhdl-emacs-21 (and (<= 21 emacs-major-version) (not (featurep 'xemacs))) |
| 131 | "Non-nil if GNU Emacs 21, 22, ... is used.") | 139 | "Non-nil if GNU Emacs 21, 22, ... is used.") |
| @@ -14314,7 +14322,7 @@ of PROJECT." | |||
| 14314 | (vhdl-scan-directory-contents dir-name project nil | 14322 | (vhdl-scan-directory-contents dir-name project nil |
| 14315 | (format "(%s/%s) " act-dir num-dir) | 14323 | (format "(%s/%s) " act-dir num-dir) |
| 14316 | (cdr dir-list)) | 14324 | (cdr dir-list)) |
| 14317 | (add-to-list 'dir-list-tmp (file-name-directory dir-name)) | 14325 | (pushnew (file-name-directory dir-name) dir-list-tmp :test #'equal) |
| 14318 | (setq dir-list (cdr dir-list) | 14326 | (setq dir-list (cdr dir-list) |
| 14319 | act-dir (1+ act-dir))) | 14327 | act-dir (1+ act-dir))) |
| 14320 | (vhdl-aput 'vhdl-directory-alist project (list (nreverse dir-list-tmp))) | 14328 | (vhdl-aput 'vhdl-directory-alist project (list (nreverse dir-list-tmp))) |
| @@ -16406,8 +16414,8 @@ component instantiation." | |||
| 16406 | (if (or (member constant-name single-list) | 16414 | (if (or (member constant-name single-list) |
| 16407 | (member constant-name multi-list)) | 16415 | (member constant-name multi-list)) |
| 16408 | (progn (setq single-list (delete constant-name single-list)) | 16416 | (progn (setq single-list (delete constant-name single-list)) |
| 16409 | (add-to-list 'multi-list constant-name)) | 16417 | (pushnew constant-name multi-list :test #'equal)) |
| 16410 | (add-to-list 'single-list constant-name)) | 16418 | (pushnew constant-name single-list :test #'equal)) |
| 16411 | (unless (match-string 1) | 16419 | (unless (match-string 1) |
| 16412 | (setq generic-alist (cdr generic-alist))) | 16420 | (setq generic-alist (cdr generic-alist))) |
| 16413 | (vhdl-forward-syntactic-ws)) | 16421 | (vhdl-forward-syntactic-ws)) |
| @@ -16433,12 +16441,12 @@ component instantiation." | |||
| 16433 | (member signal-name multi-out-list)) | 16441 | (member signal-name multi-out-list)) |
| 16434 | (setq single-out-list (delete signal-name single-out-list)) | 16442 | (setq single-out-list (delete signal-name single-out-list)) |
| 16435 | (setq multi-out-list (delete signal-name multi-out-list)) | 16443 | (setq multi-out-list (delete signal-name multi-out-list)) |
| 16436 | (add-to-list 'local-list signal-name)) | 16444 | (pushnew signal-name local-list :test #'equal)) |
| 16437 | ((member signal-name single-in-list) | 16445 | ((member signal-name single-in-list) |
| 16438 | (setq single-in-list (delete signal-name single-in-list)) | 16446 | (setq single-in-list (delete signal-name single-in-list)) |
| 16439 | (add-to-list 'multi-in-list signal-name)) | 16447 | (pushnew signal-name multi-in-list :test #'equal)) |
| 16440 | ((not (member signal-name multi-in-list)) | 16448 | ((not (member signal-name multi-in-list)) |
| 16441 | (add-to-list 'single-in-list signal-name))) | 16449 | (pushnew signal-name single-in-list :test #'equal))) |
| 16442 | ;; output signal | 16450 | ;; output signal |
| 16443 | (cond | 16451 | (cond |
| 16444 | ((member signal-name local-list) | 16452 | ((member signal-name local-list) |
| @@ -16447,17 +16455,18 @@ component instantiation." | |||
| 16447 | (member signal-name multi-in-list)) | 16455 | (member signal-name multi-in-list)) |
| 16448 | (setq single-in-list (delete signal-name single-in-list)) | 16456 | (setq single-in-list (delete signal-name single-in-list)) |
| 16449 | (setq multi-in-list (delete signal-name multi-in-list)) | 16457 | (setq multi-in-list (delete signal-name multi-in-list)) |
| 16450 | (add-to-list 'local-list signal-name)) | 16458 | (pushnew signal-name local-list :test #'equal)) |
| 16451 | ((member signal-name single-out-list) | 16459 | ((member signal-name single-out-list) |
| 16452 | (setq single-out-list (delete signal-name single-out-list)) | 16460 | (setq single-out-list (delete signal-name single-out-list)) |
| 16453 | (add-to-list 'multi-out-list signal-name)) | 16461 | (pushnew signal-name multi-out-list :test #'equal)) |
| 16454 | ((not (member signal-name multi-out-list)) | 16462 | ((not (member signal-name multi-out-list)) |
| 16455 | (add-to-list 'single-out-list signal-name)))) | 16463 | (pushnew signal-name single-out-list :test #'equal)))) |
| 16456 | (unless (match-string 1) | 16464 | (unless (match-string 1) |
| 16457 | (setq port-alist (cdr port-alist))) | 16465 | (setq port-alist (cdr port-alist))) |
| 16458 | (vhdl-forward-syntactic-ws)) | 16466 | (vhdl-forward-syntactic-ws)) |
| 16459 | (push (list inst-name (nreverse constant-alist) | 16467 | (push (list inst-name (nreverse constant-alist) |
| 16460 | (nreverse signal-alist)) inst-alist)) | 16468 | (nreverse signal-alist)) |
| 16469 | inst-alist)) | ||
| 16461 | ;; prepare signal insertion | 16470 | ;; prepare signal insertion |
| 16462 | (vhdl-goto-marker arch-decl-pos) | 16471 | (vhdl-goto-marker arch-decl-pos) |
| 16463 | (forward-line 1) | 16472 | (forward-line 1) |
| @@ -16534,14 +16543,14 @@ component instantiation." | |||
| 16534 | generic-end-pos | 16543 | generic-end-pos |
| 16535 | (vhdl-compose-insert-generic constant-entry))) | 16544 | (vhdl-compose-insert-generic constant-entry))) |
| 16536 | (setq generic-pos (point-marker)) | 16545 | (setq generic-pos (point-marker)) |
| 16537 | (add-to-list 'written-list constant-name)) | 16546 | (pushnew constant-name written-list :test #'equal)) |
| 16538 | (t | 16547 | (t |
| 16539 | (vhdl-goto-marker | 16548 | (vhdl-goto-marker |
| 16540 | (vhdl-max-marker generic-inst-pos generic-pos)) | 16549 | (vhdl-max-marker generic-inst-pos generic-pos)) |
| 16541 | (setq generic-end-pos | 16550 | (setq generic-end-pos |
| 16542 | (vhdl-compose-insert-generic constant-entry)) | 16551 | (vhdl-compose-insert-generic constant-entry)) |
| 16543 | (setq generic-inst-pos (point-marker)) | 16552 | (setq generic-inst-pos (point-marker)) |
| 16544 | (add-to-list 'written-list constant-name)))) | 16553 | (pushnew constant-name written-list :test #'equal)))) |
| 16545 | (setq constant-alist (cdr constant-alist))) | 16554 | (setq constant-alist (cdr constant-alist))) |
| 16546 | (when (/= constant-temp-pos generic-inst-pos) | 16555 | (when (/= constant-temp-pos generic-inst-pos) |
| 16547 | (vhdl-goto-marker (vhdl-max-marker constant-temp-pos generic-pos)) | 16556 | (vhdl-goto-marker (vhdl-max-marker constant-temp-pos generic-pos)) |
| @@ -16560,14 +16569,14 @@ component instantiation." | |||
| 16560 | (vhdl-max-marker | 16569 | (vhdl-max-marker |
| 16561 | port-end-pos (vhdl-compose-insert-port signal-entry))) | 16570 | port-end-pos (vhdl-compose-insert-port signal-entry))) |
| 16562 | (setq port-in-pos (point-marker)) | 16571 | (setq port-in-pos (point-marker)) |
| 16563 | (add-to-list 'written-list signal-name)) | 16572 | (pushnew signal-name written-list :test #'equal)) |
| 16564 | ((member signal-name multi-out-list) | 16573 | ((member signal-name multi-out-list) |
| 16565 | (vhdl-goto-marker (vhdl-max-marker port-out-pos port-in-pos)) | 16574 | (vhdl-goto-marker (vhdl-max-marker port-out-pos port-in-pos)) |
| 16566 | (setq port-end-pos | 16575 | (setq port-end-pos |
| 16567 | (vhdl-max-marker | 16576 | (vhdl-max-marker |
| 16568 | port-end-pos (vhdl-compose-insert-port signal-entry))) | 16577 | port-end-pos (vhdl-compose-insert-port signal-entry))) |
| 16569 | (setq port-out-pos (point-marker)) | 16578 | (setq port-out-pos (point-marker)) |
| 16570 | (add-to-list 'written-list signal-name)) | 16579 | (pushnew signal-name written-list :test #'equal)) |
| 16571 | ((or (member signal-name single-in-list) | 16580 | ((or (member signal-name single-in-list) |
| 16572 | (member signal-name single-out-list)) | 16581 | (member signal-name single-out-list)) |
| 16573 | (vhdl-goto-marker | 16582 | (vhdl-goto-marker |
| @@ -16576,12 +16585,12 @@ component instantiation." | |||
| 16576 | (vhdl-max-marker port-out-pos port-in-pos))) | 16585 | (vhdl-max-marker port-out-pos port-in-pos))) |
| 16577 | (setq port-end-pos (vhdl-compose-insert-port signal-entry)) | 16586 | (setq port-end-pos (vhdl-compose-insert-port signal-entry)) |
| 16578 | (setq port-inst-pos (point-marker)) | 16587 | (setq port-inst-pos (point-marker)) |
| 16579 | (add-to-list 'written-list signal-name)) | 16588 | (pushnew signal-name written-list :test #'equal)) |
| 16580 | ((equal (upcase (nth 2 signal-entry)) "OUT") | 16589 | ((equal (upcase (nth 2 signal-entry)) "OUT") |
| 16581 | (vhdl-goto-marker signal-pos) | 16590 | (vhdl-goto-marker signal-pos) |
| 16582 | (vhdl-compose-insert-signal signal-entry) | 16591 | (vhdl-compose-insert-signal signal-entry) |
| 16583 | (setq signal-pos (point-marker)) | 16592 | (setq signal-pos (point-marker)) |
| 16584 | (add-to-list 'written-list signal-name))) | 16593 | (pushnew signal-name written-list :test #'equal))) |
| 16585 | (setq signal-alist (cdr signal-alist))) | 16594 | (setq signal-alist (cdr signal-alist))) |
| 16586 | (when (/= port-temp-pos port-inst-pos) | 16595 | (when (/= port-temp-pos port-inst-pos) |
| 16587 | (vhdl-goto-marker | 16596 | (vhdl-goto-marker |
| @@ -16932,7 +16941,7 @@ no project is defined." | |||
| 16932 | "Remove duplicate elements from IN-LIST." | 16941 | "Remove duplicate elements from IN-LIST." |
| 16933 | (let (out-list) | 16942 | (let (out-list) |
| 16934 | (while in-list | 16943 | (while in-list |
| 16935 | (add-to-list 'out-list (car in-list)) | 16944 | (pushnew (car in-list) out-list :test #'equal) |
| 16936 | (setq in-list (cdr in-list))) | 16945 | (setq in-list (cdr in-list))) |
| 16937 | out-list)) | 16946 | out-list)) |
| 16938 | 16947 | ||
diff --git a/lisp/progmodes/xref.el b/lisp/progmodes/xref.el index d8098c5a54a..a8933b0103e 100644 --- a/lisp/progmodes/xref.el +++ b/lisp/progmodes/xref.el | |||
| @@ -918,7 +918,7 @@ IGNORES is a list of glob patterns." | |||
| 918 | (grep-compute-defaults) | 918 | (grep-compute-defaults) |
| 919 | (defvar grep-find-template) | 919 | (defvar grep-find-template) |
| 920 | (defvar grep-highlight-matches) | 920 | (defvar grep-highlight-matches) |
| 921 | (let* ((grep-find-template (replace-regexp-in-string "-e " "-E " | 921 | (let* ((grep-find-template (replace-regexp-in-string "<C>" "<C> -E" |
| 922 | grep-find-template t t)) | 922 | grep-find-template t t)) |
| 923 | (grep-highlight-matches nil) | 923 | (grep-highlight-matches nil) |
| 924 | (command (xref--rgrep-command (xref--regexp-to-extended regexp) | 924 | (command (xref--rgrep-command (xref--regexp-to-extended regexp) |
diff --git a/lisp/recentf.el b/lisp/recentf.el index 2b1d22bb907..4f0573911b9 100644 --- a/lisp/recentf.el +++ b/lisp/recentf.el | |||
| @@ -82,7 +82,7 @@ See the command `recentf-save-list'." | |||
| 82 | recentf-mode | 82 | recentf-mode |
| 83 | (recentf-load-list))))) | 83 | (recentf-load-list))))) |
| 84 | 84 | ||
| 85 | (defcustom recentf-save-file-modes 384 ;; 0600 | 85 | (defcustom recentf-save-file-modes #o600 |
| 86 | "Mode bits of recentf save file, as an integer, or nil. | 86 | "Mode bits of recentf save file, as an integer, or nil. |
| 87 | If non-nil, after writing `recentf-save-file', set its mode bits to | 87 | If non-nil, after writing `recentf-save-file', set its mode bits to |
| 88 | this value. By default give R/W access only to the user who owns that | 88 | this value. By default give R/W access only to the user who owns that |
diff --git a/lisp/replace.el b/lisp/replace.el index ff917344453..a825040a979 100644 --- a/lisp/replace.el +++ b/lisp/replace.el | |||
| @@ -1304,6 +1304,19 @@ If the value is nil, don't highlight the buffer names specially." | |||
| 1304 | :type 'face | 1304 | :type 'face |
| 1305 | :group 'matching) | 1305 | :group 'matching) |
| 1306 | 1306 | ||
| 1307 | (defcustom list-matching-lines-current-line-face 'lazy-highlight | ||
| 1308 | "Face used by \\[list-matching-lines] to highlight the current line." | ||
| 1309 | :type 'face | ||
| 1310 | :group 'matching | ||
| 1311 | :version "26.1") | ||
| 1312 | |||
| 1313 | (defcustom list-matching-lines-jump-to-current-line nil | ||
| 1314 | "If non-nil, \\[list-matching-lines] shows the current line highlighted. | ||
| 1315 | Set the point right after such line when there are matches after it." | ||
| 1316 | :type 'boolean | ||
| 1317 | :group 'matching | ||
| 1318 | :version "26.1") | ||
| 1319 | |||
| 1307 | (defcustom list-matching-lines-prefix-face 'shadow | 1320 | (defcustom list-matching-lines-prefix-face 'shadow |
| 1308 | "Face used by \\[list-matching-lines] to show the prefix column. | 1321 | "Face used by \\[list-matching-lines] to show the prefix column. |
| 1309 | If the face doesn't differ from the default face, | 1322 | If the face doesn't differ from the default face, |
| @@ -1360,7 +1373,15 @@ invoke `occur'." | |||
| 1360 | "*") | 1373 | "*") |
| 1361 | (or unique-p (not interactive-p))))) | 1374 | (or unique-p (not interactive-p))))) |
| 1362 | 1375 | ||
| 1363 | (defun occur (regexp &optional nlines) | 1376 | ;; Region limits when `occur' applies on a region. |
| 1377 | (defvar occur--region-start nil) | ||
| 1378 | (defvar occur--region-end nil) | ||
| 1379 | (defvar occur--matches-threshold nil) | ||
| 1380 | (defvar occur--orig-line nil) | ||
| 1381 | (defvar occur--orig-line-str nil) | ||
| 1382 | (defvar occur--final-pos nil) | ||
| 1383 | |||
| 1384 | (defun occur (regexp &optional nlines region) | ||
| 1364 | "Show all lines in the current buffer containing a match for REGEXP. | 1385 | "Show all lines in the current buffer containing a match for REGEXP. |
| 1365 | If a match spreads across multiple lines, all those lines are shown. | 1386 | If a match spreads across multiple lines, all those lines are shown. |
| 1366 | 1387 | ||
| @@ -1369,9 +1390,17 @@ before if NLINES is negative. | |||
| 1369 | NLINES defaults to `list-matching-lines-default-context-lines'. | 1390 | NLINES defaults to `list-matching-lines-default-context-lines'. |
| 1370 | Interactively it is the prefix arg. | 1391 | Interactively it is the prefix arg. |
| 1371 | 1392 | ||
| 1393 | Optional arg REGION, if non-nil, mean restrict search to the | ||
| 1394 | specified region. Otherwise search the entire buffer. | ||
| 1395 | REGION must be a list of (START . END) positions as returned by | ||
| 1396 | `region-bounds'. | ||
| 1397 | |||
| 1372 | The lines are shown in a buffer named `*Occur*'. | 1398 | The lines are shown in a buffer named `*Occur*'. |
| 1373 | It serves as a menu to find any of the occurrences in this buffer. | 1399 | It serves as a menu to find any of the occurrences in this buffer. |
| 1374 | \\<occur-mode-map>\\[describe-mode] in that buffer will explain how. | 1400 | \\<occur-mode-map>\\[describe-mode] in that buffer will explain how. |
| 1401 | If `list-matching-lines-jump-to-current-line' is non-nil, then show | ||
| 1402 | the current line highlighted with `list-matching-lines-current-line-face' | ||
| 1403 | and set point at the first match after such line. | ||
| 1375 | 1404 | ||
| 1376 | If REGEXP contains upper case characters (excluding those preceded by `\\') | 1405 | If REGEXP contains upper case characters (excluding those preceded by `\\') |
| 1377 | and `search-upper-case' is non-nil, the matching is case-sensitive. | 1406 | and `search-upper-case' is non-nil, the matching is case-sensitive. |
| @@ -1386,8 +1415,30 @@ For example, providing \"defun\\s +\\(\\S +\\)\" for REGEXP and | |||
| 1386 | program. When there is no parenthesized subexpressions in REGEXP | 1415 | program. When there is no parenthesized subexpressions in REGEXP |
| 1387 | the entire match is collected. In any case the searched buffer | 1416 | the entire match is collected. In any case the searched buffer |
| 1388 | is not modified." | 1417 | is not modified." |
| 1389 | (interactive (occur-read-primary-args)) | 1418 | (interactive |
| 1390 | (occur-1 regexp nlines (list (current-buffer)))) | 1419 | (nconc (occur-read-primary-args) |
| 1420 | (and (use-region-p) (list (region-bounds))))) | ||
| 1421 | (let* ((start (and (caar region) (max (caar region) (point-min)))) | ||
| 1422 | (end (and (cdar region) (min (cdar region) (point-max)))) | ||
| 1423 | (in-region-p (or start end))) | ||
| 1424 | (when in-region-p | ||
| 1425 | (or start (setq start (point-min))) | ||
| 1426 | (or end (setq end (point-max)))) | ||
| 1427 | (let ((occur--region-start start) | ||
| 1428 | (occur--region-end end) | ||
| 1429 | (occur--matches-threshold | ||
| 1430 | (and in-region-p | ||
| 1431 | (line-number-at-pos (min start end)))) | ||
| 1432 | (occur--orig-line | ||
| 1433 | (line-number-at-pos (point))) | ||
| 1434 | (occur--orig-line-str | ||
| 1435 | (buffer-substring-no-properties | ||
| 1436 | (line-beginning-position) | ||
| 1437 | (line-end-position)))) | ||
| 1438 | (save-excursion ; If no matches `occur-1' doesn't restore the point. | ||
| 1439 | (and in-region-p (narrow-to-region start end)) | ||
| 1440 | (occur-1 regexp nlines (list (current-buffer))) | ||
| 1441 | (and in-region-p (widen)))))) | ||
| 1391 | 1442 | ||
| 1392 | (defvar ido-ignore-item-temp-list) | 1443 | (defvar ido-ignore-item-temp-list) |
| 1393 | 1444 | ||
| @@ -1482,7 +1533,8 @@ See also `multi-occur'." | |||
| 1482 | (occur-mode)) | 1533 | (occur-mode)) |
| 1483 | (let ((inhibit-read-only t) | 1534 | (let ((inhibit-read-only t) |
| 1484 | ;; Don't generate undo entries for creation of the initial contents. | 1535 | ;; Don't generate undo entries for creation of the initial contents. |
| 1485 | (buffer-undo-list t)) | 1536 | (buffer-undo-list t) |
| 1537 | (occur--final-pos nil)) | ||
| 1486 | (erase-buffer) | 1538 | (erase-buffer) |
| 1487 | (let ((count | 1539 | (let ((count |
| 1488 | (if (stringp nlines) | 1540 | (if (stringp nlines) |
| @@ -1534,6 +1586,10 @@ See also `multi-occur'." | |||
| 1534 | (if (= count 0) | 1586 | (if (= count 0) |
| 1535 | (kill-buffer occur-buf) | 1587 | (kill-buffer occur-buf) |
| 1536 | (display-buffer occur-buf) | 1588 | (display-buffer occur-buf) |
| 1589 | (when occur--final-pos | ||
| 1590 | (set-window-point | ||
| 1591 | (get-buffer-window occur-buf 'all-frames) | ||
| 1592 | occur--final-pos)) | ||
| 1537 | (setq next-error-last-buffer occur-buf) | 1593 | (setq next-error-last-buffer occur-buf) |
| 1538 | (setq buffer-read-only t) | 1594 | (setq buffer-read-only t) |
| 1539 | (set-buffer-modified-p nil) | 1595 | (set-buffer-modified-p nil) |
| @@ -1545,19 +1601,26 @@ See also `multi-occur'." | |||
| 1545 | (let ((global-lines 0) ;; total count of matching lines | 1601 | (let ((global-lines 0) ;; total count of matching lines |
| 1546 | (global-matches 0) ;; total count of matches | 1602 | (global-matches 0) ;; total count of matches |
| 1547 | (coding nil) | 1603 | (coding nil) |
| 1548 | (case-fold-search case-fold)) | 1604 | (case-fold-search case-fold) |
| 1605 | (in-region-p (and occur--region-start occur--region-end)) | ||
| 1606 | (multi-occur-p (cdr buffers))) | ||
| 1549 | ;; Map over all the buffers | 1607 | ;; Map over all the buffers |
| 1550 | (dolist (buf buffers) | 1608 | (dolist (buf buffers) |
| 1551 | (when (buffer-live-p buf) | 1609 | (when (buffer-live-p buf) |
| 1552 | (let ((lines 0) ;; count of matching lines | 1610 | (let ((lines 0) ;; count of matching lines |
| 1553 | (matches 0) ;; count of matches | 1611 | (matches 0) ;; count of matches |
| 1554 | (curr-line 1) ;; line count | 1612 | (curr-line ;; line count |
| 1613 | (or occur--matches-threshold 1)) | ||
| 1614 | (orig-line occur--orig-line) | ||
| 1615 | (orig-line-str occur--orig-line-str) | ||
| 1616 | (orig-line-shown-p) | ||
| 1555 | (prev-line nil) ;; line number of prev match endpt | 1617 | (prev-line nil) ;; line number of prev match endpt |
| 1556 | (prev-after-lines nil) ;; context lines of prev match | 1618 | (prev-after-lines nil) ;; context lines of prev match |
| 1557 | (matchbeg 0) | 1619 | (matchbeg 0) |
| 1558 | (origpt nil) | 1620 | (origpt nil) |
| 1559 | (begpt nil) | 1621 | (begpt nil) |
| 1560 | (endpt nil) | 1622 | (endpt nil) |
| 1623 | (finalpt nil) | ||
| 1561 | (marker nil) | 1624 | (marker nil) |
| 1562 | (curstring "") | 1625 | (curstring "") |
| 1563 | (ret nil) | 1626 | (ret nil) |
| @@ -1658,6 +1721,18 @@ See also `multi-occur'." | |||
| 1658 | (nth 0 ret)))) | 1721 | (nth 0 ret)))) |
| 1659 | ;; Actually insert the match display data | 1722 | ;; Actually insert the match display data |
| 1660 | (with-current-buffer out-buf | 1723 | (with-current-buffer out-buf |
| 1724 | (when (and list-matching-lines-jump-to-current-line | ||
| 1725 | (not multi-occur-p) | ||
| 1726 | (not orig-line-shown-p) | ||
| 1727 | (>= curr-line orig-line)) | ||
| 1728 | (insert | ||
| 1729 | (concat | ||
| 1730 | (propertize | ||
| 1731 | (format "%7d:%s" orig-line orig-line-str) | ||
| 1732 | 'face list-matching-lines-current-line-face | ||
| 1733 | 'mouse-face 'mode-line-highlight | ||
| 1734 | 'help-echo "Current line") "\n")) | ||
| 1735 | (setq orig-line-shown-p t finalpt (point))) | ||
| 1661 | (insert data))) | 1736 | (insert data))) |
| 1662 | (goto-char endpt)) | 1737 | (goto-char endpt)) |
| 1663 | (if endpt | 1738 | (if endpt |
| @@ -1671,6 +1746,18 @@ See also `multi-occur'." | |||
| 1671 | (forward-line 1)) | 1746 | (forward-line 1)) |
| 1672 | (goto-char (point-max))) | 1747 | (goto-char (point-max))) |
| 1673 | (setq prev-line (1- curr-line))) | 1748 | (setq prev-line (1- curr-line))) |
| 1749 | ;; Insert original line if haven't done yet. | ||
| 1750 | (when (and list-matching-lines-jump-to-current-line | ||
| 1751 | (not multi-occur-p) | ||
| 1752 | (not orig-line-shown-p)) | ||
| 1753 | (with-current-buffer out-buf | ||
| 1754 | (insert | ||
| 1755 | (concat | ||
| 1756 | (propertize | ||
| 1757 | (format "%7d:%s" orig-line orig-line-str) | ||
| 1758 | 'face list-matching-lines-current-line-face | ||
| 1759 | 'mouse-face 'mode-line-highlight | ||
| 1760 | 'help-echo "Current line") "\n")))) | ||
| 1674 | ;; Flush remaining context after-lines. | 1761 | ;; Flush remaining context after-lines. |
| 1675 | (when prev-after-lines | 1762 | (when prev-after-lines |
| 1676 | (with-current-buffer out-buf | 1763 | (with-current-buffer out-buf |
| @@ -1684,7 +1771,7 @@ See also `multi-occur'." | |||
| 1684 | (let ((beg (point)) | 1771 | (let ((beg (point)) |
| 1685 | end) | 1772 | end) |
| 1686 | (insert (propertize | 1773 | (insert (propertize |
| 1687 | (format "%d match%s%s%s in buffer: %s\n" | 1774 | (format "%d match%s%s%s in buffer: %s%s\n" |
| 1688 | matches (if (= matches 1) "" "es") | 1775 | matches (if (= matches 1) "" "es") |
| 1689 | ;; Don't display the same number of lines | 1776 | ;; Don't display the same number of lines |
| 1690 | ;; and matches in case of 1 match per line. | 1777 | ;; and matches in case of 1 match per line. |
| @@ -1694,13 +1781,21 @@ See also `multi-occur'." | |||
| 1694 | ;; Don't display regexp for multi-buffer. | 1781 | ;; Don't display regexp for multi-buffer. |
| 1695 | (if (> (length buffers) 1) | 1782 | (if (> (length buffers) 1) |
| 1696 | "" (occur-regexp-descr regexp)) | 1783 | "" (occur-regexp-descr regexp)) |
| 1697 | (buffer-name buf)) | 1784 | (buffer-name buf) |
| 1785 | (if in-region-p | ||
| 1786 | (format " within region: %d-%d" | ||
| 1787 | occur--region-start | ||
| 1788 | occur--region-end) | ||
| 1789 | "")) | ||
| 1698 | 'read-only t)) | 1790 | 'read-only t)) |
| 1699 | (setq end (point)) | 1791 | (setq end (point)) |
| 1700 | (add-text-properties beg end `(occur-title ,buf)) | 1792 | (add-text-properties beg end `(occur-title ,buf)) |
| 1701 | (when title-face | 1793 | (when title-face |
| 1702 | (add-face-text-property beg end title-face))) | 1794 | (add-face-text-property beg end title-face)) |
| 1703 | (goto-char (point-min))))))) | 1795 | (goto-char (if finalpt |
| 1796 | (setq occur--final-pos | ||
| 1797 | (cl-incf finalpt (- end beg))) | ||
| 1798 | (point-min))))))))) | ||
| 1704 | ;; Display total match count and regexp for multi-buffer. | 1799 | ;; Display total match count and regexp for multi-buffer. |
| 1705 | (when (and (not (zerop global-lines)) (> (length buffers) 1)) | 1800 | (when (and (not (zerop global-lines)) (> (length buffers) 1)) |
| 1706 | (goto-char (point-min)) | 1801 | (goto-char (point-min)) |
diff --git a/lisp/shell.el b/lisp/shell.el index 133771aeb32..c8a8555d632 100644 --- a/lisp/shell.el +++ b/lisp/shell.el | |||
| @@ -544,11 +544,14 @@ control whether input and output cause the window to scroll to the end of the | |||
| 544 | buffer." | 544 | buffer." |
| 545 | (setq comint-prompt-regexp shell-prompt-pattern) | 545 | (setq comint-prompt-regexp shell-prompt-pattern) |
| 546 | (shell-completion-vars) | 546 | (shell-completion-vars) |
| 547 | (set (make-local-variable 'paragraph-separate) "\\'") | 547 | (setq-local paragraph-separate "\\'") |
| 548 | (set (make-local-variable 'paragraph-start) comint-prompt-regexp) | 548 | (setq-local paragraph-start comint-prompt-regexp) |
| 549 | (set (make-local-variable 'font-lock-defaults) '(shell-font-lock-keywords t)) | 549 | (setq-local font-lock-defaults '(shell-font-lock-keywords t)) |
| 550 | (set (make-local-variable 'shell-dirstack) nil) | 550 | (setq-local shell-dirstack nil) |
| 551 | (set (make-local-variable 'shell-last-dir) nil) | 551 | (setq-local shell-last-dir nil) |
| 552 | ;; People expect Shell mode to keep the last line of output at | ||
| 553 | ;; window bottom. | ||
| 554 | (setq-local scroll-conservatively 101) | ||
| 552 | (shell-dirtrack-mode 1) | 555 | (shell-dirtrack-mode 1) |
| 553 | 556 | ||
| 554 | ;; By default, ansi-color applies faces using overlays. This is | 557 | ;; By default, ansi-color applies faces using overlays. This is |
diff --git a/lisp/simple.el b/lisp/simple.el index f798cd43847..441713a18b8 100644 --- a/lisp/simple.el +++ b/lisp/simple.el | |||
| @@ -5410,11 +5410,15 @@ also checks the value of `use-empty-active-region'." | |||
| 5410 | ;; region is active when there's no mark. | 5410 | ;; region is active when there's no mark. |
| 5411 | (progn (cl-assert (mark)) t))) | 5411 | (progn (cl-assert (mark)) t))) |
| 5412 | 5412 | ||
| 5413 | (defun region-bounds () | ||
| 5414 | "Return the boundaries of the region as a list of (START . END) positions." | ||
| 5415 | (funcall region-extract-function 'bounds)) | ||
| 5416 | |||
| 5413 | (defun region-noncontiguous-p () | 5417 | (defun region-noncontiguous-p () |
| 5414 | "Return non-nil if the region contains several pieces. | 5418 | "Return non-nil if the region contains several pieces. |
| 5415 | An example is a rectangular region handled as a list of | 5419 | An example is a rectangular region handled as a list of |
| 5416 | separate contiguous regions for each line." | 5420 | separate contiguous regions for each line." |
| 5417 | (> (length (funcall region-extract-function 'bounds)) 1)) | 5421 | (> (length (region-bounds)) 1)) |
| 5418 | 5422 | ||
| 5419 | (defvar redisplay-unhighlight-region-function | 5423 | (defvar redisplay-unhighlight-region-function |
| 5420 | (lambda (rol) (when (overlayp rol) (delete-overlay rol)))) | 5424 | (lambda (rol) (when (overlayp rol) (delete-overlay rol)))) |
| @@ -7568,7 +7572,7 @@ More precisely, a char with closeparen syntax is self-inserted.") | |||
| 7568 | 7572 | ||
| 7569 | ;; This executes C-g typed while Emacs is waiting for a command. | 7573 | ;; This executes C-g typed while Emacs is waiting for a command. |
| 7570 | ;; Quitting out of a program does not go through here; | 7574 | ;; Quitting out of a program does not go through here; |
| 7571 | ;; that happens in the QUIT macro at the C code level. | 7575 | ;; that happens in the maybe_quit function at the C code level. |
| 7572 | (defun keyboard-quit () | 7576 | (defun keyboard-quit () |
| 7573 | "Signal a `quit' condition. | 7577 | "Signal a `quit' condition. |
| 7574 | During execution of Lisp code, this character causes a quit directly. | 7578 | During execution of Lisp code, this character causes a quit directly. |
diff --git a/lisp/subr.el b/lisp/subr.el index 53774169b42..a204577ddf9 100644 --- a/lisp/subr.el +++ b/lisp/subr.el | |||
| @@ -384,6 +384,126 @@ configuration." | |||
| 384 | (declare (compiler-macro internal--compiler-macro-cXXr)) | 384 | (declare (compiler-macro internal--compiler-macro-cXXr)) |
| 385 | (cdr (cdr x))) | 385 | (cdr (cdr x))) |
| 386 | 386 | ||
| 387 | (defun caaar (x) | ||
| 388 | "Return the `car' of the `car' of the `car' of X." | ||
| 389 | (declare (compiler-macro internal--compiler-macro-cXXr)) | ||
| 390 | (car (car (car x)))) | ||
| 391 | |||
| 392 | (defun caadr (x) | ||
| 393 | "Return the `car' of the `car' of the `cdr' of X." | ||
| 394 | (declare (compiler-macro internal--compiler-macro-cXXr)) | ||
| 395 | (car (car (cdr x)))) | ||
| 396 | |||
| 397 | (defun cadar (x) | ||
| 398 | "Return the `car' of the `cdr' of the `car' of X." | ||
| 399 | (declare (compiler-macro internal--compiler-macro-cXXr)) | ||
| 400 | (car (cdr (car x)))) | ||
| 401 | |||
| 402 | (defun caddr (x) | ||
| 403 | "Return the `car' of the `cdr' of the `cdr' of X." | ||
| 404 | (declare (compiler-macro internal--compiler-macro-cXXr)) | ||
| 405 | (car (cdr (cdr x)))) | ||
| 406 | |||
| 407 | (defun cdaar (x) | ||
| 408 | "Return the `cdr' of the `car' of the `car' of X." | ||
| 409 | (declare (compiler-macro internal--compiler-macro-cXXr)) | ||
| 410 | (cdr (car (car x)))) | ||
| 411 | |||
| 412 | (defun cdadr (x) | ||
| 413 | "Return the `cdr' of the `car' of the `cdr' of X." | ||
| 414 | (declare (compiler-macro internal--compiler-macro-cXXr)) | ||
| 415 | (cdr (car (cdr x)))) | ||
| 416 | |||
| 417 | (defun cddar (x) | ||
| 418 | "Return the `cdr' of the `cdr' of the `car' of X." | ||
| 419 | (declare (compiler-macro internal--compiler-macro-cXXr)) | ||
| 420 | (cdr (cdr (car x)))) | ||
| 421 | |||
| 422 | (defun cdddr (x) | ||
| 423 | "Return the `cdr' of the `cdr' of the `cdr' of X." | ||
| 424 | (declare (compiler-macro internal--compiler-macro-cXXr)) | ||
| 425 | (cdr (cdr (cdr x)))) | ||
| 426 | |||
| 427 | (defun caaaar (x) | ||
| 428 | "Return the `car' of the `car' of the `car' of the `car' of X." | ||
| 429 | (declare (compiler-macro internal--compiler-macro-cXXr)) | ||
| 430 | (car (car (car (car x))))) | ||
| 431 | |||
| 432 | (defun caaadr (x) | ||
| 433 | "Return the `car' of the `car' of the `car' of the `cdr' of X." | ||
| 434 | (declare (compiler-macro internal--compiler-macro-cXXr)) | ||
| 435 | (car (car (car (cdr x))))) | ||
| 436 | |||
| 437 | (defun caadar (x) | ||
| 438 | "Return the `car' of the `car' of the `cdr' of the `car' of X." | ||
| 439 | (declare (compiler-macro internal--compiler-macro-cXXr)) | ||
| 440 | (car (car (cdr (car x))))) | ||
| 441 | |||
| 442 | (defun caaddr (x) | ||
| 443 | "Return the `car' of the `car' of the `cdr' of the `cdr' of X." | ||
| 444 | (declare (compiler-macro internal--compiler-macro-cXXr)) | ||
| 445 | (car (car (cdr (cdr x))))) | ||
| 446 | |||
| 447 | (defun cadaar (x) | ||
| 448 | "Return the `car' of the `cdr' of the `car' of the `car' of X." | ||
| 449 | (declare (compiler-macro internal--compiler-macro-cXXr)) | ||
| 450 | (car (cdr (car (car x))))) | ||
| 451 | |||
| 452 | (defun cadadr (x) | ||
| 453 | "Return the `car' of the `cdr' of the `car' of the `cdr' of X." | ||
| 454 | (declare (compiler-macro internal--compiler-macro-cXXr)) | ||
| 455 | (car (cdr (car (cdr x))))) | ||
| 456 | |||
| 457 | (defun caddar (x) | ||
| 458 | "Return the `car' of the `cdr' of the `cdr' of the `car' of X." | ||
| 459 | (declare (compiler-macro internal--compiler-macro-cXXr)) | ||
| 460 | (car (cdr (cdr (car x))))) | ||
| 461 | |||
| 462 | (defun cadddr (x) | ||
| 463 | "Return the `car' of the `cdr' of the `cdr' of the `cdr' of X." | ||
| 464 | (declare (compiler-macro internal--compiler-macro-cXXr)) | ||
| 465 | (car (cdr (cdr (cdr x))))) | ||
| 466 | |||
| 467 | (defun cdaaar (x) | ||
| 468 | "Return the `cdr' of the `car' of the `car' of the `car' of X." | ||
| 469 | (declare (compiler-macro internal--compiler-macro-cXXr)) | ||
| 470 | (cdr (car (car (car x))))) | ||
| 471 | |||
| 472 | (defun cdaadr (x) | ||
| 473 | "Return the `cdr' of the `car' of the `car' of the `cdr' of X." | ||
| 474 | (declare (compiler-macro internal--compiler-macro-cXXr)) | ||
| 475 | (cdr (car (car (cdr x))))) | ||
| 476 | |||
| 477 | (defun cdadar (x) | ||
| 478 | "Return the `cdr' of the `car' of the `cdr' of the `car' of X." | ||
| 479 | (declare (compiler-macro internal--compiler-macro-cXXr)) | ||
| 480 | (cdr (car (cdr (car x))))) | ||
| 481 | |||
| 482 | (defun cdaddr (x) | ||
| 483 | "Return the `cdr' of the `car' of the `cdr' of the `cdr' of X." | ||
| 484 | (declare (compiler-macro internal--compiler-macro-cXXr)) | ||
| 485 | (cdr (car (cdr (cdr x))))) | ||
| 486 | |||
| 487 | (defun cddaar (x) | ||
| 488 | "Return the `cdr' of the `cdr' of the `car' of the `car' of X." | ||
| 489 | (declare (compiler-macro internal--compiler-macro-cXXr)) | ||
| 490 | (cdr (cdr (car (car x))))) | ||
| 491 | |||
| 492 | (defun cddadr (x) | ||
| 493 | "Return the `cdr' of the `cdr' of the `car' of the `cdr' of X." | ||
| 494 | (declare (compiler-macro internal--compiler-macro-cXXr)) | ||
| 495 | (cdr (cdr (car (cdr x))))) | ||
| 496 | |||
| 497 | (defun cdddar (x) | ||
| 498 | "Return the `cdr' of the `cdr' of the `cdr' of the `car' of X." | ||
| 499 | (declare (compiler-macro internal--compiler-macro-cXXr)) | ||
| 500 | (cdr (cdr (cdr (car x))))) | ||
| 501 | |||
| 502 | (defun cddddr (x) | ||
| 503 | "Return the `cdr' of the `cdr' of the `cdr' of the `cdr' of X." | ||
| 504 | (declare (compiler-macro internal--compiler-macro-cXXr)) | ||
| 505 | (cdr (cdr (cdr (cdr x))))) | ||
| 506 | |||
| 387 | (defun last (list &optional n) | 507 | (defun last (list &optional n) |
| 388 | "Return the last link of LIST. Its car is the last element. | 508 | "Return the last link of LIST. Its car is the last element. |
| 389 | If LIST is nil, return nil. | 509 | If LIST is nil, return nil. |
| @@ -1297,8 +1417,10 @@ be a list of the form returned by `event-start' and `event-end'." | |||
| 1297 | ;; bug#23850 | 1417 | ;; bug#23850 |
| 1298 | (make-obsolete 'string-to-unibyte "use `encode-coding-string'." "26.1") | 1418 | (make-obsolete 'string-to-unibyte "use `encode-coding-string'." "26.1") |
| 1299 | (make-obsolete 'string-as-unibyte "use `encode-coding-string'." "26.1") | 1419 | (make-obsolete 'string-as-unibyte "use `encode-coding-string'." "26.1") |
| 1420 | (make-obsolete 'string-make-unibyte "use `encode-coding-string'." "26.1") | ||
| 1300 | (make-obsolete 'string-to-multibyte "use `decode-coding-string'." "26.1") | 1421 | (make-obsolete 'string-to-multibyte "use `decode-coding-string'." "26.1") |
| 1301 | (make-obsolete 'string-as-multibyte "use `decode-coding-string'." "26.1") | 1422 | (make-obsolete 'string-as-multibyte "use `decode-coding-string'." "26.1") |
| 1423 | (make-obsolete 'string-make-multibyte "use `decode-coding-string'." "26.1") | ||
| 1302 | 1424 | ||
| 1303 | (defun log10 (x) | 1425 | (defun log10 (x) |
| 1304 | "Return (log X 10), the log base 10 of X." | 1426 | "Return (log X 10), the log base 10 of X." |
diff --git a/lisp/term.el b/lisp/term.el index 5259571eb6d..063a6ea592f 100644 --- a/lisp/term.el +++ b/lisp/term.el | |||
| @@ -2901,15 +2901,16 @@ See `term-prompt-regexp'." | |||
| 2901 | ((eq char ?\017)) ; Shift In - ignored | 2901 | ((eq char ?\017)) ; Shift In - ignored |
| 2902 | ((eq char ?\^G) ;; (terminfo: bel) | 2902 | ((eq char ?\^G) ;; (terminfo: bel) |
| 2903 | (beep t)) | 2903 | (beep t)) |
| 2904 | ((and (eq char ?\032) | 2904 | ((eq char ?\032) |
| 2905 | (not handled-ansi-message)) | ||
| 2906 | (let ((end (string-match "\r?\n" str i))) | 2905 | (let ((end (string-match "\r?\n" str i))) |
| 2907 | (if end | 2906 | (if end |
| 2908 | (funcall term-command-hook | 2907 | (progn |
| 2909 | (decode-coding-string | 2908 | (unless handled-ansi-message |
| 2910 | (prog1 (substring str (1+ i) end) | 2909 | (funcall term-command-hook |
| 2911 | (setq i (1- (match-end 0)))) | 2910 | (decode-coding-string |
| 2912 | locale-coding-system)) | 2911 | (substring str (1+ i) end) |
| 2912 | locale-coding-system))) | ||
| 2913 | (setq i (1- (match-end 0)))) | ||
| 2913 | (setq term-terminal-parameter (substring str i)) | 2914 | (setq term-terminal-parameter (substring str i)) |
| 2914 | (setq term-terminal-state 4) | 2915 | (setq term-terminal-state 4) |
| 2915 | (setq i str-length)))) | 2916 | (setq i str-length)))) |
diff --git a/lisp/textmodes/css-mode.el b/lisp/textmodes/css-mode.el index c81c3f62e16..0c7d76f7924 100644 --- a/lisp/textmodes/css-mode.el +++ b/lisp/textmodes/css-mode.el | |||
| @@ -32,9 +32,11 @@ | |||
| 32 | 32 | ||
| 33 | ;;; Code: | 33 | ;;; Code: |
| 34 | 34 | ||
| 35 | (require 'eww) | ||
| 35 | (require 'seq) | 36 | (require 'seq) |
| 36 | (require 'sgml-mode) | 37 | (require 'sgml-mode) |
| 37 | (require 'smie) | 38 | (require 'smie) |
| 39 | (require 'subr-x) | ||
| 38 | 40 | ||
| 39 | (defgroup css nil | 41 | (defgroup css nil |
| 40 | "Cascading Style Sheets (CSS) editing mode." | 42 | "Cascading Style Sheets (CSS) editing mode." |
| @@ -621,6 +623,12 @@ cannot be completed sensibly: `custom-ident', | |||
| 621 | (modify-syntax-entry ?- "_" st) | 623 | (modify-syntax-entry ?- "_" st) |
| 622 | st)) | 624 | st)) |
| 623 | 625 | ||
| 626 | (defvar css-mode-map | ||
| 627 | (let ((map (make-sparse-keymap))) | ||
| 628 | (define-key map [remap info-lookup-symbol] 'css-lookup-symbol) | ||
| 629 | map) | ||
| 630 | "Keymap used in `css-mode'.") | ||
| 631 | |||
| 624 | (eval-and-compile | 632 | (eval-and-compile |
| 625 | (defconst css--uri-re | 633 | (defconst css--uri-re |
| 626 | (concat | 634 | (concat |
| @@ -734,7 +742,30 @@ cannot be completed sensibly: `custom-ident', | |||
| 734 | 742 | ||
| 735 | (defconst css-smie-grammar | 743 | (defconst css-smie-grammar |
| 736 | (smie-prec2->grammar | 744 | (smie-prec2->grammar |
| 737 | (smie-precs->prec2 '((assoc ";") (assoc ",") (left ":"))))) | 745 | (smie-precs->prec2 |
| 746 | '((assoc ";") | ||
| 747 | ;; Colons that belong to a CSS property. These get a higher | ||
| 748 | ;; precedence than other colons, such as colons in selectors, | ||
| 749 | ;; which are represented by a plain ":" token. | ||
| 750 | (left ":-property") | ||
| 751 | (assoc ",") | ||
| 752 | (assoc ":"))))) | ||
| 753 | |||
| 754 | (defun css--colon-inside-selector-p () | ||
| 755 | "Return t if point looks to be inside a CSS selector. | ||
| 756 | This function is intended to be good enough to help SMIE during | ||
| 757 | tokenization, but should not be regarded as a reliable function | ||
| 758 | for determining whether point is within a selector." | ||
| 759 | (save-excursion | ||
| 760 | (re-search-forward "[{};)]" nil t) | ||
| 761 | (eq (char-before) ?\{))) | ||
| 762 | |||
| 763 | (defun css--colon-inside-funcall () | ||
| 764 | "Return t if point is inside a function call." | ||
| 765 | (when-let (opening-paren-pos (nth 1 (syntax-ppss))) | ||
| 766 | (save-excursion | ||
| 767 | (goto-char opening-paren-pos) | ||
| 768 | (eq (char-after) ?\()))) | ||
| 738 | 769 | ||
| 739 | (defun css-smie--forward-token () | 770 | (defun css-smie--forward-token () |
| 740 | (cond | 771 | (cond |
| @@ -748,7 +779,13 @@ cannot be completed sensibly: `custom-ident', | |||
| 748 | ";") | 779 | ";") |
| 749 | ((progn (forward-comment (point-max)) | 780 | ((progn (forward-comment (point-max)) |
| 750 | (looking-at "[;,:]")) | 781 | (looking-at "[;,:]")) |
| 751 | (forward-char 1) (match-string 0)) | 782 | (forward-char 1) |
| 783 | (if (equal (match-string 0) ":") | ||
| 784 | (if (or (css--colon-inside-selector-p) | ||
| 785 | (css--colon-inside-funcall)) | ||
| 786 | ":" | ||
| 787 | ":-property") | ||
| 788 | (match-string 0))) | ||
| 752 | (t (smie-default-forward-token)))) | 789 | (t (smie-default-forward-token)))) |
| 753 | 790 | ||
| 754 | (defun css-smie--backward-token () | 791 | (defun css-smie--backward-token () |
| @@ -759,7 +796,13 @@ cannot be completed sensibly: `custom-ident', | |||
| 759 | ((and (eq (char-before) ?\}) (scss-smie--not-interpolation-p) | 796 | ((and (eq (char-before) ?\}) (scss-smie--not-interpolation-p) |
| 760 | (> pos (point))) ";") | 797 | (> pos (point))) ";") |
| 761 | ((memq (char-before) '(?\; ?\, ?\:)) | 798 | ((memq (char-before) '(?\; ?\, ?\:)) |
| 762 | (forward-char -1) (string (char-after))) | 799 | (forward-char -1) |
| 800 | (if (eq (char-after) ?\:) | ||
| 801 | (if (or (css--colon-inside-selector-p) | ||
| 802 | (css--colon-inside-funcall)) | ||
| 803 | ":" | ||
| 804 | ":-property") | ||
| 805 | (string (char-after)))) | ||
| 763 | (t (smie-default-backward-token))))) | 806 | (t (smie-default-backward-token))))) |
| 764 | 807 | ||
| 765 | (defun css-smie-rules (kind token) | 808 | (defun css-smie-rules (kind token) |
| @@ -1087,5 +1130,112 @@ pseudo-elements, pseudo-classes, at-rules, and bang-rules." | |||
| 1087 | (setq-local font-lock-defaults | 1130 | (setq-local font-lock-defaults |
| 1088 | (list (scss-font-lock-keywords) nil t))) | 1131 | (list (scss-font-lock-keywords) nil t))) |
| 1089 | 1132 | ||
| 1133 | |||
| 1134 | |||
| 1135 | (defvar css--mdn-lookup-history nil) | ||
| 1136 | |||
| 1137 | (defcustom css-lookup-url-format | ||
| 1138 | "https://developer.mozilla.org/en-US/docs/Web/CSS/%s?raw¯os" | ||
| 1139 | "Format for a URL where CSS documentation can be found. | ||
| 1140 | The format should include a single \"%s\" substitution. | ||
| 1141 | The name of the CSS property, @-id, pseudo-class, or pseudo-element | ||
| 1142 | to look up will be substituted there." | ||
| 1143 | :version "26.1" | ||
| 1144 | :type 'string | ||
| 1145 | :group 'css) | ||
| 1146 | |||
| 1147 | (defun css--mdn-after-render () | ||
| 1148 | (setf header-line-format nil) | ||
| 1149 | (goto-char (point-min)) | ||
| 1150 | (let ((window (get-buffer-window (current-buffer) 'visible))) | ||
| 1151 | (when window | ||
| 1152 | (when (re-search-forward "^Summary" nil 'move) | ||
| 1153 | (beginning-of-line) | ||
| 1154 | (set-window-start window (point)))))) | ||
| 1155 | |||
| 1156 | (defconst css--mdn-symbol-regexp | ||
| 1157 | (concat "\\(" | ||
| 1158 | ;; @-ids. | ||
| 1159 | "\\(@" (regexp-opt css-at-ids) "\\)" | ||
| 1160 | "\\|" | ||
| 1161 | ;; ;; Known properties. | ||
| 1162 | (regexp-opt css-property-ids t) | ||
| 1163 | "\\|" | ||
| 1164 | ;; Pseudo-classes. | ||
| 1165 | "\\(:" (regexp-opt css-pseudo-class-ids) "\\)" | ||
| 1166 | "\\|" | ||
| 1167 | ;; Pseudo-elements with either one or two ":"s. | ||
| 1168 | "\\(::?" (regexp-opt css-pseudo-element-ids) "\\)" | ||
| 1169 | "\\)") | ||
| 1170 | "Regular expression to match the CSS symbol at point.") | ||
| 1171 | |||
| 1172 | (defconst css--mdn-property-regexp | ||
| 1173 | (concat "\\_<" (regexp-opt css-property-ids t) "\\s-*\\(?:\\=\\|:\\)") | ||
| 1174 | "Regular expression to match a CSS property.") | ||
| 1175 | |||
| 1176 | (defconst css--mdn-completion-list | ||
| 1177 | (nconc | ||
| 1178 | ;; @-ids. | ||
| 1179 | (mapcar (lambda (atrule) (concat "@" atrule)) css-at-ids) | ||
| 1180 | ;; Pseudo-classes. | ||
| 1181 | (mapcar (lambda (class) (concat ":" class)) css-pseudo-class-ids) | ||
| 1182 | ;; Pseudo-elements with either one or two ":"s. | ||
| 1183 | (mapcar (lambda (elt) (concat ":" elt)) css-pseudo-element-ids) | ||
| 1184 | (mapcar (lambda (elt) (concat "::" elt)) css-pseudo-element-ids) | ||
| 1185 | ;; Properties. | ||
| 1186 | css-property-ids) | ||
| 1187 | "List of all symbols available for lookup via MDN.") | ||
| 1188 | |||
| 1189 | (defun css--mdn-find-symbol () | ||
| 1190 | "A helper for `css-lookup-symbol' that finds the symbol at point. | ||
| 1191 | Returns the symbol, a string, or nil if none found." | ||
| 1192 | (save-excursion | ||
| 1193 | ;; Skip backward over a word first. | ||
| 1194 | (skip-chars-backward "-[:alnum:] \t") | ||
| 1195 | ;; Now skip ":" or "@" to see if it's a pseudo-element or at-id. | ||
| 1196 | (skip-chars-backward "@:") | ||
| 1197 | (if (looking-at css--mdn-symbol-regexp) | ||
| 1198 | (match-string-no-properties 0) | ||
| 1199 | (let ((bound (save-excursion | ||
| 1200 | (beginning-of-line) | ||
| 1201 | (point)))) | ||
| 1202 | (when (re-search-backward css--mdn-property-regexp bound t) | ||
| 1203 | (match-string-no-properties 1)))))) | ||
| 1204 | |||
| 1205 | ;;;###autoload | ||
| 1206 | (defun css-lookup-symbol (symbol) | ||
| 1207 | "Display the CSS documentation for SYMBOL, as found on MDN. | ||
| 1208 | When this command is used interactively, it picks a default | ||
| 1209 | symbol based on the CSS text before point -- either an @-keyword, | ||
| 1210 | a property name, a pseudo-class, or a pseudo-element, depending | ||
| 1211 | on what is seen near point." | ||
| 1212 | (interactive | ||
| 1213 | (list | ||
| 1214 | (let* ((sym (css--mdn-find-symbol)) | ||
| 1215 | (enable-recursive-minibuffers t) | ||
| 1216 | (value (completing-read | ||
| 1217 | (if sym | ||
| 1218 | (format "Describe CSS symbol (default %s): " sym) | ||
| 1219 | "Describe CSS symbol: ") | ||
| 1220 | css--mdn-completion-list nil nil nil | ||
| 1221 | 'css--mdn-lookup-history sym))) | ||
| 1222 | (if (equal value "") sym value)))) | ||
| 1223 | (when symbol | ||
| 1224 | ;; If we see a single-colon pseudo-element like ":after", turn it | ||
| 1225 | ;; into "::after". | ||
| 1226 | (when (and (eq (aref symbol 0) ?:) | ||
| 1227 | (member (substring symbol 1) css-pseudo-element-ids)) | ||
| 1228 | (setq symbol (concat ":" symbol))) | ||
| 1229 | (let ((url (format css-lookup-url-format symbol)) | ||
| 1230 | (buffer (get-buffer-create "*MDN CSS*"))) | ||
| 1231 | (save-selected-window | ||
| 1232 | ;; Make sure to display the buffer before calling `eww', as | ||
| 1233 | ;; that calls `pop-to-buffer-same-window'. | ||
| 1234 | (switch-to-buffer-other-window buffer) | ||
| 1235 | (with-current-buffer buffer | ||
| 1236 | (eww-mode) | ||
| 1237 | (add-hook 'eww-after-render-hook #'css--mdn-after-render nil t) | ||
| 1238 | (eww url)))))) | ||
| 1239 | |||
| 1090 | (provide 'css-mode) | 1240 | (provide 'css-mode) |
| 1091 | ;;; css-mode.el ends here | 1241 | ;;; css-mode.el ends here |
diff --git a/lisp/textmodes/reftex-vars.el b/lisp/textmodes/reftex-vars.el index 63abd048e9d..03da584e96f 100644 --- a/lisp/textmodes/reftex-vars.el +++ b/lisp/textmodes/reftex-vars.el | |||
| @@ -164,6 +164,8 @@ distribution. Mixed-case symbols are convenience aliases.") | |||
| 164 | (?U . "\\autocite*[][]{%l}") | 164 | (?U . "\\autocite*[][]{%l}") |
| 165 | (?a . "\\citeauthor{%l}") | 165 | (?a . "\\citeauthor{%l}") |
| 166 | (?A . "\\citeauthor*{%l}") | 166 | (?A . "\\citeauthor*{%l}") |
| 167 | (?i . "\\citetitle{%l}") | ||
| 168 | (?I . "\\citetitle*{%l}") | ||
| 167 | (?y . "\\citeyear{%l}") | 169 | (?y . "\\citeyear{%l}") |
| 168 | (?Y . "\\citeyear*{%l}") | 170 | (?Y . "\\citeyear*{%l}") |
| 169 | (?n . "\\nocite{%l}"))) | 171 | (?n . "\\nocite{%l}"))) |
diff --git a/lisp/vc/diff-mode.el b/lisp/vc/diff-mode.el index b7ad8e8ebd8..31c33e6a720 100644 --- a/lisp/vc/diff-mode.el +++ b/lisp/vc/diff-mode.el | |||
| @@ -437,6 +437,9 @@ See http://lists.gnu.org/archive/html/emacs-devel/2007-11/msg01990.html") | |||
| 437 | (defconst diff-hunk-header-re | 437 | (defconst diff-hunk-header-re |
| 438 | (concat "^\\(?:" diff-hunk-header-re-unified ".*\\|\\*\\{15\\}.*\n\\*\\*\\* .+ \\*\\*\\*\\*\\|[0-9]+\\(,[0-9]+\\)?[acd][0-9]+\\(,[0-9]+\\)?\\)$")) | 438 | (concat "^\\(?:" diff-hunk-header-re-unified ".*\\|\\*\\{15\\}.*\n\\*\\*\\* .+ \\*\\*\\*\\*\\|[0-9]+\\(,[0-9]+\\)?[acd][0-9]+\\(,[0-9]+\\)?\\)$")) |
| 439 | (defconst diff-file-header-re (concat "^\\(--- .+\n\\+\\+\\+ \\|\\*\\*\\* .+\n--- \\|[^-+!<>0-9@* \n]\\).+\n" (substring diff-hunk-header-re 1))) | 439 | (defconst diff-file-header-re (concat "^\\(--- .+\n\\+\\+\\+ \\|\\*\\*\\* .+\n--- \\|[^-+!<>0-9@* \n]\\).+\n" (substring diff-hunk-header-re 1))) |
| 440 | |||
| 441 | (defconst diff-separator-re "^--+ ?$") | ||
| 442 | |||
| 440 | (defvar diff-narrowed-to nil) | 443 | (defvar diff-narrowed-to nil) |
| 441 | 444 | ||
| 442 | (defun diff-hunk-style (&optional style) | 445 | (defun diff-hunk-style (&optional style) |
| @@ -501,7 +504,8 @@ See http://lists.gnu.org/archive/html/emacs-devel/2007-11/msg01990.html") | |||
| 501 | ;; "index ", "old mode", "new mode", "new file mode" and | 504 | ;; "index ", "old mode", "new mode", "new file mode" and |
| 502 | ;; "deleted file mode" are output by git-diff. | 505 | ;; "deleted file mode" are output by git-diff. |
| 503 | (defconst diff-file-junk-re | 506 | (defconst diff-file-junk-re |
| 504 | "diff \\|index \\|\\(?:deleted file\\|new\\(?: file\\)?\\|old\\) mode\\|=== modified file") | 507 | (concat "Index: \\|=\\{20,\\}\\|" ; SVN |
| 508 | "diff \\|index \\|\\(?:deleted file\\|new\\(?: file\\)?\\|old\\) mode\\|=== modified file")) | ||
| 505 | 509 | ||
| 506 | ;; If point is in a diff header, then return beginning | 510 | ;; If point is in a diff header, then return beginning |
| 507 | ;; of hunk position otherwise return nil. | 511 | ;; of hunk position otherwise return nil. |
| @@ -545,7 +549,8 @@ next hunk if TRY-HARDER is non-nil; otherwise signal an error." | |||
| 545 | (error "Can't find the beginning of the hunk"))) | 549 | (error "Can't find the beginning of the hunk"))) |
| 546 | ((re-search-backward regexp nil t)) ; In the middle of a hunk. | 550 | ((re-search-backward regexp nil t)) ; In the middle of a hunk. |
| 547 | ((re-search-forward regexp nil t) ; At first hunk header. | 551 | ((re-search-forward regexp nil t) ; At first hunk header. |
| 548 | (forward-line 0)) | 552 | (forward-line 0) |
| 553 | (point)) | ||
| 549 | (t (error "Can't find the beginning of the hunk")))))) | 554 | (t (error "Can't find the beginning of the hunk")))))) |
| 550 | 555 | ||
| 551 | (defun diff-unified-hunk-p () | 556 | (defun diff-unified-hunk-p () |
| @@ -645,28 +650,36 @@ If the prefix ARG is given, restrict the view to the current file instead." | |||
| 645 | (if arg (diff-bounds-of-file) (diff-bounds-of-hunk))) | 650 | (if arg (diff-bounds-of-file) (diff-bounds-of-hunk))) |
| 646 | (set (make-local-variable 'diff-narrowed-to) (if arg 'file 'hunk))) | 651 | (set (make-local-variable 'diff-narrowed-to) (if arg 'file 'hunk))) |
| 647 | 652 | ||
| 653 | (defun diff--some-hunks-p () | ||
| 654 | (save-excursion | ||
| 655 | (goto-char (point-min)) | ||
| 656 | (re-search-forward diff-hunk-header-re nil t))) | ||
| 657 | |||
| 648 | (defun diff-hunk-kill () | 658 | (defun diff-hunk-kill () |
| 649 | "Kill the hunk at point." | 659 | "Kill the hunk at point." |
| 650 | (interactive) | 660 | (interactive) |
| 651 | (let* ((hunk-bounds (diff-bounds-of-hunk)) | 661 | (if (not (diff--some-hunks-p)) |
| 652 | (file-bounds (ignore-errors (diff-bounds-of-file))) | 662 | (error "No hunks") |
| 653 | ;; If the current hunk is the only one for its file, kill the | 663 | (diff-beginning-of-hunk t) |
| 654 | ;; file header too. | 664 | (let* ((hunk-bounds (diff-bounds-of-hunk)) |
| 655 | (bounds (if (and file-bounds | 665 | (file-bounds (ignore-errors (diff-bounds-of-file))) |
| 656 | (progn (goto-char (car file-bounds)) | 666 | ;; If the current hunk is the only one for its file, kill the |
| 657 | (= (progn (diff-hunk-next) (point)) | 667 | ;; file header too. |
| 658 | (car hunk-bounds))) | 668 | (bounds (if (and file-bounds |
| 659 | (progn (goto-char (cadr hunk-bounds)) | 669 | (progn (goto-char (car file-bounds)) |
| 660 | ;; bzr puts a newline after the last hunk. | 670 | (= (progn (diff-hunk-next) (point)) |
| 661 | (while (looking-at "^\n") | 671 | (car hunk-bounds))) |
| 662 | (forward-char 1)) | 672 | (progn (goto-char (cadr hunk-bounds)) |
| 663 | (= (point) (cadr file-bounds)))) | 673 | ;; bzr puts a newline after the last hunk. |
| 664 | file-bounds | 674 | (while (looking-at "^\n") |
| 665 | hunk-bounds)) | 675 | (forward-char 1)) |
| 666 | (inhibit-read-only t)) | 676 | (= (point) (cadr file-bounds)))) |
| 667 | (apply 'kill-region bounds) | 677 | file-bounds |
| 668 | (goto-char (car bounds)) | 678 | hunk-bounds)) |
| 669 | (diff-beginning-of-hunk t))) | 679 | (inhibit-read-only t)) |
| 680 | (apply 'kill-region bounds) | ||
| 681 | (goto-char (car bounds)) | ||
| 682 | (ignore-errors (diff-beginning-of-hunk t))))) | ||
| 670 | 683 | ||
| 671 | (defun diff-beginning-of-file-and-junk () | 684 | (defun diff-beginning-of-file-and-junk () |
| 672 | "Go to the beginning of file-related diff-info. | 685 | "Go to the beginning of file-related diff-info. |
| @@ -718,9 +731,12 @@ data such as \"Index: ...\" and such." | |||
| 718 | (defun diff-file-kill () | 731 | (defun diff-file-kill () |
| 719 | "Kill current file's hunks." | 732 | "Kill current file's hunks." |
| 720 | (interactive) | 733 | (interactive) |
| 721 | (let ((inhibit-read-only t)) | 734 | (if (not (diff--some-hunks-p)) |
| 722 | (apply 'kill-region (diff-bounds-of-file))) | 735 | (error "No hunks") |
| 723 | (diff-beginning-of-hunk t)) | 736 | (diff-beginning-of-hunk t) |
| 737 | (let ((inhibit-read-only t)) | ||
| 738 | (apply 'kill-region (diff-bounds-of-file))) | ||
| 739 | (ignore-errors (diff-beginning-of-hunk t)))) | ||
| 724 | 740 | ||
| 725 | (defun diff-kill-junk () | 741 | (defun diff-kill-junk () |
| 726 | "Kill spurious empty diffs." | 742 | "Kill spurious empty diffs." |
| @@ -1535,15 +1551,20 @@ Only works for unified diffs." | |||
| 1535 | (pcase (char-after) | 1551 | (pcase (char-after) |
| 1536 | (?\s (cl-decf before) (cl-decf after) t) | 1552 | (?\s (cl-decf before) (cl-decf after) t) |
| 1537 | (?- | 1553 | (?- |
| 1538 | (if (and (looking-at diff-file-header-re) | 1554 | (cond |
| 1539 | (zerop before) (zerop after)) | 1555 | ((and (looking-at diff-separator-re) |
| 1540 | ;; No need to query: this is a case where two patches | 1556 | (zerop before) (zerop after)) |
| 1541 | ;; are concatenated and only counting the lines will | 1557 | nil) |
| 1542 | ;; give the right result. Let's just add an empty | 1558 | ((and (looking-at diff-file-header-re) |
| 1543 | ;; line so that our code which doesn't count lines | 1559 | (zerop before) (zerop after)) |
| 1544 | ;; will not get confused. | 1560 | ;; No need to query: this is a case where two patches |
| 1545 | (progn (save-excursion (insert "\n")) nil) | 1561 | ;; are concatenated and only counting the lines will |
| 1546 | (cl-decf before) t)) | 1562 | ;; give the right result. Let's just add an empty |
| 1563 | ;; line so that our code which doesn't count lines | ||
| 1564 | ;; will not get confused. | ||
| 1565 | (save-excursion (insert "\n")) nil) | ||
| 1566 | (t | ||
| 1567 | (cl-decf before) t))) | ||
| 1547 | (?+ (cl-decf after) t) | 1568 | (?+ (cl-decf after) t) |
| 1548 | (_ | 1569 | (_ |
| 1549 | (cond | 1570 | (cond |
| @@ -1998,57 +2019,58 @@ Return new point, if it was moved." | |||
| 1998 | "Highlight changes of hunk at point at a finer granularity." | 2019 | "Highlight changes of hunk at point at a finer granularity." |
| 1999 | (interactive) | 2020 | (interactive) |
| 2000 | (require 'smerge-mode) | 2021 | (require 'smerge-mode) |
| 2001 | (save-excursion | 2022 | (when (diff--some-hunks-p) |
| 2002 | (diff-beginning-of-hunk t) | 2023 | (save-excursion |
| 2003 | (let* ((start (point)) | 2024 | (diff-beginning-of-hunk t) |
| 2004 | (style (diff-hunk-style)) ;Skips the hunk header as well. | 2025 | (let* ((start (point)) |
| 2005 | (beg (point)) | 2026 | (style (diff-hunk-style)) ;Skips the hunk header as well. |
| 2006 | (props-c '((diff-mode . fine) (face diff-refine-changed))) | 2027 | (beg (point)) |
| 2007 | (props-r '((diff-mode . fine) (face diff-refine-removed))) | 2028 | (props-c '((diff-mode . fine) (face diff-refine-changed))) |
| 2008 | (props-a '((diff-mode . fine) (face diff-refine-added))) | 2029 | (props-r '((diff-mode . fine) (face diff-refine-removed))) |
| 2009 | ;; Be careful to go back to `start' so diff-end-of-hunk gets | 2030 | (props-a '((diff-mode . fine) (face diff-refine-added))) |
| 2010 | ;; to read the hunk header's line info. | 2031 | ;; Be careful to go back to `start' so diff-end-of-hunk gets |
| 2011 | (end (progn (goto-char start) (diff-end-of-hunk) (point)))) | 2032 | ;; to read the hunk header's line info. |
| 2012 | 2033 | (end (progn (goto-char start) (diff-end-of-hunk) (point)))) | |
| 2013 | (remove-overlays beg end 'diff-mode 'fine) | 2034 | |
| 2014 | 2035 | (remove-overlays beg end 'diff-mode 'fine) | |
| 2015 | (goto-char beg) | 2036 | |
| 2016 | (pcase style | 2037 | (goto-char beg) |
| 2017 | (`unified | 2038 | (pcase style |
| 2018 | (while (re-search-forward "^-" end t) | 2039 | (`unified |
| 2019 | (let ((beg-del (progn (beginning-of-line) (point))) | 2040 | (while (re-search-forward "^-" end t) |
| 2020 | beg-add end-add) | 2041 | (let ((beg-del (progn (beginning-of-line) (point))) |
| 2021 | (when (and (diff--forward-while-leading-char ?- end) | 2042 | beg-add end-add) |
| 2022 | ;; Allow for "\ No newline at end of file". | 2043 | (when (and (diff--forward-while-leading-char ?- end) |
| 2023 | (progn (diff--forward-while-leading-char ?\\ end) | 2044 | ;; Allow for "\ No newline at end of file". |
| 2024 | (setq beg-add (point))) | 2045 | (progn (diff--forward-while-leading-char ?\\ end) |
| 2025 | (diff--forward-while-leading-char ?+ end) | 2046 | (setq beg-add (point))) |
| 2026 | (progn (diff--forward-while-leading-char ?\\ end) | 2047 | (diff--forward-while-leading-char ?+ end) |
| 2027 | (setq end-add (point)))) | 2048 | (progn (diff--forward-while-leading-char ?\\ end) |
| 2028 | (smerge-refine-subst beg-del beg-add beg-add end-add | 2049 | (setq end-add (point)))) |
| 2029 | nil 'diff-refine-preproc props-r props-a))))) | 2050 | (smerge-refine-subst beg-del beg-add beg-add end-add |
| 2030 | (`context | 2051 | nil 'diff-refine-preproc props-r props-a))))) |
| 2031 | (let* ((middle (save-excursion (re-search-forward "^---"))) | 2052 | (`context |
| 2032 | (other middle)) | 2053 | (let* ((middle (save-excursion (re-search-forward "^---"))) |
| 2033 | (while (re-search-forward "^\\(?:!.*\n\\)+" middle t) | 2054 | (other middle)) |
| 2034 | (smerge-refine-subst (match-beginning 0) (match-end 0) | 2055 | (while (re-search-forward "^\\(?:!.*\n\\)+" middle t) |
| 2035 | (save-excursion | 2056 | (smerge-refine-subst (match-beginning 0) (match-end 0) |
| 2036 | (goto-char other) | 2057 | (save-excursion |
| 2037 | (re-search-forward "^\\(?:!.*\n\\)+" end) | 2058 | (goto-char other) |
| 2038 | (setq other (match-end 0)) | 2059 | (re-search-forward "^\\(?:!.*\n\\)+" end) |
| 2039 | (match-beginning 0)) | 2060 | (setq other (match-end 0)) |
| 2040 | other | 2061 | (match-beginning 0)) |
| 2041 | (if diff-use-changed-face props-c) | 2062 | other |
| 2042 | 'diff-refine-preproc | 2063 | (if diff-use-changed-face props-c) |
| 2043 | (unless diff-use-changed-face props-r) | 2064 | 'diff-refine-preproc |
| 2044 | (unless diff-use-changed-face props-a))))) | 2065 | (unless diff-use-changed-face props-r) |
| 2045 | (_ ;; Normal diffs. | 2066 | (unless diff-use-changed-face props-a))))) |
| 2046 | (let ((beg1 (1+ (point)))) | 2067 | (_ ;; Normal diffs. |
| 2047 | (when (re-search-forward "^---.*\n" end t) | 2068 | (let ((beg1 (1+ (point)))) |
| 2048 | ;; It's a combined add&remove, so there's something to do. | 2069 | (when (re-search-forward "^---.*\n" end t) |
| 2049 | (smerge-refine-subst beg1 (match-beginning 0) | 2070 | ;; It's a combined add&remove, so there's something to do. |
| 2050 | (match-end 0) end | 2071 | (smerge-refine-subst beg1 (match-beginning 0) |
| 2051 | nil 'diff-refine-preproc props-r props-a)))))))) | 2072 | (match-end 0) end |
| 2073 | nil 'diff-refine-preproc props-r props-a))))))))) | ||
| 2052 | 2074 | ||
| 2053 | (defun diff-undo (&optional arg) | 2075 | (defun diff-undo (&optional arg) |
| 2054 | "Perform `undo', ignoring the buffer's read-only status." | 2076 | "Perform `undo', ignoring the buffer's read-only status." |
diff --git a/lisp/vc/ediff-init.el b/lisp/vc/ediff-init.el index 95568b29c7c..0235926fbe4 100644 --- a/lisp/vc/ediff-init.el +++ b/lisp/vc/ediff-init.el | |||
| @@ -150,6 +150,26 @@ It needs to be killed when we quit the session.") | |||
| 150 | (defsubst ediff-get-symbol-from-alist (buf-type alist) | 150 | (defsubst ediff-get-symbol-from-alist (buf-type alist) |
| 151 | (cdr (assoc buf-type alist))) | 151 | (cdr (assoc buf-type alist))) |
| 152 | 152 | ||
| 153 | ;; Vector of differences between the variants. Each difference is | ||
| 154 | ;; represented by a vector of two overlays plus a vector of fine diffs, | ||
| 155 | ;; plus a no-fine-diffs flag. The first overlay spans the | ||
| 156 | ;; difference region in the A buffer and the second overlays the diff in | ||
| 157 | ;; the B buffer. If a difference section is empty, the corresponding | ||
| 158 | ;; overlay's endpoints coincide. | ||
| 159 | ;; | ||
| 160 | ;; The precise form of a Difference Vector for one buffer is: | ||
| 161 | ;; [diff diff diff ...] | ||
| 162 | ;; where each diff has the form: | ||
| 163 | ;; [diff-overlay fine-diff-vector no-fine-diffs-flag state-of-diff] | ||
| 164 | ;; fine-diff-vector is a vector [fine-diff-overlay fine-diff-overlay ...] | ||
| 165 | ;; no-fine-diffs-flag says if there are fine differences. | ||
| 166 | ;; state-of-difference is A, B, C, or nil, indicating which buffer is | ||
| 167 | ;; different from the other two (used only in 3-way jobs. | ||
| 168 | (ediff-defvar-local ediff-difference-vector-A nil "") | ||
| 169 | (ediff-defvar-local ediff-difference-vector-B nil "") | ||
| 170 | (ediff-defvar-local ediff-difference-vector-C nil "") | ||
| 171 | (ediff-defvar-local ediff-difference-vector-Ancestor nil "") | ||
| 172 | ;; A-list of diff vector types associated with buffer types | ||
| 153 | (defconst ediff-difference-vector-alist | 173 | (defconst ediff-difference-vector-alist |
| 154 | '((A . ediff-difference-vector-A) | 174 | '((A . ediff-difference-vector-A) |
| 155 | (B . ediff-difference-vector-B) | 175 | (B . ediff-difference-vector-B) |
| @@ -642,32 +662,6 @@ shown in brighter colors." | |||
| 642 | ;;buffer-read-only | 662 | ;;buffer-read-only |
| 643 | mode-line-format)) | 663 | mode-line-format)) |
| 644 | 664 | ||
| 645 | ;; Vector of differences between the variants. Each difference is | ||
| 646 | ;; represented by a vector of two overlays plus a vector of fine diffs, | ||
| 647 | ;; plus a no-fine-diffs flag. The first overlay spans the | ||
| 648 | ;; difference region in the A buffer and the second overlays the diff in | ||
| 649 | ;; the B buffer. If a difference section is empty, the corresponding | ||
| 650 | ;; overlay's endpoints coincide. | ||
| 651 | ;; | ||
| 652 | ;; The precise form of a Difference Vector for one buffer is: | ||
| 653 | ;; [diff diff diff ...] | ||
| 654 | ;; where each diff has the form: | ||
| 655 | ;; [diff-overlay fine-diff-vector no-fine-diffs-flag state-of-diff] | ||
| 656 | ;; fine-diff-vector is a vector [fine-diff-overlay fine-diff-overlay ...] | ||
| 657 | ;; no-fine-diffs-flag says if there are fine differences. | ||
| 658 | ;; state-of-difference is A, B, C, or nil, indicating which buffer is | ||
| 659 | ;; different from the other two (used only in 3-way jobs. | ||
| 660 | (ediff-defvar-local ediff-difference-vector-A nil "") | ||
| 661 | (ediff-defvar-local ediff-difference-vector-B nil "") | ||
| 662 | (ediff-defvar-local ediff-difference-vector-C nil "") | ||
| 663 | (ediff-defvar-local ediff-difference-vector-Ancestor nil "") | ||
| 664 | ;; A-list of diff vector types associated with buffer types | ||
| 665 | (defconst ediff-difference-vector-alist | ||
| 666 | '((A . ediff-difference-vector-A) | ||
| 667 | (B . ediff-difference-vector-B) | ||
| 668 | (C . ediff-difference-vector-C) | ||
| 669 | (Ancestor . ediff-difference-vector-Ancestor))) | ||
| 670 | |||
| 671 | ;; [ status status status ...] | 665 | ;; [ status status status ...] |
| 672 | ;; Each status: [state-of-merge state-of-ancestor] | 666 | ;; Each status: [state-of-merge state-of-ancestor] |
| 673 | ;; state-of-merge is default-A, default-B, prefer-A, or prefer-B. It | 667 | ;; state-of-merge is default-A, default-B, prefer-A, or prefer-B. It |
diff --git a/lisp/xml.el b/lisp/xml.el index cd801be3083..be2ac96f264 100644 --- a/lisp/xml.el +++ b/lisp/xml.el | |||
| @@ -646,8 +646,10 @@ surpassed `xml-entity-expansion-limit'")))) | |||
| 646 | (defun xml-parse-attlist (&optional xml-ns) | 646 | (defun xml-parse-attlist (&optional xml-ns) |
| 647 | "Return the attribute-list after point. | 647 | "Return the attribute-list after point. |
| 648 | Leave point at the first non-blank character after the tag." | 648 | Leave point at the first non-blank character after the tag." |
| 649 | (let ((attlist ()) | 649 | (let* ((attlist ()) |
| 650 | end-pos name) | 650 | (symbol-qnames (eq (car-safe xml-ns) 'symbol-qnames)) |
| 651 | (xml-ns (if symbol-qnames (cdr xml-ns) xml-ns)) | ||
| 652 | end-pos name) | ||
| 651 | (skip-syntax-forward " ") | 653 | (skip-syntax-forward " ") |
| 652 | (while (looking-at (eval-when-compile | 654 | (while (looking-at (eval-when-compile |
| 653 | (concat "\\(" xml-name-re "\\)\\s-*=\\s-*"))) | 655 | (concat "\\(" xml-name-re "\\)\\s-*=\\s-*"))) |