diff options
| author | Paul Eggert | 2017-11-08 19:22:26 -0800 |
|---|---|---|
| committer | Paul Eggert | 2017-11-08 19:22:26 -0800 |
| commit | 6ee827059463e4b95c9251ef22a21f9c67cf668d (patch) | |
| tree | 0612e1b84922cc43eeed5ea219104d4c5985cbdf /lisp | |
| parent | 83dc3f0e9b518e45bcfb0aaebcc706f79622f157 (diff) | |
| parent | 255ba01148f69f452937e67feb7af5d4c1466fed (diff) | |
| download | emacs-6ee827059463e4b95c9251ef22a21f9c67cf668d.tar.gz emacs-6ee827059463e4b95c9251ef22a21f9c67cf668d.zip | |
Merge from origin/emacs-26
255ba01148 Fix handling of nil PRED2 arg for completion-table-with-pr...
949b70a7d8 ; Minor comment copyedit in window.c
20f9bf30f0 Describe Lao rendering problem
3d61657694 Fix docstring of arabic-shaper-ZWNJ-handling
db949166ec Handle single-line comments correctly (Bug#26049)
795bb233a5 * test/lisp/net/tramp-tests.el (tramp-test16-file-expand-w...
ba00ea7d0d * etc/PROBLEMS: Add URL to relevant issues for xterm+evil bug
4a6015811e ; In text.texi fix typo spotted by Štěpán Němec
93cd8415b2 Document new treatment of 'comment-auto-fill-only-comments'
ca2d94ba61 Do not load Tramp unless `tramp-mode' is non-nil
709478eaa8 Prefer `customize-set-variable' in tramp.texi
5d36f2227f Fix last change in hscroll_window_tree
72d07d1950 Ediff: add some missing documentation
18af404ef3 Support python virtualenv on w32 (Bug#24464)
efd0371c23 Improve dired deletion error handling (Bug#28797)
5d744e032f Don't replace user input when completion prefix is empty (...
ec6cf35c5f ; Describe xt-mouse problems with Evil mode
c572e1f329 Return non-nil from gnutls-available-p under GnuTLS 2.x
a2cc6d74c5 Fix Flymake help-echo functions across windows (bug#29142)
58bb3462ee Add tests for Flymake backends for Ruby and Perl
58e742b21d Add a Flymake backend for Perl
9dee764165 Add a Flymake backend for Ruby
3ad712ebc9 Add a Flymake backend for Python (bug#28808)
8db2b3a79b Allow "%" in Tramp host names
8c50842790 ; Fix typo in test/file-organization.org
00fa4449cd ; Fix typo
918a2dda07 Use hybrid malloc for FreeBSD (Bug#28308)
725ab635d9 Add html-, mhtml- and python-mode support to semantic symref
369da28702 Improve documentation of 'window-scroll-functions'
93818eed8a Fix subtle problems in tabulated-list-mode with line numbers
1f1de8e872 Make gdb-non-stop-setting default to nil on MS-Windows
680e8e119b Fix gdb-mi prompt after "attach PID" command
ff33074546 Fix doc string of 'window-configuration-change-hook'
787b75ad71 Improve documentation of window hooks
d9be8704ae Fix hscroll suspension after cursor motion
6f43d29d29 ; * CONTRIBUTE, admin/make-tarball.txt: Doc tweaks re 'ema...
a0d30d6369 Introduce a function to CC Mode which displays the current...
383abc8898 ; Fix some comment typos
b02c2714c3 Fix typos in ediff-wind.el
4f38bdec74 Examine tex-chktex--process in the correct buffer
94b490529a * nt/INSTALL.W64: Update to current mingw64 install instru...
c25113d4ac Don't resignal errors in flymake-diag-region
e950f329c0 New xref-quit-and-goto-xref command bound to TAB (bug#28814)
5d34e1b288 Allow split-window-sensibly to split threshold in further ...
2a973edeac Honor window-switching intents in xref-find-definitions (b...
78e9065e9f * lisp/emacs-lisp/generator.el (iter-do): Add a debug decl...
caa63cc96c * lisp/progmodes/flymake.el (flymake-start): Fix dead buff...
9f4f130b79 Fix buffer name comparison in async shell-command
# Conflicts:
# etc/NEWS
# lisp/vc/ediff-wind.el
Diffstat (limited to 'lisp')
28 files changed, 594 insertions, 143 deletions
diff --git a/lisp/calc/calcalg2.el b/lisp/calc/calcalg2.el index 53e02572064..48446c3c4c5 100644 --- a/lisp/calc/calcalg2.el +++ b/lisp/calc/calcalg2.el | |||
| @@ -2354,7 +2354,7 @@ | |||
| 2354 | 2354 | ||
| 2355 | ;; The variables math-solve-lhs, math-solve-rhs and math-try-solve-sign | 2355 | ;; The variables math-solve-lhs, math-solve-rhs and math-try-solve-sign |
| 2356 | ;; are local to math-try-solve-for, but are used by math-try-solve-prod. | 2356 | ;; are local to math-try-solve-for, but are used by math-try-solve-prod. |
| 2357 | ;; (math-solve-lhs and math-solve-rhs are is also local to | 2357 | ;; (math-solve-lhs and math-solve-rhs are also local to |
| 2358 | ;; math-decompose-poly, but used by math-solve-poly-funny-powers.) | 2358 | ;; math-decompose-poly, but used by math-solve-poly-funny-powers.) |
| 2359 | (defvar math-solve-lhs) | 2359 | (defvar math-solve-lhs) |
| 2360 | (defvar math-solve-rhs) | 2360 | (defvar math-solve-rhs) |
diff --git a/lisp/cedet/semantic/symref/grep.el b/lisp/cedet/semantic/symref/grep.el index bc19cd30c45..0b263d8cc2d 100644 --- a/lisp/cedet/semantic/symref/grep.el +++ b/lisp/cedet/semantic/symref/grep.el | |||
| @@ -38,16 +38,22 @@ | |||
| 38 | ( | 38 | ( |
| 39 | ) | 39 | ) |
| 40 | "A symref tool implementation using grep. | 40 | "A symref tool implementation using grep. |
| 41 | This tool uses EDE to find he root of the project, then executes | 41 | This tool uses EDE to find the root of the project, then executes |
| 42 | find-grep in the project. The output is parsed for hits | 42 | find-grep in the project. The output is parsed for hits and |
| 43 | and those hits returned.") | 43 | those hits returned.") |
| 44 | 44 | ||
| 45 | (defvar semantic-symref-filepattern-alist | 45 | (defvar semantic-symref-filepattern-alist |
| 46 | '((c-mode "*.[ch]") | 46 | '((c-mode "*.[ch]") |
| 47 | (c++-mode "*.[chCH]" "*.[ch]pp" "*.cc" "*.hh") | 47 | (c++-mode "*.[chCH]" "*.[ch]pp" "*.cc" "*.hh") |
| 48 | (html-mode "*.s?html" "*.php") | 48 | (html-mode "*.html" "*.shtml" "*.php") |
| 49 | (mhtml-mode "*.html" "*.shtml" "*.php") ; FIXME: remove | ||
| 50 | ; duplication of | ||
| 51 | ; HTML-related patterns. | ||
| 52 | ; Maybe they belong in the | ||
| 53 | ; major mode definition? | ||
| 49 | (ruby-mode "*.r[bu]" "*.rake" "*.gemspec" "*.erb" "*.haml" | 54 | (ruby-mode "*.r[bu]" "*.rake" "*.gemspec" "*.erb" "*.haml" |
| 50 | "Rakefile" "Thorfile" "Capfile" "Guardfile" "Vagrantfile") | 55 | "Rakefile" "Thorfile" "Capfile" "Guardfile" "Vagrantfile") |
| 56 | (python-mode "*.py" "*.pyi" "*.pyw") | ||
| 51 | (perl-mode "*.pl" "*.PL") | 57 | (perl-mode "*.pl" "*.PL") |
| 52 | (cperl-mode "*.pl" "*.PL") | 58 | (cperl-mode "*.pl" "*.PL") |
| 53 | (lisp-interaction-mode "*.el" "*.ede" ".emacs" "_emacs") | 59 | (lisp-interaction-mode "*.el" "*.ede" ".emacs" "_emacs") |
| @@ -58,7 +64,7 @@ See find -name man page for format.") | |||
| 58 | (defun semantic-symref-derive-find-filepatterns (&optional mode) | 64 | (defun semantic-symref-derive-find-filepatterns (&optional mode) |
| 59 | ;; FIXME: This should be moved to grep.el, where it could be used | 65 | ;; FIXME: This should be moved to grep.el, where it could be used |
| 60 | ;; for "C-u M-x grep" as well. | 66 | ;; for "C-u M-x grep" as well. |
| 61 | "Derive a list of file patterns for the current buffer. | 67 | "Derive a list of file (glob) patterns for the current buffer. |
| 62 | Looks first in `semantic-symref-filepattern-alist'. If it is not | 68 | Looks first in `semantic-symref-filepattern-alist'. If it is not |
| 63 | there, it then looks in `auto-mode-alist', and attempts to derive something | 69 | there, it then looks in `auto-mode-alist', and attempts to derive something |
| 64 | from that. | 70 | from that. |
| @@ -78,7 +84,7 @@ Optional argument MODE specifies the `major-mode' to test." | |||
| 78 | (error "Customize `semantic-symref-filepattern-alist' for %S" | 84 | (error "Customize `semantic-symref-filepattern-alist' for %S" |
| 79 | major-mode) | 85 | major-mode) |
| 80 | (let ((args `("-name" ,(car pat)))) | 86 | (let ((args `("-name" ,(car pat)))) |
| 81 | (if (null (cdr args)) | 87 | (if (null (cdr pat)) |
| 82 | args | 88 | args |
| 83 | `("(" ,@args | 89 | `("(" ,@args |
| 84 | ,@(mapcan (lambda (s) `("-o" "-name" ,s)) pat) | 90 | ,@(mapcan (lambda (s) `("-o" "-name" ,s)) pat) |
| @@ -149,7 +155,7 @@ This shell should support pipe redirect syntax." | |||
| 149 | (oref tool searchfor)) | 155 | (oref tool searchfor)) |
| 150 | (t | 156 | (t |
| 151 | ;; Can't use the word boundaries: Grep | 157 | ;; Can't use the word boundaries: Grep |
| 152 | ;; doesn't always agrees with the language | 158 | ;; doesn't always agree with the language |
| 153 | ;; syntax on those. | 159 | ;; syntax on those. |
| 154 | (format "\\(^\\|\\W\\)%s\\(\\W\\|$\\)" | 160 | (format "\\(^\\|\\W\\)%s\\(\\W\\|$\\)" |
| 155 | (oref tool searchfor))))) | 161 | (oref tool searchfor))))) |
diff --git a/lisp/dired.el b/lisp/dired.el index 46918180f12..0abb521cc5b 100644 --- a/lisp/dired.el +++ b/lisp/dired.el | |||
| @@ -3146,7 +3146,7 @@ non-empty directories is allowed." | |||
| 3146 | #'dired-delete-entry fn)) | 3146 | #'dired-delete-entry fn)) |
| 3147 | (quit (throw '--delete-cancel (message "OK, canceled"))) | 3147 | (quit (throw '--delete-cancel (message "OK, canceled"))) |
| 3148 | (error ;; catch errors from failed deletions | 3148 | (error ;; catch errors from failed deletions |
| 3149 | (dired-log "%s\n" err) | 3149 | (dired-log "%s: %s\n" (car err) (error-message-string err)) |
| 3150 | (setq failures (cons (car (car l)) failures))))) | 3150 | (setq failures (cons (car (car l)) failures))))) |
| 3151 | (setq l (cdr l))) | 3151 | (setq l (cdr l))) |
| 3152 | (if (not failures) | 3152 | (if (not failures) |
diff --git a/lisp/emacs-lisp/generator.el b/lisp/emacs-lisp/generator.el index 410e4edcc92..ef6cfba420c 100644 --- a/lisp/emacs-lisp/generator.el +++ b/lisp/emacs-lisp/generator.el | |||
| @@ -718,7 +718,8 @@ is blocked." | |||
| 718 | "Loop over values from an iterator. | 718 | "Loop over values from an iterator. |
| 719 | Evaluate BODY with VAR bound to each value from ITERATOR. | 719 | Evaluate BODY with VAR bound to each value from ITERATOR. |
| 720 | Return the value with which ITERATOR finished iteration." | 720 | Return the value with which ITERATOR finished iteration." |
| 721 | (declare (indent 1)) | 721 | (declare (indent 1) |
| 722 | (debug ((symbolp form) body))) | ||
| 722 | (let ((done-symbol (cps--gensym "iter-do-iterator-done")) | 723 | (let ((done-symbol (cps--gensym "iter-do-iterator-done")) |
| 723 | (condition-symbol (cps--gensym "iter-do-condition")) | 724 | (condition-symbol (cps--gensym "iter-do-condition")) |
| 724 | (it-symbol (cps--gensym "iter-do-iterator")) | 725 | (it-symbol (cps--gensym "iter-do-iterator")) |
diff --git a/lisp/emacs-lisp/tabulated-list.el b/lisp/emacs-lisp/tabulated-list.el index 73ddadfb805..3889ba8e587 100644 --- a/lisp/emacs-lisp/tabulated-list.el +++ b/lisp/emacs-lisp/tabulated-list.el | |||
| @@ -603,7 +603,16 @@ With a numeric prefix argument N, sort the Nth column." | |||
| 603 | (let ((lnum-width (tabulated-list-line-number-width))) | 603 | (let ((lnum-width (tabulated-list-line-number-width))) |
| 604 | (when (not (= tabulated-list--current-lnum-width lnum-width)) | 604 | (when (not (= tabulated-list--current-lnum-width lnum-width)) |
| 605 | (setq-local tabulated-list--current-lnum-width lnum-width) | 605 | (setq-local tabulated-list--current-lnum-width lnum-width) |
| 606 | (tabulated-list-revert))))) | 606 | (tabulated-list-init-header))))) |
| 607 | |||
| 608 | (defun tabulated-list-window-scroll-function (window _start) | ||
| 609 | (if display-line-numbers | ||
| 610 | (let ((lnum-width | ||
| 611 | (with-selected-window window | ||
| 612 | (line-number-display-width 'columns)))) | ||
| 613 | (when (not (= tabulated-list--current-lnum-width lnum-width)) | ||
| 614 | (setq-local tabulated-list--current-lnum-width lnum-width) | ||
| 615 | (tabulated-list-init-header))))) | ||
| 607 | 616 | ||
| 608 | ;;; The mode definition: | 617 | ;;; The mode definition: |
| 609 | 618 | ||
| @@ -654,7 +663,9 @@ as the ewoc pretty-printer." | |||
| 654 | ;; the line-number width needs to change due to scrolling. | 663 | ;; the line-number width needs to change due to scrolling. |
| 655 | (setq-local tabulated-list--current-lnum-width 0) | 664 | (setq-local tabulated-list--current-lnum-width 0) |
| 656 | (add-hook 'pre-redisplay-functions | 665 | (add-hook 'pre-redisplay-functions |
| 657 | #'tabulated-list-watch-line-number-width nil t)) | 666 | #'tabulated-list-watch-line-number-width nil t) |
| 667 | (add-hook 'window-scroll-functions | ||
| 668 | #'tabulated-list-window-scroll-function nil t)) | ||
| 658 | 669 | ||
| 659 | (put 'tabulated-list-mode 'mode-class 'special) | 670 | (put 'tabulated-list-mode 'mode-class 'special) |
| 660 | 671 | ||
diff --git a/lisp/language/misc-lang.el b/lisp/language/misc-lang.el index cbb581fd19f..c1aa79cae45 100644 --- a/lisp/language/misc-lang.el +++ b/lisp/language/misc-lang.el | |||
| @@ -87,9 +87,7 @@ If the value is `absorb', ZWNJ is absorbed into the previous | |||
| 87 | grapheme cluster, and not displayed. | 87 | grapheme cluster, and not displayed. |
| 88 | 88 | ||
| 89 | If the value is `as-space', the glyph is displayed by a | 89 | If the value is `as-space', the glyph is displayed by a |
| 90 | thin (i.e. 1-dot width) space. | 90 | thin (i.e. 1-dot width) space." |
| 91 | |||
| 92 | Customizing the value takes effect when you start Emacs next time." | ||
| 93 | :group 'mule | 91 | :group 'mule |
| 94 | :version "26.1" | 92 | :version "26.1" |
| 95 | :type '(choice | 93 | :type '(choice |
diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el index c3f77afae60..77fddc3436d 100644 --- a/lisp/minibuffer.el +++ b/lisp/minibuffer.el | |||
| @@ -392,7 +392,7 @@ obeys predicates." | |||
| 392 | (and (funcall pred1 x) (funcall pred2 x))))) | 392 | (and (funcall pred1 x) (funcall pred2 x))))) |
| 393 | ;; If completion failed and we're not applying pred1 strictly, try | 393 | ;; If completion failed and we're not applying pred1 strictly, try |
| 394 | ;; again without pred1. | 394 | ;; again without pred1. |
| 395 | (and (not strict) pred1 pred2 | 395 | (and (not strict) pred1 |
| 396 | (complete-with-action action table string pred2)))))) | 396 | (complete-with-action action table string pred2)))))) |
| 397 | 397 | ||
| 398 | (defun completion-table-in-turn (&rest tables) | 398 | (defun completion-table-in-turn (&rest tables) |
diff --git a/lisp/net/tramp-gvfs.el b/lisp/net/tramp-gvfs.el index 51d24cbc1b0..709ea4670a8 100644 --- a/lisp/net/tramp-gvfs.el +++ b/lisp/net/tramp-gvfs.el | |||
| @@ -1292,7 +1292,8 @@ file-notify events." | |||
| 1292 | (when (and user domain) | 1292 | (when (and user domain) |
| 1293 | (setq user (concat domain ";" user))) | 1293 | (setq user (concat domain ";" user))) |
| 1294 | (url-parse-make-urlobj | 1294 | (url-parse-make-urlobj |
| 1295 | method (and user (url-hexify-string user)) nil host | 1295 | method (and user (url-hexify-string user)) |
| 1296 | nil (and host (url-hexify-string host)) | ||
| 1296 | (if (stringp port) (string-to-number port) port) | 1297 | (if (stringp port) (string-to-number port) port) |
| 1297 | (and localname (url-hexify-string localname)) nil nil t)) | 1298 | (and localname (url-hexify-string localname)) nil nil t)) |
| 1298 | (url-parse-make-urlobj | 1299 | (url-parse-make-urlobj |
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index a23da848112..15868bd2e8f 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el | |||
| @@ -818,7 +818,7 @@ Used in `tramp-make-tramp-file-name'.") | |||
| 818 | "Regexp matching delimiter between user and host names. | 818 | "Regexp matching delimiter between user and host names. |
| 819 | Derived from `tramp-postfix-user-format'.") | 819 | Derived from `tramp-postfix-user-format'.") |
| 820 | 820 | ||
| 821 | (defconst tramp-host-regexp "[a-zA-Z0-9_.-]+" | 821 | (defconst tramp-host-regexp "[a-zA-Z0-9_.%-]+" |
| 822 | "Regexp matching host names.") | 822 | "Regexp matching host names.") |
| 823 | 823 | ||
| 824 | (defconst tramp-prefix-ipv6-format-alist | 824 | (defconst tramp-prefix-ipv6-format-alist |
| @@ -2305,8 +2305,10 @@ Falls back to normal file name handler if no Tramp file name handler exists." | |||
| 2305 | ;;;###autoload | 2305 | ;;;###autoload |
| 2306 | (progn (defun tramp-autoload-file-name-handler (operation &rest args) | 2306 | (progn (defun tramp-autoload-file-name-handler (operation &rest args) |
| 2307 | "Load Tramp file name handler, and perform OPERATION." | 2307 | "Load Tramp file name handler, and perform OPERATION." |
| 2308 | (let ((default-directory temporary-file-directory)) | 2308 | (if tramp-mode |
| 2309 | (load "tramp" 'noerror 'nomessage)) | 2309 | (let ((default-directory temporary-file-directory)) |
| 2310 | (load "tramp" 'noerror 'nomessage)) | ||
| 2311 | (tramp-unload-file-name-handlers)) | ||
| 2310 | (apply operation args))) | 2312 | (apply operation args))) |
| 2311 | 2313 | ||
| 2312 | ;; `tramp-autoload-file-name-handler' must be registered before | 2314 | ;; `tramp-autoload-file-name-handler' must be registered before |
| @@ -2422,12 +2424,13 @@ Add operations defined in `HANDLER-alist' to `tramp-file-name-handler'." | |||
| 2422 | (equal (apply operation args) operation)))) | 2424 | (equal (apply operation args) operation)))) |
| 2423 | 2425 | ||
| 2424 | ;;;###autoload | 2426 | ;;;###autoload |
| 2425 | (defun tramp-unload-file-name-handlers () | 2427 | (progn (defun tramp-unload-file-name-handlers () |
| 2426 | "Unload Tramp file name handlers from `file-name-handler-alist'." | 2428 | "Unload Tramp file name handlers from `file-name-handler-alist'." |
| 2427 | (dolist (fnh '(tramp-file-name-handler | 2429 | (dolist (fnh '(tramp-file-name-handler |
| 2428 | tramp-completion-file-name-handler)) | 2430 | tramp-completion-file-name-handler |
| 2431 | tramp-autoload-file-name-handler)) | ||
| 2429 | (let ((a1 (rassq fnh file-name-handler-alist))) | 2432 | (let ((a1 (rassq fnh file-name-handler-alist))) |
| 2430 | (setq file-name-handler-alist (delq a1 file-name-handler-alist))))) | 2433 | (setq file-name-handler-alist (delq a1 file-name-handler-alist)))))) |
| 2431 | 2434 | ||
| 2432 | (add-hook 'tramp-unload-hook 'tramp-unload-file-name-handlers) | 2435 | (add-hook 'tramp-unload-hook 'tramp-unload-file-name-handlers) |
| 2433 | 2436 | ||
| @@ -4631,9 +4634,6 @@ Only works for Bourne-like shells." | |||
| 4631 | (provide 'tramp) | 4634 | (provide 'tramp) |
| 4632 | 4635 | ||
| 4633 | ;;; TODO: | 4636 | ;;; TODO: |
| 4634 | |||
| 4635 | ;; * In Emacs 21, `insert-directory' shows total number of bytes used | ||
| 4636 | ;; by the files in that directory. Add this here. | ||
| 4637 | ;; | 4637 | ;; |
| 4638 | ;; * Avoid screen blanking when hitting `g' in dired. (Eli Tziperman) | 4638 | ;; * Avoid screen blanking when hitting `g' in dired. (Eli Tziperman) |
| 4639 | ;; | 4639 | ;; |
diff --git a/lisp/newcomment.el b/lisp/newcomment.el index 2e644c3a99c..56ae14dee41 100644 --- a/lisp/newcomment.el +++ b/lisp/newcomment.el | |||
| @@ -69,6 +69,9 @@ | |||
| 69 | 69 | ||
| 70 | ;;; Code: | 70 | ;;; Code: |
| 71 | 71 | ||
| 72 | (eval-when-compile | ||
| 73 | (require 'subr-x)) | ||
| 74 | |||
| 72 | ;;;###autoload | 75 | ;;;###autoload |
| 73 | (defalias 'indent-for-comment 'comment-indent) | 76 | (defalias 'indent-for-comment 'comment-indent) |
| 74 | ;;;###autoload | 77 | ;;;###autoload |
| @@ -1141,6 +1144,9 @@ the region rather than at left margin." | |||
| 1141 | 1144 | ||
| 1142 | ;; make the leading and trailing lines if requested | 1145 | ;; make the leading and trailing lines if requested |
| 1143 | (when lines | 1146 | (when lines |
| 1147 | ;; Trim trailing whitespace from cs if there's some. | ||
| 1148 | (setq cs (string-trim-right cs)) | ||
| 1149 | |||
| 1144 | (let ((csce | 1150 | (let ((csce |
| 1145 | (comment-make-extra-lines | 1151 | (comment-make-extra-lines |
| 1146 | cs ce ccs cce min-indent max-indent block))) | 1152 | cs ce ccs cce min-indent max-indent block))) |
| @@ -1211,7 +1217,7 @@ changed with `comment-style'." | |||
| 1211 | (progn (goto-char end) (end-of-line) (skip-syntax-backward " ") | 1217 | (progn (goto-char end) (end-of-line) (skip-syntax-backward " ") |
| 1212 | (<= (point) end)) | 1218 | (<= (point) end)) |
| 1213 | (or block (not (string= "" comment-end))) | 1219 | (or block (not (string= "" comment-end))) |
| 1214 | (or block (progn (goto-char beg) (search-forward "\n" end t))))) | 1220 | (or block (progn (goto-char beg) (re-search-forward "$" end t))))) |
| 1215 | 1221 | ||
| 1216 | ;; don't add end-markers just because the user asked for `block' | 1222 | ;; don't add end-markers just because the user asked for `block' |
| 1217 | (unless (or lines (string= "" comment-end)) (setq block nil)) | 1223 | (unless (or lines (string= "" comment-end)) (setq block nil)) |
diff --git a/lisp/pcomplete.el b/lisp/pcomplete.el index 745a813b758..2d2a8773bfe 100644 --- a/lisp/pcomplete.el +++ b/lisp/pcomplete.el | |||
| @@ -772,7 +772,7 @@ this is `comint-dynamic-complete-functions'." | |||
| 772 | (setq c (cdr c))) | 772 | (setq c (cdr c))) |
| 773 | (setq pcomplete-stub (substring common-stub 0 len) | 773 | (setq pcomplete-stub (substring common-stub 0 len) |
| 774 | pcomplete-autolist t) | 774 | pcomplete-autolist t) |
| 775 | (when (and begin (not pcomplete-show-list)) | 775 | (when (and begin (> len 0) (not pcomplete-show-list)) |
| 776 | (delete-region begin (point)) | 776 | (delete-region begin (point)) |
| 777 | (pcomplete-insert-entry "" pcomplete-stub)) | 777 | (pcomplete-insert-entry "" pcomplete-stub)) |
| 778 | (throw 'pcomplete-completions completions)) | 778 | (throw 'pcomplete-completions completions)) |
diff --git a/lisp/progmodes/cc-cmds.el b/lisp/progmodes/cc-cmds.el index ca64b544200..2b663135932 100644 --- a/lisp/progmodes/cc-cmds.el +++ b/lisp/progmodes/cc-cmds.el | |||
| @@ -1821,7 +1821,6 @@ the open-parenthesis that starts a defun; see `beginning-of-defun'." | |||
| 1821 | "Return the name of the current defun, or NIL if there isn't one. | 1821 | "Return the name of the current defun, or NIL if there isn't one. |
| 1822 | \"Defun\" here means a function, or other top level construct | 1822 | \"Defun\" here means a function, or other top level construct |
| 1823 | with a brace block." | 1823 | with a brace block." |
| 1824 | (interactive) | ||
| 1825 | (c-save-buffer-state | 1824 | (c-save-buffer-state |
| 1826 | (beginning-of-defun-function end-of-defun-function | 1825 | (beginning-of-defun-function end-of-defun-function |
| 1827 | where pos name-end case-fold-search) | 1826 | where pos name-end case-fold-search) |
| @@ -2048,6 +2047,23 @@ with a brace block." | |||
| 2048 | (eq (char-after) ?\{) | 2047 | (eq (char-after) ?\{) |
| 2049 | (cons (point-min) (point-max)))))))) | 2048 | (cons (point-min) (point-max)))))))) |
| 2050 | 2049 | ||
| 2050 | (defun c-display-defun-name (&optional arg) | ||
| 2051 | "Display the name of the current CC mode defun and the position in it. | ||
| 2052 | With a prefix arg, push the name onto the kill ring too." | ||
| 2053 | (interactive "P") | ||
| 2054 | (save-restriction | ||
| 2055 | (widen) | ||
| 2056 | (c-save-buffer-state ((name (c-defun-name)) | ||
| 2057 | (limits (c-declaration-limits t)) | ||
| 2058 | (point-bol (c-point 'bol))) | ||
| 2059 | (when name | ||
| 2060 | (message "%s. Line %s/%s." name | ||
| 2061 | (1+ (count-lines (car limits) point-bol)) | ||
| 2062 | (count-lines (car limits) (cdr limits))) | ||
| 2063 | (if arg (kill-new name)) | ||
| 2064 | (sit-for 3 t))))) | ||
| 2065 | (put 'c-display-defun-name 'isearch-scroll t) | ||
| 2066 | |||
| 2051 | (defun c-mark-function () | 2067 | (defun c-mark-function () |
| 2052 | "Put mark at end of the current top-level declaration or macro, point at beginning. | 2068 | "Put mark at end of the current top-level declaration or macro, point at beginning. |
| 2053 | If point is not inside any then the closest following one is | 2069 | If point is not inside any then the closest following one is |
| @@ -2092,7 +2108,6 @@ function does not require the declaration to contain a brace block." | |||
| 2092 | 2108 | ||
| 2093 | (defun c-cpp-define-name () | 2109 | (defun c-cpp-define-name () |
| 2094 | "Return the name of the current CPP macro, or NIL if we're not in one." | 2110 | "Return the name of the current CPP macro, or NIL if we're not in one." |
| 2095 | (interactive) | ||
| 2096 | (let (case-fold-search) | 2111 | (let (case-fold-search) |
| 2097 | (save-excursion | 2112 | (save-excursion |
| 2098 | (and c-opt-cpp-macro-define-start | 2113 | (and c-opt-cpp-macro-define-start |
diff --git a/lisp/progmodes/cc-mode.el b/lisp/progmodes/cc-mode.el index b0e5fe47a7c..f74e931a8bb 100644 --- a/lisp/progmodes/cc-mode.el +++ b/lisp/progmodes/cc-mode.el | |||
| @@ -389,7 +389,8 @@ control). See \"cc-mode.el\" for more info." | |||
| 389 | ;;(define-key c-mode-base-map "\C-c\C-v" 'c-version) | 389 | ;;(define-key c-mode-base-map "\C-c\C-v" 'c-version) |
| 390 | ;; (define-key c-mode-base-map "\C-c\C-y" 'c-toggle-hungry-state) Commented out by ACM, 2005-11-22. | 390 | ;; (define-key c-mode-base-map "\C-c\C-y" 'c-toggle-hungry-state) Commented out by ACM, 2005-11-22. |
| 391 | (define-key c-mode-base-map "\C-c\C-w" 'c-subword-mode) | 391 | (define-key c-mode-base-map "\C-c\C-w" 'c-subword-mode) |
| 392 | (define-key c-mode-base-map "\C-c\C-k" 'c-toggle-comment-style)) | 392 | (define-key c-mode-base-map "\C-c\C-k" 'c-toggle-comment-style) |
| 393 | (define-key c-mode-base-map "\C-c\C-z" 'c-display-defun-name)) | ||
| 393 | 394 | ||
| 394 | ;; We don't require the outline package, but we configure it a bit anyway. | 395 | ;; We don't require the outline package, but we configure it a bit anyway. |
| 395 | (cc-bytecomp-defvar outline-level) | 396 | (cc-bytecomp-defvar outline-level) |
diff --git a/lisp/progmodes/cperl-mode.el b/lisp/progmodes/cperl-mode.el index 1681922fa5a..e6ab8c4ea60 100644 --- a/lisp/progmodes/cperl-mode.el +++ b/lisp/progmodes/cperl-mode.el | |||
| @@ -1896,7 +1896,9 @@ or as help on variables `cperl-tips', `cperl-problems', | |||
| 1896 | (if cperl-pod-here-scan | 1896 | (if cperl-pod-here-scan |
| 1897 | (or cperl-syntaxify-by-font-lock | 1897 | (or cperl-syntaxify-by-font-lock |
| 1898 | (progn (or cperl-faces-init (cperl-init-faces-weak)) | 1898 | (progn (or cperl-faces-init (cperl-init-faces-weak)) |
| 1899 | (cperl-find-pods-heres))))) | 1899 | (cperl-find-pods-heres)))) |
| 1900 | ;; Setup Flymake | ||
| 1901 | (add-hook 'flymake-diagnostic-functions 'perl-flymake nil t)) | ||
| 1900 | 1902 | ||
| 1901 | ;; Fix for perldb - make default reasonable | 1903 | ;; Fix for perldb - make default reasonable |
| 1902 | (defun cperl-db () | 1904 | (defun cperl-db () |
diff --git a/lisp/progmodes/flymake-proc.el b/lisp/progmodes/flymake-proc.el index f504a1c21a8..e28451d9417 100644 --- a/lisp/progmodes/flymake-proc.el +++ b/lisp/progmodes/flymake-proc.el | |||
| @@ -82,7 +82,7 @@ Overrides `flymake-proc-allowed-file-name-masks'." | |||
| 82 | ("\\.xml\\'" flymake-proc-xml-init) | 82 | ("\\.xml\\'" flymake-proc-xml-init) |
| 83 | ("\\.html?\\'" flymake-proc-xml-init) | 83 | ("\\.html?\\'" flymake-proc-xml-init) |
| 84 | ("\\.cs\\'" flymake-proc-simple-make-init) | 84 | ("\\.cs\\'" flymake-proc-simple-make-init) |
| 85 | ("\\.p[ml]\\'" flymake-proc-perl-init) | 85 | ;; ("\\.p[ml]\\'" flymake-proc-perl-init) |
| 86 | ("\\.php[345]?\\'" flymake-proc-php-init) | 86 | ("\\.php[345]?\\'" flymake-proc-php-init) |
| 87 | ("\\.h\\'" flymake-proc-master-make-header-init flymake-proc-master-cleanup) | 87 | ("\\.h\\'" flymake-proc-master-make-header-init flymake-proc-master-cleanup) |
| 88 | ("\\.java\\'" flymake-proc-simple-make-java-init flymake-proc-simple-java-cleanup) | 88 | ("\\.java\\'" flymake-proc-simple-make-java-init flymake-proc-simple-java-cleanup) |
diff --git a/lisp/progmodes/flymake.el b/lisp/progmodes/flymake.el index 19dac81fe6d..0d200f01b34 100644 --- a/lisp/progmodes/flymake.el +++ b/lisp/progmodes/flymake.el | |||
| @@ -342,7 +342,7 @@ region is invalid." | |||
| 342 | (let* ((beg (fallback-bol)) | 342 | (let* ((beg (fallback-bol)) |
| 343 | (end (fallback-eol beg))) | 343 | (end (fallback-eol beg))) |
| 344 | (cons beg end))))))) | 344 | (cons beg end))))))) |
| 345 | (error (flymake-error "Invalid region line=%s col=%s" line col)))) | 345 | (error (flymake-log :warning "Invalid region line=%s col=%s" line col)))) |
| 346 | 346 | ||
| 347 | (defvar flymake-diagnostic-functions nil | 347 | (defvar flymake-diagnostic-functions nil |
| 348 | "Special hook of Flymake backends that check a buffer. | 348 | "Special hook of Flymake backends that check a buffer. |
| @@ -522,11 +522,12 @@ associated `flymake-category' return DEFAULT." | |||
| 522 | (flymake--fringe-overlay-spec | 522 | (flymake--fringe-overlay-spec |
| 523 | (overlay-get ov 'bitmap))) | 523 | (overlay-get ov 'bitmap))) |
| 524 | (default-maybe 'help-echo | 524 | (default-maybe 'help-echo |
| 525 | (lambda (_window _ov pos) | 525 | (lambda (window _ov pos) |
| 526 | (mapconcat | 526 | (with-selected-window window |
| 527 | #'flymake--diag-text | 527 | (mapconcat |
| 528 | (flymake-diagnostics pos) | 528 | #'flymake--diag-text |
| 529 | "\n"))) | 529 | (flymake-diagnostics pos) |
| 530 | "\n")))) | ||
| 530 | (default-maybe 'severity (warning-numeric-level :error)) | 531 | (default-maybe 'severity (warning-numeric-level :error)) |
| 531 | (default-maybe 'priority (+ 100 (overlay-get ov 'severity)))) | 532 | (default-maybe 'priority (+ 100 (overlay-get ov 'severity)))) |
| 532 | ;; Some properties can't be overridden. | 533 | ;; Some properties can't be overridden. |
| @@ -603,8 +604,8 @@ not expected." | |||
| 603 | (null expected-token)) | 604 | (null expected-token)) |
| 604 | ;; should never happen | 605 | ;; should never happen |
| 605 | (flymake-error "Unexpected report from stopped backend %s" backend)) | 606 | (flymake-error "Unexpected report from stopped backend %s" backend)) |
| 606 | ((and (not (eq expected-token token)) | 607 | ((not (or (eq expected-token token) |
| 607 | (not force)) | 608 | force)) |
| 608 | (flymake-error "Obsolete report from backend %s with explanation %s" | 609 | (flymake-error "Obsolete report from backend %s with explanation %s" |
| 609 | backend explanation)) | 610 | backend explanation)) |
| 610 | ((eq :panic report-action) | 611 | ((eq :panic report-action) |
| @@ -744,8 +745,11 @@ Interactively, with a prefix arg, FORCE is t." | |||
| 744 | () | 745 | () |
| 745 | (remove-hook 'post-command-hook #'start-post-command | 746 | (remove-hook 'post-command-hook #'start-post-command |
| 746 | nil) | 747 | nil) |
| 747 | (with-current-buffer buffer | 748 | ;; The buffer may have disappeared already, e.g. because of |
| 748 | (flymake-start (remove 'post-command deferred) force))) | 749 | ;; code like `(with-temp-buffer (python-mode) ...)'. |
| 750 | (when (buffer-live-p buffer) | ||
| 751 | (with-current-buffer buffer | ||
| 752 | (flymake-start (remove 'post-command deferred) force)))) | ||
| 749 | (start-on-display | 753 | (start-on-display |
| 750 | () | 754 | () |
| 751 | (remove-hook 'window-configuration-change-hook #'start-on-display | 755 | (remove-hook 'window-configuration-change-hook #'start-on-display |
| @@ -948,7 +952,7 @@ applied." | |||
| 948 | (message | 952 | (message |
| 949 | "%s" | 953 | "%s" |
| 950 | (funcall (overlay-get target 'help-echo) | 954 | (funcall (overlay-get target 'help-echo) |
| 951 | nil nil (point))))) | 955 | (selected-window) target (point))))) |
| 952 | (interactive | 956 | (interactive |
| 953 | (user-error "No more Flymake errors%s" | 957 | (user-error "No more Flymake errors%s" |
| 954 | (if filter | 958 | (if filter |
diff --git a/lisp/progmodes/gdb-mi.el b/lisp/progmodes/gdb-mi.el index 28d1974893d..58552759b95 100644 --- a/lisp/progmodes/gdb-mi.el +++ b/lisp/progmodes/gdb-mi.el | |||
| @@ -400,14 +400,22 @@ valid signal handlers.") | |||
| 400 | (const :tag "Unlimited" nil)) | 400 | (const :tag "Unlimited" nil)) |
| 401 | :version "22.1") | 401 | :version "22.1") |
| 402 | 402 | ||
| 403 | (defcustom gdb-non-stop-setting t | 403 | (defcustom gdb-non-stop-setting (not (eq system-type 'windows-nt)) |
| 404 | "When in non-stop mode, stopped threads can be examined while | 404 | "If non-nil, GDB sessions are expected to support the non-stop mode. |
| 405 | When in the non-stop mode, stopped threads can be examined while | ||
| 405 | other threads continue to execute. | 406 | other threads continue to execute. |
| 406 | 407 | ||
| 408 | If this is non-nil, GDB will be sent the \"set non-stop 1\" command, | ||
| 409 | and if that results in an error, the non-stop setting will be | ||
| 410 | turned off automatically. | ||
| 411 | |||
| 412 | On MS-Windows, this is off by default, because MS-Windows targets | ||
| 413 | don't support the non-stop mode. | ||
| 414 | |||
| 407 | GDB session needs to be restarted for this setting to take effect." | 415 | GDB session needs to be restarted for this setting to take effect." |
| 408 | :type 'boolean | 416 | :type 'boolean |
| 409 | :group 'gdb-non-stop | 417 | :group 'gdb-non-stop |
| 410 | :version "23.2") | 418 | :version "26.1") |
| 411 | 419 | ||
| 412 | ;; TODO Some commands can't be called with --all (give a notice about | 420 | ;; TODO Some commands can't be called with --all (give a notice about |
| 413 | ;; it in setting doc) | 421 | ;; it in setting doc) |
| @@ -2188,7 +2196,10 @@ a GDB/MI reply message." | |||
| 2188 | 2196 | ||
| 2189 | (defun gdbmi-bnf-console-stream-output (c-string) | 2197 | (defun gdbmi-bnf-console-stream-output (c-string) |
| 2190 | "Handler for the console-stream-output GDB/MI output grammar rule." | 2198 | "Handler for the console-stream-output GDB/MI output grammar rule." |
| 2191 | (gdb-console c-string)) | 2199 | (gdb-console c-string) |
| 2200 | ;; We've written to the GUD console, so we should print the prompt | ||
| 2201 | ;; after the next result-class or async-class. | ||
| 2202 | (setq gdb-first-done-or-error t)) | ||
| 2192 | 2203 | ||
| 2193 | (defun gdbmi-bnf-target-stream-output (_c-string) | 2204 | (defun gdbmi-bnf-target-stream-output (_c-string) |
| 2194 | "Handler for the target-stream-output GDB/MI output grammar rule." | 2205 | "Handler for the target-stream-output GDB/MI output grammar rule." |
diff --git a/lisp/progmodes/perl-mode.el b/lisp/progmodes/perl-mode.el index 24b934ce6c2..8e7cd13088f 100644 --- a/lisp/progmodes/perl-mode.el +++ b/lisp/progmodes/perl-mode.el | |||
| @@ -581,6 +581,73 @@ create a new comment." | |||
| 581 | (match-string-no-properties 1)))) | 581 | (match-string-no-properties 1)))) |
| 582 | 582 | ||
| 583 | 583 | ||
| 584 | ;;; Flymake support | ||
| 585 | (defcustom perl-flymake-command '("perl" "-w" "-c") | ||
| 586 | "External tool used to check Perl source code. | ||
| 587 | This is a non empty list of strings, the checker tool possibly | ||
| 588 | followed by required arguments. Once launched it will receive | ||
| 589 | the Perl source to be checked as its standard input." | ||
| 590 | :group 'perl | ||
| 591 | :type '(repeat string)) | ||
| 592 | |||
| 593 | (defvar-local perl--flymake-proc nil) | ||
| 594 | |||
| 595 | ;;;###autoload | ||
| 596 | (defun perl-flymake (report-fn &rest _args) | ||
| 597 | "Perl backend for Flymake. Launches | ||
| 598 | `perl-flymake-command' (which see) and passes to its standard | ||
| 599 | input the contents of the current buffer. The output of this | ||
| 600 | command is analysed for error and warning messages." | ||
| 601 | (unless (executable-find (car perl-flymake-command)) | ||
| 602 | (error "Cannot find a suitable checker")) | ||
| 603 | |||
| 604 | (when (process-live-p perl--flymake-proc) | ||
| 605 | (kill-process perl--flymake-proc)) | ||
| 606 | |||
| 607 | (let ((source (current-buffer))) | ||
| 608 | (save-restriction | ||
| 609 | (widen) | ||
| 610 | (setq | ||
| 611 | perl--flymake-proc | ||
| 612 | (make-process | ||
| 613 | :name "perl-flymake" :noquery t :connection-type 'pipe | ||
| 614 | :buffer (generate-new-buffer " *perl-flymake*") | ||
| 615 | :command perl-flymake-command | ||
| 616 | :sentinel | ||
| 617 | (lambda (proc _event) | ||
| 618 | (when (eq 'exit (process-status proc)) | ||
| 619 | (unwind-protect | ||
| 620 | (if (with-current-buffer source (eq proc perl--flymake-proc)) | ||
| 621 | (with-current-buffer (process-buffer proc) | ||
| 622 | (goto-char (point-min)) | ||
| 623 | (cl-loop | ||
| 624 | while (search-forward-regexp | ||
| 625 | "^\\(.+\\) at - line \\([0-9]+\\)" | ||
| 626 | nil t) | ||
| 627 | for msg = (match-string 1) | ||
| 628 | for (beg . end) = (flymake-diag-region | ||
| 629 | source | ||
| 630 | (string-to-number (match-string 2))) | ||
| 631 | for type = | ||
| 632 | (if (string-match | ||
| 633 | "\\(Scalar value\\|Useless use\\|Unquoted string\\)" | ||
| 634 | msg) | ||
| 635 | :warning | ||
| 636 | :error) | ||
| 637 | collect (flymake-make-diagnostic source | ||
| 638 | beg | ||
| 639 | end | ||
| 640 | type | ||
| 641 | msg) | ||
| 642 | into diags | ||
| 643 | finally (funcall report-fn diags))) | ||
| 644 | (flymake-log :debug "Canceling obsolete check %s" | ||
| 645 | proc)) | ||
| 646 | (kill-buffer (process-buffer proc))))))) | ||
| 647 | (process-send-region perl--flymake-proc (point-min) (point-max)) | ||
| 648 | (process-send-eof perl--flymake-proc)))) | ||
| 649 | |||
| 650 | |||
| 584 | (defvar perl-mode-hook nil | 651 | (defvar perl-mode-hook nil |
| 585 | "Normal hook to run when entering Perl mode.") | 652 | "Normal hook to run when entering Perl mode.") |
| 586 | 653 | ||
| @@ -665,7 +732,9 @@ Turning on Perl mode runs the normal hook `perl-mode-hook'." | |||
| 665 | ;; Setup outline-minor-mode. | 732 | ;; Setup outline-minor-mode. |
| 666 | (setq-local outline-regexp perl-outline-regexp) | 733 | (setq-local outline-regexp perl-outline-regexp) |
| 667 | (setq-local outline-level 'perl-outline-level) | 734 | (setq-local outline-level 'perl-outline-level) |
| 668 | (setq-local add-log-current-defun-function #'perl-current-defun-name)) | 735 | (setq-local add-log-current-defun-function #'perl-current-defun-name) |
| 736 | ;; Setup Flymake | ||
| 737 | (add-hook 'flymake-diagnostic-functions #'perl-flymake nil t)) | ||
| 669 | 738 | ||
| 670 | ;; This is used by indent-for-comment | 739 | ;; This is used by indent-for-comment |
| 671 | ;; to decide how much to indent a comment in Perl code | 740 | ;; to decide how much to indent a comment in Perl code |
diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index 895117b9ee3..d4226e5ce7b 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el | |||
| @@ -2113,20 +2113,25 @@ remote host, the returned value is intended for | |||
| 2113 | (defun python-shell-calculate-exec-path () | 2113 | (defun python-shell-calculate-exec-path () |
| 2114 | "Calculate `exec-path'. | 2114 | "Calculate `exec-path'. |
| 2115 | Prepends `python-shell-exec-path' and adds the binary directory | 2115 | Prepends `python-shell-exec-path' and adds the binary directory |
| 2116 | for virtualenv if `python-shell-virtualenv-root' is set. If | 2116 | for virtualenv if `python-shell-virtualenv-root' is set - this |
| 2117 | `default-directory' points to a remote host, the returned value | 2117 | will use the python interpreter from inside the virtualenv when |
| 2118 | appends `python-shell-remote-exec-path' instead of `exec-path'." | 2118 | starting the shell. If `default-directory' points to a remote host, |
| 2119 | the returned value appends `python-shell-remote-exec-path' instead | ||
| 2120 | of `exec-path'." | ||
| 2119 | (let ((new-path (copy-sequence | 2121 | (let ((new-path (copy-sequence |
| 2120 | (if (file-remote-p default-directory) | 2122 | (if (file-remote-p default-directory) |
| 2121 | python-shell-remote-exec-path | 2123 | python-shell-remote-exec-path |
| 2122 | exec-path)))) | 2124 | exec-path))) |
| 2125 | |||
| 2126 | ;; Windows and POSIX systems use different venv directory structures | ||
| 2127 | (virtualenv-bin-dir (if (eq system-type 'windows-nt) "Scripts" "bin"))) | ||
| 2123 | (python-shell--add-to-path-with-priority | 2128 | (python-shell--add-to-path-with-priority |
| 2124 | new-path python-shell-exec-path) | 2129 | new-path python-shell-exec-path) |
| 2125 | (if (not python-shell-virtualenv-root) | 2130 | (if (not python-shell-virtualenv-root) |
| 2126 | new-path | 2131 | new-path |
| 2127 | (python-shell--add-to-path-with-priority | 2132 | (python-shell--add-to-path-with-priority |
| 2128 | new-path | 2133 | new-path |
| 2129 | (list (expand-file-name "bin" python-shell-virtualenv-root))) | 2134 | (list (expand-file-name virtualenv-bin-dir python-shell-virtualenv-root))) |
| 2130 | new-path))) | 2135 | new-path))) |
| 2131 | 2136 | ||
| 2132 | (defun python-shell-tramp-refresh-remote-path (vec paths) | 2137 | (defun python-shell-tramp-refresh-remote-path (vec paths) |
| @@ -5142,6 +5147,138 @@ returned as is." | |||
| 5142 | (ignore-errors (string-match regexp "") t)) | 5147 | (ignore-errors (string-match regexp "") t)) |
| 5143 | 5148 | ||
| 5144 | 5149 | ||
| 5150 | ;;; Flymake integration | ||
| 5151 | |||
| 5152 | (defgroup python-flymake nil | ||
| 5153 | "Integration between Python and Flymake." | ||
| 5154 | :group 'python | ||
| 5155 | :link '(custom-group-link :tag "Flymake" flymake) | ||
| 5156 | :version "26.1") | ||
| 5157 | |||
| 5158 | (defcustom python-flymake-command '("pyflakes") | ||
| 5159 | "The external tool that will be used to perform the syntax check. | ||
| 5160 | This is a non empty list of strings, the checker tool possibly followed by | ||
| 5161 | required arguments. Once launched it will receive the Python source to be | ||
| 5162 | checked as its standard input. | ||
| 5163 | To use `flake8' you would set this to (\"flake8\" \"-\")." | ||
| 5164 | :group 'python-flymake | ||
| 5165 | :type '(repeat string)) | ||
| 5166 | |||
| 5167 | ;; The default regexp accomodates for older pyflakes, which did not | ||
| 5168 | ;; report the column number, and at the same time it's compatible with | ||
| 5169 | ;; flake8 output, although it may be redefined to explicitly match the | ||
| 5170 | ;; TYPE | ||
| 5171 | (defcustom python-flymake-command-output-pattern | ||
| 5172 | (list | ||
| 5173 | "^\\(?:<?stdin>?\\):\\(?1:[0-9]+\\):\\(?:\\(?2:[0-9]+\\):\\)? \\(?3:.*\\)$" | ||
| 5174 | 1 2 nil 3) | ||
| 5175 | "Specify how to parse the output of `python-flymake-command'. | ||
| 5176 | The value has the form (REGEXP LINE COLUMN TYPE MESSAGE): if | ||
| 5177 | REGEXP matches, the LINE'th subexpression gives the line number, | ||
| 5178 | the COLUMN'th subexpression gives the column number on that line, | ||
| 5179 | the TYPE'th subexpression gives the type of the message and the | ||
| 5180 | MESSAGE'th gives the message text itself. | ||
| 5181 | |||
| 5182 | If COLUMN or TYPE are nil or that index didn't match, that | ||
| 5183 | information is not present on the matched line and a default will | ||
| 5184 | be used." | ||
| 5185 | :group 'python-flymake | ||
| 5186 | :type '(list regexp | ||
| 5187 | (integer :tag "Line's index") | ||
| 5188 | (choice | ||
| 5189 | (const :tag "No column" nil) | ||
| 5190 | (integer :tag "Column's index")) | ||
| 5191 | (choice | ||
| 5192 | (const :tag "No type" nil) | ||
| 5193 | (integer :tag "Type's index")) | ||
| 5194 | (integer :tag "Message's index"))) | ||
| 5195 | |||
| 5196 | (defcustom python-flymake-msg-alist | ||
| 5197 | '(("\\(^redefinition\\|.*unused.*\\|used$\\)" . :warning)) | ||
| 5198 | "Alist used to associate messages to their types. | ||
| 5199 | Each element should be a cons-cell (REGEXP . TYPE), where TYPE must be | ||
| 5200 | one defined in the variable `flymake-diagnostic-types-alist'. | ||
| 5201 | For example, when using `flake8' a possible configuration could be: | ||
| 5202 | |||
| 5203 | ((\"\\(^redefinition\\|.*unused.*\\|used$\\)\" . :warning) | ||
| 5204 | (\"^E999\" . :error) | ||
| 5205 | (\"^[EW][0-9]+\" . :note)) | ||
| 5206 | |||
| 5207 | By default messages are considered errors." | ||
| 5208 | :group 'python-flymake | ||
| 5209 | :type `(alist :key-type (regexp) | ||
| 5210 | :value-type (symbol))) | ||
| 5211 | |||
| 5212 | (defvar-local python--flymake-proc nil) | ||
| 5213 | |||
| 5214 | (defun python--flymake-parse-output (source proc report-fn) | ||
| 5215 | "Collect diagnostics parsing checker tool's output line by line." | ||
| 5216 | (let ((rx (nth 0 python-flymake-command-output-pattern)) | ||
| 5217 | (lineidx (nth 1 python-flymake-command-output-pattern)) | ||
| 5218 | (colidx (nth 2 python-flymake-command-output-pattern)) | ||
| 5219 | (typeidx (nth 3 python-flymake-command-output-pattern)) | ||
| 5220 | (msgidx (nth 4 python-flymake-command-output-pattern))) | ||
| 5221 | (with-current-buffer (process-buffer proc) | ||
| 5222 | (goto-char (point-min)) | ||
| 5223 | (cl-loop | ||
| 5224 | while (search-forward-regexp rx nil t) | ||
| 5225 | for msg = (match-string msgidx) | ||
| 5226 | for (beg . end) = (flymake-diag-region | ||
| 5227 | source | ||
| 5228 | (string-to-number | ||
| 5229 | (match-string lineidx)) | ||
| 5230 | (and colidx | ||
| 5231 | (match-string colidx) | ||
| 5232 | (string-to-number | ||
| 5233 | (match-string colidx)))) | ||
| 5234 | for type = (or (and typeidx | ||
| 5235 | (match-string typeidx) | ||
| 5236 | (assoc-default | ||
| 5237 | (match-string typeidx) | ||
| 5238 | python-flymake-msg-alist | ||
| 5239 | #'string-match)) | ||
| 5240 | (assoc-default msg | ||
| 5241 | python-flymake-msg-alist | ||
| 5242 | #'string-match) | ||
| 5243 | :error) | ||
| 5244 | collect (flymake-make-diagnostic | ||
| 5245 | source beg end type msg) | ||
| 5246 | into diags | ||
| 5247 | finally (funcall report-fn diags))))) | ||
| 5248 | |||
| 5249 | (defun python-flymake (report-fn &rest _args) | ||
| 5250 | "Flymake backend for Python. | ||
| 5251 | This backend uses `python-flymake-command' (which see) to launch a process | ||
| 5252 | that is passed the current buffer's content via stdin. | ||
| 5253 | REPORT-FN is Flymake's callback function." | ||
| 5254 | (unless (executable-find (car python-flymake-command)) | ||
| 5255 | (error "Cannot find a suitable checker")) | ||
| 5256 | |||
| 5257 | (when (process-live-p python--flymake-proc) | ||
| 5258 | (kill-process python--flymake-proc)) | ||
| 5259 | |||
| 5260 | (let ((source (current-buffer))) | ||
| 5261 | (save-restriction | ||
| 5262 | (widen) | ||
| 5263 | (setq python--flymake-proc | ||
| 5264 | (make-process | ||
| 5265 | :name "python-flymake" | ||
| 5266 | :noquery t | ||
| 5267 | :connection-type 'pipe | ||
| 5268 | :buffer (generate-new-buffer " *python-flymake*") | ||
| 5269 | :command python-flymake-command | ||
| 5270 | :sentinel | ||
| 5271 | (lambda (proc _event) | ||
| 5272 | (when (eq 'exit (process-status proc)) | ||
| 5273 | (unwind-protect | ||
| 5274 | (when (with-current-buffer source | ||
| 5275 | (eq proc python--flymake-proc)) | ||
| 5276 | (python--flymake-parse-output source proc report-fn)) | ||
| 5277 | (kill-buffer (process-buffer proc))))))) | ||
| 5278 | (process-send-region python--flymake-proc (point-min) (point-max)) | ||
| 5279 | (process-send-eof python--flymake-proc)))) | ||
| 5280 | |||
| 5281 | |||
| 5145 | (defun python-electric-pair-string-delimiter () | 5282 | (defun python-electric-pair-string-delimiter () |
| 5146 | (when (and electric-pair-mode | 5283 | (when (and electric-pair-mode |
| 5147 | (memq last-command-event '(?\" ?\')) | 5284 | (memq last-command-event '(?\" ?\')) |
| @@ -5255,7 +5392,9 @@ returned as is." | |||
| 5255 | (make-local-variable 'python-shell-internal-buffer) | 5392 | (make-local-variable 'python-shell-internal-buffer) |
| 5256 | 5393 | ||
| 5257 | (when python-indent-guess-indent-offset | 5394 | (when python-indent-guess-indent-offset |
| 5258 | (python-indent-guess-indent-offset))) | 5395 | (python-indent-guess-indent-offset)) |
| 5396 | |||
| 5397 | (add-hook 'flymake-diagnostic-functions #'python-flymake nil t)) | ||
| 5259 | 5398 | ||
| 5260 | 5399 | ||
| 5261 | (provide 'python) | 5400 | (provide 'python) |
diff --git a/lisp/progmodes/ruby-mode.el b/lisp/progmodes/ruby-mode.el index 0024957c39b..1f4aa6d9fbd 100644 --- a/lisp/progmodes/ruby-mode.el +++ b/lisp/progmodes/ruby-mode.el | |||
| @@ -2253,6 +2253,68 @@ See `font-lock-syntax-table'.") | |||
| 2253 | (progn (set-match-data value) t)) | 2253 | (progn (set-match-data value) t)) |
| 2254 | (ruby-match-expression-expansion limit))))) | 2254 | (ruby-match-expression-expansion limit))))) |
| 2255 | 2255 | ||
| 2256 | ;;; Flymake support | ||
| 2257 | (defcustom ruby-flymake-command '("ruby" "-w" "-c") | ||
| 2258 | "External tool used to check Ruby source code. | ||
| 2259 | This is a non empty list of strings, the checker tool possibly | ||
| 2260 | followed by required arguments. Once launched it will receive | ||
| 2261 | the Ruby source to be checked as its standard input." | ||
| 2262 | :group 'ruby | ||
| 2263 | :type '(repeat string)) | ||
| 2264 | |||
| 2265 | (defvar-local ruby--flymake-proc nil) | ||
| 2266 | |||
| 2267 | (defun ruby-flymake (report-fn &rest _args) | ||
| 2268 | "Ruby backend for Flymake. Launches | ||
| 2269 | `ruby-flymake-command' (which see) and passes to its standard | ||
| 2270 | input the contents of the current buffer. The output of this | ||
| 2271 | command is analysed for error and warning messages." | ||
| 2272 | (unless (executable-find (car ruby-flymake-command)) | ||
| 2273 | (error "Cannot find a suitable checker")) | ||
| 2274 | |||
| 2275 | (when (process-live-p ruby--flymake-proc) | ||
| 2276 | (kill-process ruby--flymake-proc)) | ||
| 2277 | |||
| 2278 | (let ((source (current-buffer))) | ||
| 2279 | (save-restriction | ||
| 2280 | (widen) | ||
| 2281 | (setq | ||
| 2282 | ruby--flymake-proc | ||
| 2283 | (make-process | ||
| 2284 | :name "ruby-flymake" :noquery t :connection-type 'pipe | ||
| 2285 | :buffer (generate-new-buffer " *ruby-flymake*") | ||
| 2286 | :command ruby-flymake-command | ||
| 2287 | :sentinel | ||
| 2288 | (lambda (proc _event) | ||
| 2289 | (when (eq 'exit (process-status proc)) | ||
| 2290 | (unwind-protect | ||
| 2291 | (if (with-current-buffer source (eq proc ruby--flymake-proc)) | ||
| 2292 | (with-current-buffer (process-buffer proc) | ||
| 2293 | (goto-char (point-min)) | ||
| 2294 | (cl-loop | ||
| 2295 | while (search-forward-regexp | ||
| 2296 | "^\\(?:.*.rb\\|-\\):\\([0-9]+\\): \\(.*\\)$" | ||
| 2297 | nil t) | ||
| 2298 | for msg = (match-string 2) | ||
| 2299 | for (beg . end) = (flymake-diag-region | ||
| 2300 | source | ||
| 2301 | (string-to-number (match-string 1))) | ||
| 2302 | for type = (if (string-match "^warning" msg) | ||
| 2303 | :warning | ||
| 2304 | :error) | ||
| 2305 | collect (flymake-make-diagnostic source | ||
| 2306 | beg | ||
| 2307 | end | ||
| 2308 | type | ||
| 2309 | msg) | ||
| 2310 | into diags | ||
| 2311 | finally (funcall report-fn diags))) | ||
| 2312 | (flymake-log :debug "Canceling obsolete check %s" | ||
| 2313 | proc)) | ||
| 2314 | (kill-buffer (process-buffer proc))))))) | ||
| 2315 | (process-send-region ruby--flymake-proc (point-min) (point-max)) | ||
| 2316 | (process-send-eof ruby--flymake-proc)))) | ||
| 2317 | |||
| 2256 | ;;;###autoload | 2318 | ;;;###autoload |
| 2257 | (define-derived-mode ruby-mode prog-mode "Ruby" | 2319 | (define-derived-mode ruby-mode prog-mode "Ruby" |
| 2258 | "Major mode for editing Ruby code." | 2320 | "Major mode for editing Ruby code." |
| @@ -2265,6 +2327,7 @@ See `font-lock-syntax-table'.") | |||
| 2265 | 2327 | ||
| 2266 | (add-hook 'after-save-hook 'ruby-mode-set-encoding nil 'local) | 2328 | (add-hook 'after-save-hook 'ruby-mode-set-encoding nil 'local) |
| 2267 | (add-hook 'electric-indent-functions 'ruby--electric-indent-p nil 'local) | 2329 | (add-hook 'electric-indent-functions 'ruby--electric-indent-p nil 'local) |
| 2330 | (add-hook 'flymake-diagnostic-functions 'ruby-flymake nil 'local) | ||
| 2268 | 2331 | ||
| 2269 | (setq-local font-lock-defaults '((ruby-font-lock-keywords) nil nil)) | 2332 | (setq-local font-lock-defaults '((ruby-font-lock-keywords) nil nil)) |
| 2270 | (setq-local font-lock-keywords ruby-font-lock-keywords) | 2333 | (setq-local font-lock-keywords ruby-font-lock-keywords) |
diff --git a/lisp/progmodes/xref.el b/lisp/progmodes/xref.el index 3dbf65ef6f5..db025d40aa3 100644 --- a/lisp/progmodes/xref.el +++ b/lisp/progmodes/xref.el | |||
| @@ -448,43 +448,74 @@ If SELECT is non-nil, select the target window." | |||
| 448 | (when xref-w | 448 | (when xref-w |
| 449 | (set-window-dedicated-p xref-w xref-w-dedicated))))) | 449 | (set-window-dedicated-p xref-w xref-w-dedicated))))) |
| 450 | 450 | ||
| 451 | (defun xref--show-pos-in-buf (pos buf select) | 451 | (defvar-local xref--original-window-intent nil |
| 452 | (let ((xref-buf (current-buffer)) | 452 | "Original window-switching intent before xref buffer creation.") |
| 453 | win) | 453 | |
| 454 | (defvar-local xref--original-window nil | ||
| 455 | "The original window this xref buffer was created from.") | ||
| 456 | |||
| 457 | (defun xref--show-pos-in-buf (pos buf) | ||
| 458 | "Goto and display position POS of buffer BUF in a window. | ||
| 459 | Honor `xref--original-window-intent', run `xref-after-jump-hook' | ||
| 460 | and finally return the window." | ||
| 461 | (let* ((xref-buf (current-buffer)) | ||
| 462 | (pop-up-frames | ||
| 463 | (or (eq xref--original-window-intent 'frame) | ||
| 464 | pop-up-frames)) | ||
| 465 | (action | ||
| 466 | (cond ((memq | ||
| 467 | xref--original-window-intent | ||
| 468 | '(window frame)) | ||
| 469 | t) | ||
| 470 | ((and | ||
| 471 | (window-live-p xref--original-window) | ||
| 472 | (or (not (window-dedicated-p xref--original-window)) | ||
| 473 | (eq (window-buffer xref--original-window) buf))) | ||
| 474 | `(,(lambda (buf _alist) | ||
| 475 | (set-window-buffer xref--original-window buf) | ||
| 476 | xref--original-window)))))) | ||
| 454 | (with-selected-window | 477 | (with-selected-window |
| 455 | (xref--with-dedicated-window | 478 | (with-selected-window |
| 456 | (display-buffer buf)) | 479 | ;; Just before `display-buffer', place ourselves in the |
| 480 | ;; original window to suggest preserving it. Of course, if | ||
| 481 | ;; user has deleted the original window, all bets are off, | ||
| 482 | ;; just use the selected one. | ||
| 483 | (or (and (window-live-p xref--original-window) | ||
| 484 | xref--original-window) | ||
| 485 | (selected-window)) | ||
| 486 | (display-buffer buf action)) | ||
| 457 | (xref--goto-char pos) | 487 | (xref--goto-char pos) |
| 458 | (run-hooks 'xref-after-jump-hook) | 488 | (run-hooks 'xref-after-jump-hook) |
| 459 | (let ((buf (current-buffer))) | 489 | (let ((buf (current-buffer))) |
| 460 | (setq win (selected-window)) | ||
| 461 | (with-current-buffer xref-buf | 490 | (with-current-buffer xref-buf |
| 462 | (setq-local other-window-scroll-buffer buf)))) | 491 | (setq-local other-window-scroll-buffer buf))) |
| 463 | (when select | 492 | (selected-window)))) |
| 464 | (select-window win)))) | ||
| 465 | 493 | ||
| 466 | (defun xref--show-location (location &optional select) | 494 | (defun xref--show-location (location &optional select) |
| 495 | "Help `xref-show-xref' and `xref-goto-xref' do their job. | ||
| 496 | Go to LOCATION and if SELECT is non-nil select its window. If | ||
| 497 | SELECT is `quit', also quit the *xref* window." | ||
| 467 | (condition-case err | 498 | (condition-case err |
| 468 | (let* ((marker (xref-location-marker location)) | 499 | (let* ((marker (xref-location-marker location)) |
| 469 | (buf (marker-buffer marker))) | 500 | (buf (marker-buffer marker)) |
| 470 | (xref--show-pos-in-buf marker buf select)) | 501 | (xref-buffer (current-buffer))) |
| 502 | (cond (select | ||
| 503 | (if (eq select 'quit) (quit-window nil nil)) | ||
| 504 | (with-current-buffer xref-buffer | ||
| 505 | (select-window (xref--show-pos-in-buf marker buf)))) | ||
| 506 | (t | ||
| 507 | (save-selected-window | ||
| 508 | (xref--with-dedicated-window | ||
| 509 | (xref--show-pos-in-buf marker buf)))))) | ||
| 471 | (user-error (message (error-message-string err))))) | 510 | (user-error (message (error-message-string err))))) |
| 472 | 511 | ||
| 473 | (defvar-local xref--window nil | ||
| 474 | "The original window this xref buffer was created from.") | ||
| 475 | |||
| 476 | (defun xref-show-location-at-point () | 512 | (defun xref-show-location-at-point () |
| 477 | "Display the source of xref at point in the appropriate window, if any." | 513 | "Display the source of xref at point in the appropriate window, if any." |
| 478 | (interactive) | 514 | (interactive) |
| 479 | (let* ((xref (xref--item-at-point)) | 515 | (let* ((xref (xref--item-at-point)) |
| 480 | (xref--current-item xref)) | 516 | (xref--current-item xref)) |
| 481 | (when xref | 517 | (when xref |
| 482 | ;; Try to avoid the window the current xref buffer was | 518 | (xref--show-location (xref-item-location xref))))) |
| 483 | ;; originally created from. | ||
| 484 | (if (window-live-p xref--window) | ||
| 485 | (with-selected-window xref--window | ||
| 486 | (xref--show-location (xref-item-location xref))) | ||
| 487 | (xref--show-location (xref-item-location xref)))))) | ||
| 488 | 519 | ||
| 489 | (defun xref-next-line () | 520 | (defun xref-next-line () |
| 490 | "Move to the next xref and display its source in the appropriate window." | 521 | "Move to the next xref and display its source in the appropriate window." |
| @@ -503,12 +534,19 @@ If SELECT is non-nil, select the target window." | |||
| 503 | (back-to-indentation) | 534 | (back-to-indentation) |
| 504 | (get-text-property (point) 'xref-item))) | 535 | (get-text-property (point) 'xref-item))) |
| 505 | 536 | ||
| 506 | (defun xref-goto-xref () | 537 | (defun xref-goto-xref (&optional quit) |
| 507 | "Jump to the xref on the current line and select its window." | 538 | "Jump to the xref on the current line and select its window. |
| 539 | Non-interactively, non-nil QUIT means to first quit the *xref* | ||
| 540 | buffer." | ||
| 508 | (interactive) | 541 | (interactive) |
| 509 | (let ((xref (or (xref--item-at-point) | 542 | (let ((xref (or (xref--item-at-point) |
| 510 | (user-error "No reference at point")))) | 543 | (user-error "No reference at point")))) |
| 511 | (xref--show-location (xref-item-location xref) t))) | 544 | (xref--show-location (xref-item-location xref) (if quit 'quit t)))) |
| 545 | |||
| 546 | (defun xref-quit-and-goto-xref () | ||
| 547 | "Quit *xref* buffer, then jump to xref on current line." | ||
| 548 | (interactive) | ||
| 549 | (xref-goto-xref t)) | ||
| 512 | 550 | ||
| 513 | (defun xref-query-replace-in-results (from to) | 551 | (defun xref-query-replace-in-results (from to) |
| 514 | "Perform interactive replacement of FROM with TO in all displayed xrefs. | 552 | "Perform interactive replacement of FROM with TO in all displayed xrefs. |
| @@ -632,6 +670,7 @@ references displayed in the current *xref* buffer." | |||
| 632 | (define-key map (kbd "p") #'xref-prev-line) | 670 | (define-key map (kbd "p") #'xref-prev-line) |
| 633 | (define-key map (kbd "r") #'xref-query-replace-in-results) | 671 | (define-key map (kbd "r") #'xref-query-replace-in-results) |
| 634 | (define-key map (kbd "RET") #'xref-goto-xref) | 672 | (define-key map (kbd "RET") #'xref-goto-xref) |
| 673 | (define-key map (kbd "TAB") #'xref-quit-and-goto-xref) | ||
| 635 | (define-key map (kbd "C-o") #'xref-show-location-at-point) | 674 | (define-key map (kbd "C-o") #'xref-show-location-at-point) |
| 636 | ;; suggested by Johan Claesson "to further reduce finger movement": | 675 | ;; suggested by Johan Claesson "to further reduce finger movement": |
| 637 | (define-key map (kbd ".") #'xref-next-line) | 676 | (define-key map (kbd ".") #'xref-next-line) |
| @@ -726,7 +765,8 @@ Return an alist of the form ((FILENAME . (XREF ...)) ...)." | |||
| 726 | (xref--xref-buffer-mode) | 765 | (xref--xref-buffer-mode) |
| 727 | (pop-to-buffer (current-buffer)) | 766 | (pop-to-buffer (current-buffer)) |
| 728 | (goto-char (point-min)) | 767 | (goto-char (point-min)) |
| 729 | (setq xref--window (assoc-default 'window alist)) | 768 | (setq xref--original-window (assoc-default 'window alist) |
| 769 | xref--original-window-intent (assoc-default 'display-action alist)) | ||
| 730 | (current-buffer))))) | 770 | (current-buffer))))) |
| 731 | 771 | ||
| 732 | 772 | ||
| @@ -753,7 +793,8 @@ Return an alist of the form ((FILENAME . (XREF ...)) ...)." | |||
| 753 | (t | 793 | (t |
| 754 | (xref-push-marker-stack) | 794 | (xref-push-marker-stack) |
| 755 | (funcall xref-show-xrefs-function xrefs | 795 | (funcall xref-show-xrefs-function xrefs |
| 756 | `((window . ,(selected-window))))))) | 796 | `((window . ,(selected-window)) |
| 797 | (display-action . ,display-action)))))) | ||
| 757 | 798 | ||
| 758 | (defun xref--prompt-p (command) | 799 | (defun xref--prompt-p (command) |
| 759 | (or (eq xref-prompt-for-identifier t) | 800 | (or (eq xref-prompt-for-identifier t) |
diff --git a/lisp/simple.el b/lisp/simple.el index 375a79e7662..e09ddd2e689 100644 --- a/lisp/simple.el +++ b/lisp/simple.el | |||
| @@ -3492,10 +3492,11 @@ the use of a shell (with its need to quote arguments)." | |||
| 3492 | (save-match-data | 3492 | (save-match-data |
| 3493 | (if (string-match "[ \t]*&[ \t]*\\'" command) | 3493 | (if (string-match "[ \t]*&[ \t]*\\'" command) |
| 3494 | ;; Command ending with ampersand means asynchronous. | 3494 | ;; Command ending with ampersand means asynchronous. |
| 3495 | (let ((buffer (get-buffer-create | 3495 | (let* ((buffer (get-buffer-create |
| 3496 | (or output-buffer "*Async Shell Command*"))) | 3496 | (or output-buffer "*Async Shell Command*"))) |
| 3497 | (directory default-directory) | 3497 | (bname (buffer-name buffer)) |
| 3498 | proc) | 3498 | (directory default-directory) |
| 3499 | proc) | ||
| 3499 | ;; Remove the ampersand. | 3500 | ;; Remove the ampersand. |
| 3500 | (setq command (substring command 0 (match-beginning 0))) | 3501 | (setq command (substring command 0 (match-beginning 0))) |
| 3501 | ;; Ask the user what to do with already running process. | 3502 | ;; Ask the user what to do with already running process. |
| @@ -3510,30 +3511,24 @@ the use of a shell (with its need to quote arguments)." | |||
| 3510 | ((eq async-shell-command-buffer 'confirm-new-buffer) | 3511 | ((eq async-shell-command-buffer 'confirm-new-buffer) |
| 3511 | ;; If will create a new buffer, query first. | 3512 | ;; If will create a new buffer, query first. |
| 3512 | (if (yes-or-no-p "A command is running in the default buffer. Use a new buffer? ") | 3513 | (if (yes-or-no-p "A command is running in the default buffer. Use a new buffer? ") |
| 3513 | (setq buffer (generate-new-buffer | 3514 | (setq buffer (generate-new-buffer bname)) |
| 3514 | (or (and (bufferp output-buffer) (buffer-name output-buffer)) | ||
| 3515 | output-buffer "*Async Shell Command*"))) | ||
| 3516 | (error "Shell command in progress"))) | 3515 | (error "Shell command in progress"))) |
| 3517 | ((eq async-shell-command-buffer 'new-buffer) | 3516 | ((eq async-shell-command-buffer 'new-buffer) |
| 3518 | ;; It will create a new buffer. | 3517 | ;; It will create a new buffer. |
| 3519 | (setq buffer (generate-new-buffer | 3518 | (setq buffer (generate-new-buffer bname))) |
| 3520 | (or (and (bufferp output-buffer) (buffer-name output-buffer)) | ||
| 3521 | output-buffer "*Async Shell Command*")))) | ||
| 3522 | ((eq async-shell-command-buffer 'confirm-rename-buffer) | 3519 | ((eq async-shell-command-buffer 'confirm-rename-buffer) |
| 3523 | ;; If will rename the buffer, query first. | 3520 | ;; If will rename the buffer, query first. |
| 3524 | (if (yes-or-no-p "A command is running in the default buffer. Rename it? ") | 3521 | (if (yes-or-no-p "A command is running in the default buffer. Rename it? ") |
| 3525 | (progn | 3522 | (progn |
| 3526 | (with-current-buffer buffer | 3523 | (with-current-buffer buffer |
| 3527 | (rename-uniquely)) | 3524 | (rename-uniquely)) |
| 3528 | (setq buffer (get-buffer-create | 3525 | (setq buffer (get-buffer-create bname))) |
| 3529 | (or output-buffer "*Async Shell Command*")))) | ||
| 3530 | (error "Shell command in progress"))) | 3526 | (error "Shell command in progress"))) |
| 3531 | ((eq async-shell-command-buffer 'rename-buffer) | 3527 | ((eq async-shell-command-buffer 'rename-buffer) |
| 3532 | ;; It will rename the buffer. | 3528 | ;; It will rename the buffer. |
| 3533 | (with-current-buffer buffer | 3529 | (with-current-buffer buffer |
| 3534 | (rename-uniquely)) | 3530 | (rename-uniquely)) |
| 3535 | (setq buffer (get-buffer-create | 3531 | (setq buffer (get-buffer-create bname))))) |
| 3536 | (or output-buffer "*Async Shell Command*")))))) | ||
| 3537 | (with-current-buffer buffer | 3532 | (with-current-buffer buffer |
| 3538 | (shell-command--save-pos-or-erase) | 3533 | (shell-command--save-pos-or-erase) |
| 3539 | (setq default-directory directory) | 3534 | (setq default-directory directory) |
| @@ -3542,19 +3537,18 @@ the use of a shell (with its need to quote arguments)." | |||
| 3542 | (setq mode-line-process '(":%s")) | 3537 | (setq mode-line-process '(":%s")) |
| 3543 | (require 'shell) (shell-mode) | 3538 | (require 'shell) (shell-mode) |
| 3544 | (set-process-sentinel proc 'shell-command-sentinel) | 3539 | (set-process-sentinel proc 'shell-command-sentinel) |
| 3545 | ;; Use the comint filter for proper handling of carriage motion | 3540 | ;; Use the comint filter for proper handling of |
| 3546 | ;; (see `comint-inhibit-carriage-motion'),. | 3541 | ;; carriage motion (see comint-inhibit-carriage-motion). |
| 3547 | (set-process-filter proc 'comint-output-filter) | 3542 | (set-process-filter proc 'comint-output-filter) |
| 3548 | (if async-shell-command-display-buffer | 3543 | (if async-shell-command-display-buffer |
| 3549 | (display-buffer buffer '(nil (allow-no-window . t))) | 3544 | (display-buffer buffer '(nil (allow-no-window . t))) |
| 3550 | (add-function :before (process-filter proc) | 3545 | (add-function :before (process-filter proc) |
| 3551 | `(lambda (process string) | 3546 | (lambda (process _string) |
| 3552 | (when (and (= 0 (buffer-size (process-buffer process))) | 3547 | (let ((buf (process-buffer process))) |
| 3553 | (string= (buffer-name (process-buffer process)) | 3548 | (when (and (zerop (buffer-size buf)) |
| 3554 | ,(or output-buffer "*Async Shell Command*"))) | 3549 | (string= (buffer-name buf) |
| 3555 | (display-buffer (process-buffer process)))) | 3550 | bname)) |
| 3556 | )) | 3551 | (display-buffer buf)))))))) |
| 3557 | )) | ||
| 3558 | ;; Otherwise, command is executed synchronously. | 3552 | ;; Otherwise, command is executed synchronously. |
| 3559 | (shell-command-on-region (point) (point) command | 3553 | (shell-command-on-region (point) (point) command |
| 3560 | output-buffer nil error-buffer))))))) | 3554 | output-buffer nil error-buffer))))))) |
diff --git a/lisp/textmodes/reftex-index.el b/lisp/textmodes/reftex-index.el index 120370a149a..811d1477ada 100644 --- a/lisp/textmodes/reftex-index.el +++ b/lisp/textmodes/reftex-index.el | |||
| @@ -474,7 +474,7 @@ With prefix 3, restrict index to region." | |||
| 474 | 474 | ||
| 475 | (interactive) | 475 | (interactive) |
| 476 | 476 | ||
| 477 | ;; Ensure access to scanning info and rescan buffer if prefix are is '(4). | 477 | ;; Ensure access to scanning info and rescan buffer if prefix arg is '(4). |
| 478 | (let ((current-prefix-arg current-prefix-arg)) | 478 | (let ((current-prefix-arg current-prefix-arg)) |
| 479 | (reftex-ensure-index-support t) | 479 | (reftex-ensure-index-support t) |
| 480 | (reftex-access-scan-info current-prefix-arg)) | 480 | (reftex-access-scan-info current-prefix-arg)) |
diff --git a/lisp/textmodes/reftex-ref.el b/lisp/textmodes/reftex-ref.el index f9f23201b43..8d69d8feda5 100644 --- a/lisp/textmodes/reftex-ref.el +++ b/lisp/textmodes/reftex-ref.el | |||
| @@ -134,7 +134,7 @@ This function is controlled by the settings of reftex-insert-label-flags." | |||
| 134 | 134 | ||
| 135 | (interactive) | 135 | (interactive) |
| 136 | 136 | ||
| 137 | ;; Ensure access to scanning info and rescan buffer if prefix are is '(4). | 137 | ;; Ensure access to scanning info and rescan buffer if prefix arg is '(4). |
| 138 | (reftex-access-scan-info current-prefix-arg) | 138 | (reftex-access-scan-info current-prefix-arg) |
| 139 | 139 | ||
| 140 | ;; Find out what kind of environment this is and abort if necessary. | 140 | ;; Find out what kind of environment this is and abort if necessary. |
diff --git a/lisp/textmodes/reftex-toc.el b/lisp/textmodes/reftex-toc.el index c7a598c920d..c694fafcd52 100644 --- a/lisp/textmodes/reftex-toc.el +++ b/lisp/textmodes/reftex-toc.el | |||
| @@ -216,7 +216,7 @@ When called with a raw C-u prefix, rescan the document first." | |||
| 216 | (or reftex-support-index | 216 | (or reftex-support-index |
| 217 | (setq reftex-toc-include-index-entries nil)) | 217 | (setq reftex-toc-include-index-entries nil)) |
| 218 | 218 | ||
| 219 | ;; Ensure access to scanning info and rescan buffer if prefix are is '(4) | 219 | ;; Ensure access to scanning info and rescan buffer if prefix arg is '(4) |
| 220 | (reftex-access-scan-info current-prefix-arg) | 220 | (reftex-access-scan-info current-prefix-arg) |
| 221 | 221 | ||
| 222 | (let* ((this-buf (current-buffer)) | 222 | (let* ((this-buf (current-buffer)) |
diff --git a/lisp/textmodes/tex-mode.el b/lisp/textmodes/tex-mode.el index 3da6e4e1124..10ee10243ad 100644 --- a/lisp/textmodes/tex-mode.el +++ b/lisp/textmodes/tex-mode.el | |||
| @@ -3512,7 +3512,8 @@ There might be text before point." | |||
| 3512 | (lambda (process _event) | 3512 | (lambda (process _event) |
| 3513 | (when (eq (process-status process) 'exit) | 3513 | (when (eq (process-status process) 'exit) |
| 3514 | (unwind-protect | 3514 | (unwind-protect |
| 3515 | (when (eq process tex-chktex--process) | 3515 | (when (eq process |
| 3516 | (with-current-buffer source tex-chktex--process)) | ||
| 3516 | (with-current-buffer (process-buffer process) | 3517 | (with-current-buffer (process-buffer process) |
| 3517 | (goto-char (point-min)) | 3518 | (goto-char (point-min)) |
| 3518 | (cl-loop | 3519 | (cl-loop |
diff --git a/lisp/vc/ediff.el b/lisp/vc/ediff.el index d0f8e63dcb1..0adf51328e2 100644 --- a/lisp/vc/ediff.el +++ b/lisp/vc/ediff.el | |||
| @@ -185,7 +185,9 @@ | |||
| 185 | 185 | ||
| 186 | ;;;###autoload | 186 | ;;;###autoload |
| 187 | (defun ediff-files (file-A file-B &optional startup-hooks) | 187 | (defun ediff-files (file-A file-B &optional startup-hooks) |
| 188 | "Run Ediff on a pair of files, FILE-A and FILE-B." | 188 | "Run Ediff on a pair of files, FILE-A and FILE-B. |
| 189 | STARTUP-HOOKS is a list of functions that Emacs calls without | ||
| 190 | arguments after setting up the Ediff buffers." | ||
| 189 | (interactive | 191 | (interactive |
| 190 | (let ((dir-A (if ediff-use-last-dir | 192 | (let ((dir-A (if ediff-use-last-dir |
| 191 | ediff-last-dir-A | 193 | ediff-last-dir-A |
| @@ -221,7 +223,9 @@ | |||
| 221 | 223 | ||
| 222 | ;;;###autoload | 224 | ;;;###autoload |
| 223 | (defun ediff-files3 (file-A file-B file-C &optional startup-hooks) | 225 | (defun ediff-files3 (file-A file-B file-C &optional startup-hooks) |
| 224 | "Run Ediff on three files, FILE-A, FILE-B, and FILE-C." | 226 | "Run Ediff on three files, FILE-A, FILE-B, and FILE-C. |
| 227 | STARTUP-HOOKS is a list of functions that Emacs calls without | ||
| 228 | arguments after setting up the Ediff buffers." | ||
| 225 | (interactive | 229 | (interactive |
| 226 | (let ((dir-A (if ediff-use-last-dir | 230 | (let ((dir-A (if ediff-use-last-dir |
| 227 | ediff-last-dir-A | 231 | ediff-last-dir-A |
| @@ -419,7 +423,14 @@ If this file is a backup, `ediff' it with its original." | |||
| 419 | 423 | ||
| 420 | ;;;###autoload | 424 | ;;;###autoload |
| 421 | (defun ediff-buffers (buffer-A buffer-B &optional startup-hooks job-name) | 425 | (defun ediff-buffers (buffer-A buffer-B &optional startup-hooks job-name) |
| 422 | "Run Ediff on a pair of buffers, BUFFER-A and BUFFER-B." | 426 | "Run Ediff on a pair of buffers, BUFFER-A and BUFFER-B. |
| 427 | STARTUP-HOOKS is a list of functions that Emacs calls without | ||
| 428 | arguments after setting up the Ediff buffers. JOB-NAME is a | ||
| 429 | symbol describing the Ediff job type; it defaults to | ||
| 430 | `ediff-buffers', but can also be one of | ||
| 431 | `ediff-merge-files-with-ancestor', `ediff-last-dir-ancestor', | ||
| 432 | `ediff-last-dir-C', `ediff-buffers3', `ediff-merge-buffers', or | ||
| 433 | `ediff-merge-buffers-with-ancestor'." | ||
| 423 | (interactive | 434 | (interactive |
| 424 | (let (bf) | 435 | (let (bf) |
| 425 | (list (setq bf (read-buffer "Buffer A to compare: " | 436 | (list (setq bf (read-buffer "Buffer A to compare: " |
| @@ -441,7 +452,14 @@ If this file is a backup, `ediff' it with its original." | |||
| 441 | ;;;###autoload | 452 | ;;;###autoload |
| 442 | (defun ediff-buffers3 (buffer-A buffer-B buffer-C | 453 | (defun ediff-buffers3 (buffer-A buffer-B buffer-C |
| 443 | &optional startup-hooks job-name) | 454 | &optional startup-hooks job-name) |
| 444 | "Run Ediff on three buffers, BUFFER-A, BUFFER-B, and BUFFER-C." | 455 | "Run Ediff on three buffers, BUFFER-A, BUFFER-B, and BUFFER-C. |
| 456 | STARTUP-HOOKS is a list of functions that Emacs calls without | ||
| 457 | arguments after setting up the Ediff buffers. JOB-NAME is a | ||
| 458 | symbol describing the Ediff job type; it defaults to | ||
| 459 | `ediff-buffers3', but can also be one of | ||
| 460 | `ediff-merge-files-with-ancestor', `ediff-last-dir-ancestor', | ||
| 461 | `ediff-last-dir-C', `ediff-buffers', `ediff-merge-buffers', or | ||
| 462 | `ediff-merge-buffers-with-ancestor'." | ||
| 445 | (interactive | 463 | (interactive |
| 446 | (let (bf bff) | 464 | (let (bf bff) |
| 447 | (list (setq bf (read-buffer "Buffer A to compare: " | 465 | (list (setq bf (read-buffer "Buffer A to compare: " |
| @@ -637,7 +655,8 @@ regular expression; only file names that match the regexp are considered." | |||
| 637 | (defun ediff-merge-directories (dir1 dir2 regexp &optional merge-autostore-dir) | 655 | (defun ediff-merge-directories (dir1 dir2 regexp &optional merge-autostore-dir) |
| 638 | "Run Ediff on a pair of directories, DIR1 and DIR2, merging files that have | 656 | "Run Ediff on a pair of directories, DIR1 and DIR2, merging files that have |
| 639 | the same name in both. The third argument, REGEXP, is nil or a regular | 657 | the same name in both. The third argument, REGEXP, is nil or a regular |
| 640 | expression; only file names that match the regexp are considered." | 658 | expression; only file names that match the regexp are considered. |
| 659 | MERGE-AUTOSTORE-DIR is the directory in which to store merged files." | ||
| 641 | (interactive | 660 | (interactive |
| 642 | (let ((dir-A (ediff-get-default-directory-name)) | 661 | (let ((dir-A (ediff-get-default-directory-name)) |
| 643 | (default-regexp (eval ediff-default-filtering-regexp)) | 662 | (default-regexp (eval ediff-default-filtering-regexp)) |
| @@ -674,7 +693,8 @@ expression; only file names that match the regexp are considered." | |||
| 674 | Ediff merges files that have identical names in DIR1, DIR2. If a pair of files | 693 | Ediff merges files that have identical names in DIR1, DIR2. If a pair of files |
| 675 | in DIR1 and DIR2 doesn't have an ancestor in ANCESTOR-DIR, Ediff will merge | 694 | in DIR1 and DIR2 doesn't have an ancestor in ANCESTOR-DIR, Ediff will merge |
| 676 | without ancestor. The fourth argument, REGEXP, is nil or a regular expression; | 695 | without ancestor. The fourth argument, REGEXP, is nil or a regular expression; |
| 677 | only file names that match the regexp are considered." | 696 | only file names that match the regexp are considered. |
| 697 | MERGE-AUTOSTORE-DIR is the directory in which to store merged files." | ||
| 678 | (interactive | 698 | (interactive |
| 679 | (let ((dir-A (ediff-get-default-directory-name)) | 699 | (let ((dir-A (ediff-get-default-directory-name)) |
| 680 | (default-regexp (eval ediff-default-filtering-regexp)) | 700 | (default-regexp (eval ediff-default-filtering-regexp)) |
| @@ -710,7 +730,8 @@ only file names that match the regexp are considered." | |||
| 710 | &optional merge-autostore-dir) | 730 | &optional merge-autostore-dir) |
| 711 | "Run Ediff on a directory, DIR1, merging its files with their revisions. | 731 | "Run Ediff on a directory, DIR1, merging its files with their revisions. |
| 712 | The second argument, REGEXP, is a regular expression that filters the file | 732 | The second argument, REGEXP, is a regular expression that filters the file |
| 713 | names. Only the files that are under revision control are taken into account." | 733 | names. Only the files that are under revision control are taken into account. |
| 734 | MERGE-AUTOSTORE-DIR is the directory in which to store merged files." | ||
| 714 | (interactive | 735 | (interactive |
| 715 | (let ((dir-A (ediff-get-default-directory-name)) | 736 | (let ((dir-A (ediff-get-default-directory-name)) |
| 716 | (default-regexp (eval ediff-default-filtering-regexp)) | 737 | (default-regexp (eval ediff-default-filtering-regexp)) |
| @@ -740,7 +761,8 @@ names. Only the files that are under revision control are taken into account." | |||
| 740 | merge-autostore-dir) | 761 | merge-autostore-dir) |
| 741 | "Run Ediff on a directory, DIR1, merging its files with their revisions and ancestors. | 762 | "Run Ediff on a directory, DIR1, merging its files with their revisions and ancestors. |
| 742 | The second argument, REGEXP, is a regular expression that filters the file | 763 | The second argument, REGEXP, is a regular expression that filters the file |
| 743 | names. Only the files that are under revision control are taken into account." | 764 | names. Only the files that are under revision control are taken into account. |
| 765 | MERGE-AUTOSTORE-DIR is the directory in which to store merged files." | ||
| 744 | (interactive | 766 | (interactive |
| 745 | (let ((dir-A (ediff-get-default-directory-name)) | 767 | (let ((dir-A (ediff-get-default-directory-name)) |
| 746 | (default-regexp (eval ediff-default-filtering-regexp)) | 768 | (default-regexp (eval ediff-default-filtering-regexp)) |
| @@ -908,7 +930,9 @@ names. Only the files that are under revision control are taken into account." | |||
| 908 | With prefix argument, DUMB-MODE, or on a non-windowing display, works as | 930 | With prefix argument, DUMB-MODE, or on a non-windowing display, works as |
| 909 | follows: | 931 | follows: |
| 910 | If WIND-A is nil, use selected window. | 932 | If WIND-A is nil, use selected window. |
| 911 | If WIND-B is nil, use window next to WIND-A." | 933 | If WIND-B is nil, use window next to WIND-A. |
| 934 | STARTUP-HOOKS is a list of functions that Emacs calls without | ||
| 935 | arguments after setting up the Ediff buffers." | ||
| 912 | (interactive "P") | 936 | (interactive "P") |
| 913 | (ediff-windows dumb-mode wind-A wind-B | 937 | (ediff-windows dumb-mode wind-A wind-B |
| 914 | startup-hooks 'ediff-windows-wordwise 'word-mode)) | 938 | startup-hooks 'ediff-windows-wordwise 'word-mode)) |
| @@ -919,7 +943,9 @@ If WIND-B is nil, use window next to WIND-A." | |||
| 919 | With prefix argument, DUMB-MODE, or on a non-windowing display, works as | 943 | With prefix argument, DUMB-MODE, or on a non-windowing display, works as |
| 920 | follows: | 944 | follows: |
| 921 | If WIND-A is nil, use selected window. | 945 | If WIND-A is nil, use selected window. |
| 922 | If WIND-B is nil, use window next to WIND-A." | 946 | If WIND-B is nil, use window next to WIND-A. |
| 947 | STARTUP-HOOKS is a list of functions that Emacs calls without | ||
| 948 | arguments after setting up the Ediff buffers." | ||
| 923 | (interactive "P") | 949 | (interactive "P") |
| 924 | (ediff-windows dumb-mode wind-A wind-B | 950 | (ediff-windows dumb-mode wind-A wind-B |
| 925 | startup-hooks 'ediff-windows-linewise nil)) | 951 | startup-hooks 'ediff-windows-linewise nil)) |
| @@ -963,9 +989,12 @@ If WIND-B is nil, use window next to WIND-A." | |||
| 963 | ;;;###autoload | 989 | ;;;###autoload |
| 964 | (defun ediff-regions-wordwise (buffer-A buffer-B &optional startup-hooks) | 990 | (defun ediff-regions-wordwise (buffer-A buffer-B &optional startup-hooks) |
| 965 | "Run Ediff on a pair of regions in specified buffers. | 991 | "Run Ediff on a pair of regions in specified buffers. |
| 992 | BUFFER-A and BUFFER-B are the buffers to be compared. | ||
| 966 | Regions (i.e., point and mark) can be set in advance or marked interactively. | 993 | Regions (i.e., point and mark) can be set in advance or marked interactively. |
| 967 | This function is effective only for relatively small regions, up to 200 | 994 | This function is effective only for relatively small regions, up to 200 |
| 968 | lines. For large regions, use `ediff-regions-linewise'." | 995 | lines. For large regions, use `ediff-regions-linewise'. |
| 996 | STARTUP-HOOKS is a list of functions that Emacs calls without | ||
| 997 | arguments after setting up the Ediff buffers." | ||
| 969 | (interactive | 998 | (interactive |
| 970 | (let (bf) | 999 | (let (bf) |
| 971 | (list (setq bf (read-buffer "Region's A buffer: " | 1000 | (list (setq bf (read-buffer "Region's A buffer: " |
| @@ -1003,10 +1032,13 @@ lines. For large regions, use `ediff-regions-linewise'." | |||
| 1003 | ;;;###autoload | 1032 | ;;;###autoload |
| 1004 | (defun ediff-regions-linewise (buffer-A buffer-B &optional startup-hooks) | 1033 | (defun ediff-regions-linewise (buffer-A buffer-B &optional startup-hooks) |
| 1005 | "Run Ediff on a pair of regions in specified buffers. | 1034 | "Run Ediff on a pair of regions in specified buffers. |
| 1035 | BUFFER-A and BUFFER-B are the buffers to be compared. | ||
| 1006 | Regions (i.e., point and mark) can be set in advance or marked interactively. | 1036 | Regions (i.e., point and mark) can be set in advance or marked interactively. |
| 1007 | Each region is enlarged to contain full lines. | 1037 | Each region is enlarged to contain full lines. |
| 1008 | This function is effective for large regions, over 100-200 | 1038 | This function is effective for large regions, over 100-200 |
| 1009 | lines. For small regions, use `ediff-regions-wordwise'." | 1039 | lines. For small regions, use `ediff-regions-wordwise'. |
| 1040 | STARTUP-HOOKS is a list of functions that Emacs calls without | ||
| 1041 | arguments after setting up the Ediff buffers." | ||
| 1010 | (interactive | 1042 | (interactive |
| 1011 | (let (bf) | 1043 | (let (bf) |
| 1012 | (list (setq bf (read-buffer "Region A's buffer: " | 1044 | (list (setq bf (read-buffer "Region A's buffer: " |
| @@ -1127,7 +1159,11 @@ lines. For small regions, use `ediff-regions-wordwise'." | |||
| 1127 | ;; MERGE-BUFFER-FILE is the file to be | 1159 | ;; MERGE-BUFFER-FILE is the file to be |
| 1128 | ;; associated with the merge buffer | 1160 | ;; associated with the merge buffer |
| 1129 | &optional startup-hooks merge-buffer-file) | 1161 | &optional startup-hooks merge-buffer-file) |
| 1130 | "Merge two files without ancestor." | 1162 | "Merge two files without ancestor. |
| 1163 | FILE-A and FILE-B are the names of the files to be merged. | ||
| 1164 | STARTUP-HOOKS is a list of functions that Emacs calls without | ||
| 1165 | arguments after setting up the Ediff buffers. MERGE-BUFFER-FILE | ||
| 1166 | is the name of the file to be associated with the merge buffer.." | ||
| 1131 | (interactive | 1167 | (interactive |
| 1132 | (let ((dir-A (if ediff-use-last-dir | 1168 | (let ((dir-A (if ediff-use-last-dir |
| 1133 | ediff-last-dir-A | 1169 | ediff-last-dir-A |
| @@ -1171,7 +1207,12 @@ lines. For small regions, use `ediff-regions-wordwise'." | |||
| 1171 | ;; to be associated with the | 1207 | ;; to be associated with the |
| 1172 | ;; merge buffer | 1208 | ;; merge buffer |
| 1173 | merge-buffer-file) | 1209 | merge-buffer-file) |
| 1174 | "Merge two files with ancestor." | 1210 | "Merge two files with ancestor. |
| 1211 | FILE-A and FILE-B are the names of the files to be merged, and | ||
| 1212 | FILE-ANCESTOR is the name of the ancestor file. STARTUP-HOOKS is | ||
| 1213 | a list of functions that Emacs calls without arguments after | ||
| 1214 | setting up the Ediff buffers. MERGE-BUFFER-FILE is the name of | ||
| 1215 | the file to be associated with the merge buffer." | ||
| 1175 | (interactive | 1216 | (interactive |
| 1176 | (let ((dir-A (if ediff-use-last-dir | 1217 | (let ((dir-A (if ediff-use-last-dir |
| 1177 | ediff-last-dir-A | 1218 | ediff-last-dir-A |
| @@ -1229,7 +1270,16 @@ lines. For small regions, use `ediff-regions-wordwise'." | |||
| 1229 | ;; MERGE-BUFFER-FILE is the file to be | 1270 | ;; MERGE-BUFFER-FILE is the file to be |
| 1230 | ;; associated with the merge buffer | 1271 | ;; associated with the merge buffer |
| 1231 | startup-hooks job-name merge-buffer-file) | 1272 | startup-hooks job-name merge-buffer-file) |
| 1232 | "Merge buffers without ancestor." | 1273 | "Merge buffers without ancestor. |
| 1274 | BUFFER-A and BUFFER-B are the buffers to be merged. | ||
| 1275 | STARTUP-HOOKS is a list of functions that Emacs calls without | ||
| 1276 | arguments after setting up the Ediff buffers. JOB-NAME is a | ||
| 1277 | symbol describing the Ediff job type; it defaults to | ||
| 1278 | `ediff-merge-buffers', but can also be one of | ||
| 1279 | `ediff-merge-files-with-ancestor', `ediff-last-dir-ancestor', | ||
| 1280 | `ediff-last-dir-C', `ediff-buffers', `ediff-buffers3', or | ||
| 1281 | `ediff-merge-buffers-with-ancestor'. MERGE-BUFFER-FILE is the | ||
| 1282 | name of the file to be associated with the merge buffer." | ||
| 1233 | (interactive | 1283 | (interactive |
| 1234 | (let (bf) | 1284 | (let (bf) |
| 1235 | (list (setq bf (read-buffer "Buffer A to merge: " | 1285 | (list (setq bf (read-buffer "Buffer A to merge: " |
| @@ -1256,7 +1306,16 @@ lines. For small regions, use `ediff-regions-wordwise'." | |||
| 1256 | ;; file to be associated | 1306 | ;; file to be associated |
| 1257 | ;; with the merge buffer | 1307 | ;; with the merge buffer |
| 1258 | merge-buffer-file) | 1308 | merge-buffer-file) |
| 1259 | "Merge buffers with ancestor." | 1309 | "Merge buffers with ancestor. |
| 1310 | BUFFER-A and BUFFER-B are the buffers to be merged, and | ||
| 1311 | BUFFER-ANCESTOR is their ancestor. STARTUP-HOOKS is a list of | ||
| 1312 | functions that Emacs calls without arguments after setting up the | ||
| 1313 | Ediff buffers. JOB-NAME is a symbol describing the Ediff job | ||
| 1314 | type; it defaults to `ediff-merge-buffers-with-ancestor', but can | ||
| 1315 | also be one of `ediff-merge-files-with-ancestor', | ||
| 1316 | `ediff-last-dir-ancestor', `ediff-last-dir-C', `ediff-buffers', | ||
| 1317 | `ediff-buffers3', or `ediff-merge-buffers'. MERGE-BUFFER-FILE is | ||
| 1318 | the name of the file to be associated with the merge buffer." | ||
| 1260 | (interactive | 1319 | (interactive |
| 1261 | (let (bf bff) | 1320 | (let (bf bff) |
| 1262 | (list (setq bf (read-buffer "Buffer A to merge: " | 1321 | (list (setq bf (read-buffer "Buffer A to merge: " |
| @@ -1287,8 +1346,11 @@ lines. For small regions, use `ediff-regions-wordwise'." | |||
| 1287 | (defun ediff-merge-revisions (&optional file startup-hooks merge-buffer-file) | 1346 | (defun ediff-merge-revisions (&optional file startup-hooks merge-buffer-file) |
| 1288 | ;; MERGE-BUFFER-FILE is the file to be associated with the merge buffer | 1347 | ;; MERGE-BUFFER-FILE is the file to be associated with the merge buffer |
| 1289 | "Run Ediff by merging two revisions of a file. | 1348 | "Run Ediff by merging two revisions of a file. |
| 1290 | The file is the optional FILE argument or the file visited by the current | 1349 | The file is the optional FILE argument or the file visited by the |
| 1291 | buffer." | 1350 | current buffer. STARTUP-HOOKS is a list of functions that Emacs |
| 1351 | calls without arguments after setting up the Ediff buffers. | ||
| 1352 | MERGE-BUFFER-FILE is the name of the file to be associated with | ||
| 1353 | the merge buffer." | ||
| 1292 | (interactive) | 1354 | (interactive) |
| 1293 | (if (stringp file) (find-file file)) | 1355 | (if (stringp file) (find-file file)) |
| 1294 | (let (rev1 rev2) | 1356 | (let (rev1 rev2) |
| @@ -1319,8 +1381,11 @@ buffer." | |||
| 1319 | ;; buffer | 1381 | ;; buffer |
| 1320 | merge-buffer-file) | 1382 | merge-buffer-file) |
| 1321 | "Run Ediff by merging two revisions of a file with a common ancestor. | 1383 | "Run Ediff by merging two revisions of a file with a common ancestor. |
| 1322 | The file is the optional FILE argument or the file visited by the current | 1384 | The file is the optional FILE argument or the file visited by the |
| 1323 | buffer." | 1385 | current buffer. STARTUP-HOOKS is a list of functions that Emacs |
| 1386 | calls without arguments after setting up the Ediff buffers. | ||
| 1387 | MERGE-BUFFER-FILE is the name of the file to be associated with | ||
| 1388 | the merge buffer." | ||
| 1324 | (interactive) | 1389 | (interactive) |
| 1325 | (if (stringp file) (find-file file)) | 1390 | (if (stringp file) (find-file file)) |
| 1326 | (let (rev1 rev2 ancestor-rev) | 1391 | (let (rev1 rev2 ancestor-rev) |
| @@ -1360,8 +1425,8 @@ buffer." | |||
| 1360 | "Query for a file name, and then run Ediff by patching that file. | 1425 | "Query for a file name, and then run Ediff by patching that file. |
| 1361 | If optional PATCH-BUF is given, use the patch in that buffer | 1426 | If optional PATCH-BUF is given, use the patch in that buffer |
| 1362 | and don't ask the user. | 1427 | and don't ask the user. |
| 1363 | If prefix argument, then: if even argument, assume that the patch is in a | 1428 | If prefix argument ARG, then: if even argument, assume that the |
| 1364 | buffer. If odd -- assume it is in a file." | 1429 | patch is in a buffer. If odd -- assume it is in a file." |
| 1365 | (interactive "P") | 1430 | (interactive "P") |
| 1366 | (let (source-dir source-file) | 1431 | (let (source-dir source-file) |
| 1367 | (require 'ediff-ptch) | 1432 | (require 'ediff-ptch) |
| @@ -1394,7 +1459,7 @@ prompts for the buffer or a file, depending on the answer. | |||
| 1394 | With ARG=1, assumes the patch is in a file and prompts for the file. | 1459 | With ARG=1, assumes the patch is in a file and prompts for the file. |
| 1395 | With ARG=2, assumes the patch is in a buffer and prompts for the buffer. | 1460 | With ARG=2, assumes the patch is in a buffer and prompts for the buffer. |
| 1396 | PATCH-BUF is an optional argument, which specifies the buffer that contains the | 1461 | PATCH-BUF is an optional argument, which specifies the buffer that contains the |
| 1397 | patch. If not given, the user is prompted according to the prefix argument." | 1462 | patch. If not given, the user is prompted according to the prefix argument." |
| 1398 | (interactive "P") | 1463 | (interactive "P") |
| 1399 | (require 'ediff-ptch) | 1464 | (require 'ediff-ptch) |
| 1400 | (setq patch-buf | 1465 | (setq patch-buf |
| @@ -1421,7 +1486,9 @@ patch. If not given, the user is prompted according to the prefix argument." | |||
| 1421 | "Run Ediff by comparing versions of a file. | 1486 | "Run Ediff by comparing versions of a file. |
| 1422 | The file is an optional FILE argument or the file entered at the prompt. | 1487 | The file is an optional FILE argument or the file entered at the prompt. |
| 1423 | Default: the file visited by the current buffer. | 1488 | Default: the file visited by the current buffer. |
| 1424 | Uses `vc.el' or `rcs.el' depending on `ediff-version-control-package'." | 1489 | Uses `vc.el' or `rcs.el' depending on `ediff-version-control-package'. |
| 1490 | STARTUP-HOOKS is a list of functions that Emacs calls without | ||
| 1491 | arguments after setting up the Ediff buffers." | ||
| 1425 | ;; if buffer is non-nil, use that buffer instead of the current buffer | 1492 | ;; if buffer is non-nil, use that buffer instead of the current buffer |
| 1426 | (interactive "P") | 1493 | (interactive "P") |
| 1427 | (if (not (stringp file)) | 1494 | (if (not (stringp file)) |
| @@ -1434,7 +1501,7 @@ Uses `vc.el' or `rcs.el' depending on `ediff-version-control-package'." | |||
| 1434 | 'no-dirs))) | 1501 | 'no-dirs))) |
| 1435 | (find-file file) | 1502 | (find-file file) |
| 1436 | (if (and (buffer-modified-p) | 1503 | (if (and (buffer-modified-p) |
| 1437 | (y-or-n-p (format "Buffer %s is modified. Save buffer? " | 1504 | (y-or-n-p (format "Buffer %s is modified. Save buffer? " |
| 1438 | (buffer-name)))) | 1505 | (buffer-name)))) |
| 1439 | (save-buffer (current-buffer))) | 1506 | (save-buffer (current-buffer))) |
| 1440 | (let (rev1 rev2) | 1507 | (let (rev1 rev2) |
| @@ -1517,6 +1584,7 @@ With optional NODE, goes to that node." | |||
| 1517 | 1584 | ||
| 1518 | ;;;###autoload | 1585 | ;;;###autoload |
| 1519 | (defun ediff-files-command () | 1586 | (defun ediff-files-command () |
| 1587 | "Call `ediff-files' with the next two command line arguments." | ||
| 1520 | (let ((file-a (nth 0 command-line-args-left)) | 1588 | (let ((file-a (nth 0 command-line-args-left)) |
| 1521 | (file-b (nth 1 command-line-args-left))) | 1589 | (file-b (nth 1 command-line-args-left))) |
| 1522 | (setq command-line-args-left (nthcdr 2 command-line-args-left)) | 1590 | (setq command-line-args-left (nthcdr 2 command-line-args-left)) |
| @@ -1524,6 +1592,7 @@ With optional NODE, goes to that node." | |||
| 1524 | 1592 | ||
| 1525 | ;;;###autoload | 1593 | ;;;###autoload |
| 1526 | (defun ediff3-files-command () | 1594 | (defun ediff3-files-command () |
| 1595 | "Call `ediff3-files' with the next three command line arguments." | ||
| 1527 | (let ((file-a (nth 0 command-line-args-left)) | 1596 | (let ((file-a (nth 0 command-line-args-left)) |
| 1528 | (file-b (nth 1 command-line-args-left)) | 1597 | (file-b (nth 1 command-line-args-left)) |
| 1529 | (file-c (nth 2 command-line-args-left))) | 1598 | (file-c (nth 2 command-line-args-left))) |
| @@ -1532,6 +1601,7 @@ With optional NODE, goes to that node." | |||
| 1532 | 1601 | ||
| 1533 | ;;;###autoload | 1602 | ;;;###autoload |
| 1534 | (defun ediff-merge-command () | 1603 | (defun ediff-merge-command () |
| 1604 | "Call `ediff-merge-files' with the next two command line arguments." | ||
| 1535 | (let ((file-a (nth 0 command-line-args-left)) | 1605 | (let ((file-a (nth 0 command-line-args-left)) |
| 1536 | (file-b (nth 1 command-line-args-left))) | 1606 | (file-b (nth 1 command-line-args-left))) |
| 1537 | (setq command-line-args-left (nthcdr 2 command-line-args-left)) | 1607 | (setq command-line-args-left (nthcdr 2 command-line-args-left)) |
| @@ -1539,6 +1609,7 @@ With optional NODE, goes to that node." | |||
| 1539 | 1609 | ||
| 1540 | ;;;###autoload | 1610 | ;;;###autoload |
| 1541 | (defun ediff-merge-with-ancestor-command () | 1611 | (defun ediff-merge-with-ancestor-command () |
| 1612 | "Call `ediff-merge-files-with-ancestor' with the next three command line arguments." | ||
| 1542 | (let ((file-a (nth 0 command-line-args-left)) | 1613 | (let ((file-a (nth 0 command-line-args-left)) |
| 1543 | (file-b (nth 1 command-line-args-left)) | 1614 | (file-b (nth 1 command-line-args-left)) |
| 1544 | (ancestor (nth 2 command-line-args-left))) | 1615 | (ancestor (nth 2 command-line-args-left))) |
| @@ -1547,6 +1618,7 @@ With optional NODE, goes to that node." | |||
| 1547 | 1618 | ||
| 1548 | ;;;###autoload | 1619 | ;;;###autoload |
| 1549 | (defun ediff-directories-command () | 1620 | (defun ediff-directories-command () |
| 1621 | "Call `ediff-directories' with the next three command line arguments." | ||
| 1550 | (let ((file-a (nth 0 command-line-args-left)) | 1622 | (let ((file-a (nth 0 command-line-args-left)) |
| 1551 | (file-b (nth 1 command-line-args-left)) | 1623 | (file-b (nth 1 command-line-args-left)) |
| 1552 | (regexp (nth 2 command-line-args-left))) | 1624 | (regexp (nth 2 command-line-args-left))) |
| @@ -1555,6 +1627,7 @@ With optional NODE, goes to that node." | |||
| 1555 | 1627 | ||
| 1556 | ;;;###autoload | 1628 | ;;;###autoload |
| 1557 | (defun ediff-directories3-command () | 1629 | (defun ediff-directories3-command () |
| 1630 | "Call `ediff-directories3' with the next four command line arguments." | ||
| 1558 | (let ((file-a (nth 0 command-line-args-left)) | 1631 | (let ((file-a (nth 0 command-line-args-left)) |
| 1559 | (file-b (nth 1 command-line-args-left)) | 1632 | (file-b (nth 1 command-line-args-left)) |
| 1560 | (file-c (nth 2 command-line-args-left)) | 1633 | (file-c (nth 2 command-line-args-left)) |
| @@ -1564,6 +1637,7 @@ With optional NODE, goes to that node." | |||
| 1564 | 1637 | ||
| 1565 | ;;;###autoload | 1638 | ;;;###autoload |
| 1566 | (defun ediff-merge-directories-command () | 1639 | (defun ediff-merge-directories-command () |
| 1640 | "Call `ediff-merge-directories' with the next three command line arguments." | ||
| 1567 | (let ((file-a (nth 0 command-line-args-left)) | 1641 | (let ((file-a (nth 0 command-line-args-left)) |
| 1568 | (file-b (nth 1 command-line-args-left)) | 1642 | (file-b (nth 1 command-line-args-left)) |
| 1569 | (regexp (nth 2 command-line-args-left))) | 1643 | (regexp (nth 2 command-line-args-left))) |
| @@ -1572,6 +1646,7 @@ With optional NODE, goes to that node." | |||
| 1572 | 1646 | ||
| 1573 | ;;;###autoload | 1647 | ;;;###autoload |
| 1574 | (defun ediff-merge-directories-with-ancestor-command () | 1648 | (defun ediff-merge-directories-with-ancestor-command () |
| 1649 | "Call `ediff-merge-directories-with-ancestor' with the next four command line arguments." | ||
| 1575 | (let ((file-a (nth 0 command-line-args-left)) | 1650 | (let ((file-a (nth 0 command-line-args-left)) |
| 1576 | (file-b (nth 1 command-line-args-left)) | 1651 | (file-b (nth 1 command-line-args-left)) |
| 1577 | (ancestor (nth 2 command-line-args-left)) | 1652 | (ancestor (nth 2 command-line-args-left)) |
diff --git a/lisp/window.el b/lisp/window.el index f87294ceb15..8939e7d589b 100644 --- a/lisp/window.el +++ b/lisp/window.el | |||
| @@ -6465,8 +6465,9 @@ If this is an integer, `split-window-sensibly' may split a window | |||
| 6465 | vertically only if it has at least this many lines. If this is | 6465 | vertically only if it has at least this many lines. If this is |
| 6466 | nil, `split-window-sensibly' is not allowed to split a window | 6466 | nil, `split-window-sensibly' is not allowed to split a window |
| 6467 | vertically. If, however, a window is the only window on its | 6467 | vertically. If, however, a window is the only window on its |
| 6468 | frame, `split-window-sensibly' may split it vertically | 6468 | frame, or all the other ones are dedicated, |
| 6469 | disregarding the value of this variable." | 6469 | `split-window-sensibly' may split it vertically disregarding the |
| 6470 | value of this variable." | ||
| 6470 | :type '(choice (const nil) (integer :tag "lines")) | 6471 | :type '(choice (const nil) (integer :tag "lines")) |
| 6471 | :version "23.1" | 6472 | :version "23.1" |
| 6472 | :group 'windows) | 6473 | :group 'windows) |
| @@ -6573,15 +6574,27 @@ split." | |||
| 6573 | ;; Split window horizontally. | 6574 | ;; Split window horizontally. |
| 6574 | (with-selected-window window | 6575 | (with-selected-window window |
| 6575 | (split-window-right))) | 6576 | (split-window-right))) |
| 6576 | (and (eq window (frame-root-window (window-frame window))) | 6577 | (and |
| 6577 | (not (window-minibuffer-p window)) | 6578 | ;; If WINDOW is the only usable window on its frame (it is |
| 6578 | ;; If WINDOW is the only window on its frame and is not the | 6579 | ;; the only one or, not being the only one, all the other |
| 6579 | ;; minibuffer window, try to split it vertically disregarding | 6580 | ;; ones are dedicated) and is not the minibuffer window, try |
| 6580 | ;; the value of `split-height-threshold'. | 6581 | ;; to split it vertically disregarding the value of |
| 6581 | (let ((split-height-threshold 0)) | 6582 | ;; `split-height-threshold'. |
| 6582 | (when (window-splittable-p window) | 6583 | (let ((frame (window-frame window))) |
| 6583 | (with-selected-window window | 6584 | (or |
| 6584 | (split-window-below)))))))) | 6585 | (eq window (frame-root-window frame)) |
| 6586 | (catch 'done | ||
| 6587 | (walk-window-tree (lambda (w) | ||
| 6588 | (unless (or (eq w window) | ||
| 6589 | (window-dedicated-p w)) | ||
| 6590 | (throw 'done nil))) | ||
| 6591 | frame) | ||
| 6592 | t))) | ||
| 6593 | (not (window-minibuffer-p window)) | ||
| 6594 | (let ((split-height-threshold 0)) | ||
| 6595 | (when (window-splittable-p window) | ||
| 6596 | (with-selected-window window | ||
| 6597 | (split-window-below)))))))) | ||
| 6585 | 6598 | ||
| 6586 | (defun window--try-to-split-window (window &optional alist) | 6599 | (defun window--try-to-split-window (window &optional alist) |
| 6587 | "Try to split WINDOW. | 6600 | "Try to split WINDOW. |