diff options
author | Paul Eggert <eggert@cs.ucla.edu> | 2017-12-02 21:38:05 -0800 |
---|---|---|
committer | Paul Eggert <eggert@cs.ucla.edu> | 2017-12-02 21:38:05 -0800 |
commit | 9d7f0e27e0592132c1b5b9c280192333eaf288b8 (patch) | |
tree | adb2a804b43c535b1dc2c05bf0fd60c51085c683 | |
parent | 4c048aaf06863057b9dd695639f70cc937b02755 (diff) | |
parent | 04e5b28ff1691345e023a944dc6a6a9e9573bd07 (diff) | |
download | emacs-9d7f0e27e0592132c1b5b9c280192333eaf288b8.tar.gz |
Merge from origin/emacs-26
04e5b28ff1 Fix bug in i18n/l10n optimization
8227087194 Let autoload-compute-prefix be set file-locally (Bug#29471)
98ca7d5f26 Improve edit-kbd-macro prompting in case of remapped keys ...
c02c1f6be7 Add tests on electric-indentation and Python multiline str...
946bb6d225 Disable electric indent for python strings (Bug#29305)
35f1ed10e4 ; ChangeLog.2: Fix bug reference.
ac316634e4 Fix buffer overflow in fontname conversion (Bug#29523)
bf9b972843 Fix byte compilation of files with leading directories
ac144dc835 * lisp/files.el (make-backup-file-name-1): Fix scoping error.
1b351c8a47 Revert Tramp commit from 2017-11-20
77cf972592 Improve documentation of buffer-list commands and features
66ec92af00 Fix backing up remote files in local directories on MS-Win...
7e61e74da7 * doc/emacs/mule.texi (Output Coding): Clarify sendmail co...
1e25cd79ff Revert "Fix backing up remote files in local directories o...
f52d79500b Fix a typo in ELisp manual
bf26fc3656 * lisp/composite.el (find-composition): Fix a typo in the ...
-rw-r--r-- | ChangeLog.2 | 2 | ||||
-rw-r--r-- | doc/emacs/buffers.texi | 25 | ||||
-rw-r--r-- | doc/emacs/mule.texi | 15 | ||||
-rw-r--r-- | doc/lispref/sequences.texi | 2 | ||||
-rw-r--r-- | lisp/composite.el | 2 | ||||
-rw-r--r-- | lisp/edmacro.el | 23 | ||||
-rw-r--r-- | lisp/emacs-lisp/autoload.el | 1 | ||||
-rw-r--r-- | lisp/emacs-lisp/bytecomp.el | 3 | ||||
-rw-r--r-- | lisp/files.el | 34 | ||||
-rw-r--r-- | lisp/net/tramp.el | 35 | ||||
-rw-r--r-- | lisp/progmodes/python.el | 6 | ||||
-rw-r--r-- | src/editfns.c | 4 | ||||
-rw-r--r-- | src/nsterm.m | 4 | ||||
-rw-r--r-- | test/lisp/progmodes/python-tests.el | 31 |
14 files changed, 119 insertions, 68 deletions
diff --git a/ChangeLog.2 b/ChangeLog.2 index c971397a134..bf85406b1f9 100644 --- a/ChangeLog.2 +++ b/ChangeLog.2 @@ -32128,7 +32128,7 @@ eshell: Introduce new buffer syntax The new buffer syntax '#<buffer-name>' is equivalent to '#<buffer buffer-name>'. Remove `eshell-buffer-shorthand', as it is no longer - needed (Bug#19319). + needed (Bug#19391). * lisp/eshell/esh-io.el (eshell-buffer-shorthand): Remove. (eshell-get-target): Remove shorthand-specific code. * lisp/eshell/esh-arg.el (eshell-parse-special-reference): Parse diff --git a/doc/emacs/buffers.texi b/doc/emacs/buffers.texi index 362d3b36453..1a27fe877e0 100644 --- a/doc/emacs/buffers.texi +++ b/doc/emacs/buffers.texi @@ -174,10 +174,15 @@ List the existing buffers (@code{list-buffers}). @cindex listing current buffers @kindex C-x C-b @findex list-buffers - To display a list of existing buffers, type @kbd{C-x C-b}. Each + To display a list of existing buffers, type @kbd{C-x C-b}. This +pops up a buffer menu in a buffer named @file{*Buffer List*}. Each line in the list shows one buffer's name, size, major mode and visited file. The buffers are listed in the order that they were current; the -buffers that were current most recently come first. +buffers that were current most recently come first. This section +describes how the list of buffers is displayed and how to interpret +the various indications in the list; see @ref{Several Buffers}, for +description of the special mode in the @file{*Buffer List*} buffer and +the commands available there. @samp{.} in the first field of a line indicates that the buffer is current. @samp{%} indicates a read-only buffer. @samp{*} indicates @@ -700,13 +705,20 @@ Customization}). @item M-x bs-show Make a list of buffers similarly to @kbd{M-x list-buffers} but customizable. +@item M-x ibuffer +Make a list of buffers and operate on them in Dired-like fashion. @end table +@findex bs-customize @kbd{M-x bs-show} pops up a buffer list similar to the one normally -displayed by @kbd{C-x C-b} but which you can customize. If you prefer +displayed by @kbd{C-x C-b}, but whose display you can customize in a +more flexible fashion. For example, you can specify the list of +buffer attributes to show, the minimum and maximum width of buffer +name column, a regexp for names of buffers that will never be shown +and those which will always be shown, etc. If you prefer this to the usual buffer list, you can bind this command to @kbd{C-x C-b}. To customize this buffer list, use the @code{bs} Custom group -(@pxref{Easy Customization}). +(@pxref{Easy Customization}), or invoke @kbd{bs-customize}. @findex msb-mode @cindex mode, MSB @@ -719,3 +731,8 @@ prefer. It replaces the bindings of @code{mouse-buffer-menu}, normally on @kbd{C-Down-mouse-1} and @kbd{C-@key{F10}}, and the menu bar buffer menu. You can customize the menu in the @code{msb} Custom group. + +@findex ibuffer + IBuffer is a major mode for viewing a list of buffers and operating +on them in a way analogous to that of Dired (@pxref{Dired}), including +filtering, marking, sorting in various ways, and acting on buffers. diff --git a/doc/emacs/mule.texi b/doc/emacs/mule.texi index 9ef31102455..78f77cb3003 100644 --- a/doc/emacs/mule.texi +++ b/doc/emacs/mule.texi @@ -1002,16 +1002,15 @@ its name at the prompt.) @vindex sendmail-coding-system When you send a mail message (@pxref{Sending Mail}), Emacs has four different ways to determine the coding system to use -for encoding the message text. It tries the buffer's own value of +for encoding the message text. It first tries the buffer's own value of @code{buffer-file-coding-system}, if that is non-@code{nil}. Otherwise, it uses the value of @code{sendmail-coding-system}, if that -is non-@code{nil}. The third way is to use the default coding system -for new files, which is controlled by your choice of language -@c i.e., default-sendmail-coding-system -environment, if that is non-@code{nil}. If all of these three values -are @code{nil}, Emacs encodes outgoing mail using the Latin-1 coding -system. -@c FIXME? Where does the Latin-1 default come in? +is non-@code{nil}. Thirdly, it uses the value of +@code{default-sendmail-coding-system}. +If all of these three values are @code{nil}, Emacs encodes outgoing +mail using the default coding system for new files (i.e., the +default value of @code{buffer-file-coding-system}), which is +controlled by your choice of language environment. @node Text Coding @section Specifying a Coding System for File Text diff --git a/doc/lispref/sequences.texi b/doc/lispref/sequences.texi index 5ae1567c128..4fba880803e 100644 --- a/doc/lispref/sequences.texi +++ b/doc/lispref/sequences.texi @@ -853,7 +853,7 @@ it is a function of two arguments to use instead of the default @code{equal}. @end group @group (seq-uniq '(1 2 2.0 1.0) #'=) -@result{} [3 4] +@result{} [1 2] @end group @end example @end defun diff --git a/lisp/composite.el b/lisp/composite.el index 7293d7c15cd..29fc753d5ae 100644 --- a/lisp/composite.el +++ b/lisp/composite.el @@ -338,7 +338,7 @@ chunk of text that is automatically composed. If such a chunk is found closer to POS than the position that has `composition' property, the value is a list of FROM, TO, and a glyph-string that specifies how the chunk is to be composed; DETAIL-P is -inored in this case. See the function `composition-get-gstring' +ignored in this case. See the function `composition-get-gstring' for the format of the glyph-string." (let ((result (find-composition-internal pos limit string detail-p))) (if (and detail-p (> (length result) 3) (nth 2 result) (not (nth 3 result))) diff --git a/lisp/edmacro.el b/lisp/edmacro.el index b050f4d64c7..dc840ef1f19 100644 --- a/lisp/edmacro.el +++ b/lisp/edmacro.el @@ -88,20 +88,26 @@ Default nil means to write characters above \\177 in octal notation." (defun edit-kbd-macro (keys &optional prefix finish-hook store-hook) "Edit a keyboard macro. At the prompt, type any key sequence which is bound to a keyboard macro. -Or, type `C-x e' or RET to edit the last keyboard macro, `C-h l' to edit -the last 300 keystrokes as a keyboard macro, or `\\[execute-extended-command]' to edit a macro by -its command name. +Or, type `\\[kmacro-end-and-call-macro]' or RET to edit the last +keyboard macro, `\\[view-lossage]' to edit the last 300 +keystrokes as a keyboard macro, or `\\[execute-extended-command]' +to edit a macro by its command name. With a prefix argument, format the macro in a more concise way." - (interactive "kKeyboard macro to edit (C-x e, M-x, C-h l, or keys): \nP") + (interactive + (list (read-key-sequence (substitute-command-keys "Keyboard macro to edit \ +\(\\[kmacro-end-and-call-macro], \\[execute-extended-command], \\[view-lossage],\ + or keys): ")) + current-prefix-arg)) (when keys (let ((cmd (if (arrayp keys) (key-binding keys) keys)) + (cmd-noremap (when (arrayp keys) (key-binding keys nil t))) (mac nil) (mac-counter nil) (mac-format nil) kmacro) (cond (store-hook (setq mac keys) (setq cmd nil)) - ((or (memq cmd '(call-last-kbd-macro kmacro-call-macro - kmacro-end-or-call-macro kmacro-end-and-call-macro)) + ((or (memq cmd '(call-last-kbd-macro kmacro-call-macro kmacro-end-or-call-macro kmacro-end-and-call-macro)) + (memq cmd-noremap '(call-last-kbd-macro kmacro-call-macro kmacro-end-or-call-macro kmacro-end-and-call-macro)) (member keys '("\r" [return]))) (or last-kbd-macro (y-or-n-p "No keyboard macro defined. Create one? ") @@ -109,13 +115,14 @@ With a prefix argument, format the macro in a more concise way." (setq mac (or last-kbd-macro "")) (setq keys nil) (setq cmd 'last-kbd-macro)) - ((eq cmd 'execute-extended-command) + ((memq 'execute-extended-command (list cmd cmd-noremap)) (setq cmd (read-command "Name of keyboard macro to edit: ")) (if (string-equal cmd "") (error "No command name given")) (setq keys nil) (setq mac (symbol-function cmd))) - ((memq cmd '(view-lossage electric-view-lossage)) + ((or (memq cmd '(view-lossage electric-view-lossage)) + (memq cmd-noremap '(view-lossage electric-view-lossage))) (setq mac (recent-keys)) (setq keys nil) (setq cmd 'last-kbd-macro)) diff --git a/lisp/emacs-lisp/autoload.el b/lisp/emacs-lisp/autoload.el index 7299ae9d203..71fc51e27b0 100644 --- a/lisp/emacs-lisp/autoload.el +++ b/lisp/emacs-lisp/autoload.el @@ -497,6 +497,7 @@ Return non-nil in the case where no autoloads were added at point." Standard prefixes won't be registered anyway. I.e. if a file \"foo.el\" defines variables or functions that use \"foo-\" as prefix, that will not be registered. But all other prefixes will be included.") +(put 'autoload-compute-prefixes 'safe #'booleanp) (defconst autoload-def-prefixes-max-entries 5 "Target length of the list of definition prefixes per file. diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el index e5a1ea782e8..f69ac7f342a 100644 --- a/lisp/emacs-lisp/bytecomp.el +++ b/lisp/emacs-lisp/bytecomp.el @@ -1931,7 +1931,8 @@ The value is non-nil if there were no errors, nil if errors." ;; process is trying to load target-file (eg in a ;; parallel bootstrap), it does not risk getting a ;; half-finished file. (Bug#4196) - (tempfile (make-temp-file target-file)) + (tempfile + (make-temp-file (file-name-nondirectory target-file))) (default-modes (default-file-modes)) (temp-modes (logand default-modes #o600)) (desired-modes (logand default-modes #o666)) diff --git a/lisp/files.el b/lisp/files.el index a5a268195f5..205001e5d5a 100644 --- a/lisp/files.el +++ b/lisp/files.el @@ -4656,19 +4656,13 @@ The function `find-backup-file-name' also uses this." (cond ((file-remote-p file) ;; Remove the leading slash, if any, to prevent - ;; expand-file-name from adding a drive letter. + ;; convert-standard-filename from converting that to a + ;; backslash. (and (memq (aref file 0) '(?/ ?\\)) (setq file (substring file 1))) - ;; Replace any invalid file-name characters. - (setq file (convert-standard-filename file)) - ;; Replace slashes to make the file name unique, and - ;; prepend backup-directory. - (expand-file-name - (subst-char-in-string - ?/ ?! - (replace-regexp-in-string "!" "!!" - (concat "/" file))) - backup-directory)) + ;; Replace any invalid file-name characters, then + ;; prepend the leading slash back. + (setq file (concat "/" (convert-standard-filename file)))) (t ;; Replace any invalid file-name characters. (setq file (expand-file-name (convert-standard-filename file))) @@ -4679,15 +4673,15 @@ The function `find-backup-file-name' also uses this." (if (eq (aref file 2) ?/) "" "/") - (substring file 2)))) - ;; Make the name unique by substituting directory - ;; separators. It may not really be worth bothering about - ;; doubling `!'s in the original name... - (expand-file-name - (subst-char-in-string - ?/ ?! - (replace-regexp-in-string "!" "!!" file)) - backup-directory))))) + (substring file 2))))))) + ;; Make the name unique by substituting directory + ;; separators. It may not really be worth bothering about + ;; doubling `!'s in the original name... + (expand-file-name + (subst-char-in-string + ?/ ?! + (replace-regexp-in-string "!" "!!" file)) + backup-directory)) (expand-file-name (file-name-nondirectory file) (file-name-as-directory abs-backup-directory)))))) diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index d41ae82e1be..433baed6ed6 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el @@ -1858,8 +1858,7 @@ letter into the file name. This function removes it." (if (tramp-compat-file-name-quoted-p name) 'tramp-compat-file-name-quote 'identity) (let ((name (tramp-compat-file-name-unquote name))) - ;; A volume letter could occur also in encoded backup file names. - (if (string-match "\\(\\`[[:alpha:]]:/\\|/!drive_[[:alpha:]]\\)" name) + (if (string-match "\\`[a-zA-Z]:/" name) (replace-match "/" nil t name) name))))) @@ -3226,23 +3225,21 @@ User is always nil." (defun tramp-handle-find-backup-file-name (filename) "Like `find-backup-file-name' for Tramp files." (with-parsed-tramp-file-name filename nil - (mapcar - 'tramp-drop-volume-letter - (let ((backup-directory-alist - (if tramp-backup-directory-alist - (mapcar - (lambda (x) - (cons - (car x) - (if (and (stringp (cdr x)) - (file-name-absolute-p (cdr x)) - (not (tramp-tramp-file-p (cdr x)))) - (tramp-make-tramp-file-name - method user domain host port (cdr x) hop) - (cdr x)))) - tramp-backup-directory-alist) - backup-directory-alist))) - (tramp-run-real-handler 'find-backup-file-name (list filename)))))) + (let ((backup-directory-alist + (if tramp-backup-directory-alist + (mapcar + (lambda (x) + (cons + (car x) + (if (and (stringp (cdr x)) + (file-name-absolute-p (cdr x)) + (not (tramp-tramp-file-p (cdr x)))) + (tramp-make-tramp-file-name + method user domain host port (cdr x) hop) + (cdr x)))) + tramp-backup-directory-alist) + backup-directory-alist))) + (tramp-run-real-handler 'find-backup-file-name (list filename))))) (defun tramp-handle-insert-directory (filename switches &optional wildcard full-directory-p) diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index d4226e5ce7b..9e09bfc5941 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el @@ -1257,7 +1257,11 @@ This function is intended to be added to `post-self-insert-hook.' If a line renders a paren alone, after adding a char before it, the line will be re-indented automatically if needed." (when (and electric-indent-mode - (eq (char-before) last-command-event)) + (eq (char-before) last-command-event) + (not (python-syntax-context 'string)) + (save-excursion + (beginning-of-line) + (not (python-syntax-context 'string (syntax-ppss))))) (cond ;; Electric indent inside parens ((and diff --git a/src/editfns.c b/src/editfns.c index 34ae59c5138..e671ba0761c 100644 --- a/src/editfns.c +++ b/src/editfns.c @@ -4919,7 +4919,7 @@ styled_format (ptrdiff_t nargs, Lisp_Object *args, bool message) else if (discarded[bytepos] == 1) { position++; - if (translated == info[fieldn].start) + if (fieldn < nspec && translated == info[fieldn].start) { translated += info[fieldn].end - info[fieldn].start; fieldn++; @@ -4939,7 +4939,7 @@ styled_format (ptrdiff_t nargs, Lisp_Object *args, bool message) else if (discarded[bytepos] == 1) { position++; - if (translated == info[fieldn].start) + if (fieldn < nspec && translated == info[fieldn].start) { translated += info[fieldn].end - info[fieldn].start; fieldn++; diff --git a/src/nsterm.m b/src/nsterm.m index 59a42eed887..50e06c94d45 100644 --- a/src/nsterm.m +++ b/src/nsterm.m @@ -9152,9 +9152,9 @@ ns_xlfd_to_fontname (const char *xlfd) const char *ret; if (!strncmp (xlfd, "--", 2)) - sscanf (xlfd, "--%*[^-]-%[^-]179-", name); + sscanf (xlfd, "--%*[^-]-%179[^-]-", name); else - sscanf (xlfd, "-%*[^-]-%[^-]179-", name); + sscanf (xlfd, "-%*[^-]-%179[^-]-", name); /* stopgap for malformed XLFD input */ if (strlen (name) == 0) diff --git a/test/lisp/progmodes/python-tests.el b/test/lisp/progmodes/python-tests.el index a59885637e9..010eb67160c 100644 --- a/test/lisp/progmodes/python-tests.el +++ b/test/lisp/progmodes/python-tests.el @@ -1109,6 +1109,37 @@ def fn(a, b, c=True): (should (eq (car (python-indent-context)) :inside-string)) (should (= (python-indent-calculate-indentation) 4)))) +(ert-deftest python-indent-electric-comma-inside-multiline-string () + "Test indentation ...." + (python-tests-with-temp-buffer + " +a = ( + '''\ +- foo, +- bar +''' +" + (python-tests-look-at "- bar") + (should (eq (car (python-indent-context)) :inside-string)) + (goto-char (line-end-position)) + (python-tests-self-insert ",") + (should (= (current-indentation) 0)))) + +(ert-deftest python-indent-electric-comma-after-multiline-string () + "Test indentation ...." + (python-tests-with-temp-buffer + " +a = ( + '''\ +- foo, +- bar''' +" + (python-tests-look-at "- bar'''") + (should (eq (car (python-indent-context)) :inside-string)) + (goto-char (line-end-position)) + (python-tests-self-insert ",") + (should (= (current-indentation) 0)))) + (ert-deftest python-indent-electric-colon-1 () "Test indentation case from Bug#18228." (python-tests-with-temp-buffer |