commit d7ac7b15ca9e490c8e059ad92b968a3008a7b83e (HEAD, refs/remotes/origin/master) Author: Eli Zaretskii Date: Fri Jan 27 11:39:31 2017 +0200 Ensure last line is at window bottom in shell buffers * lisp/shell.el (shell-mode): Use setq-local. Set scroll-conservatively to 101 locally. See the discussion at http://lists.gnu.org/archive/html/emacs-devel/2016-12/msg00736.html for the reasons. diff --git a/lisp/shell.el b/lisp/shell.el index 133771aeb3..c8a8555d63 100644 --- a/lisp/shell.el +++ b/lisp/shell.el @@ -544,11 +544,14 @@ control whether input and output cause the window to scroll to the end of the buffer." (setq comint-prompt-regexp shell-prompt-pattern) (shell-completion-vars) - (set (make-local-variable 'paragraph-separate) "\\'") - (set (make-local-variable 'paragraph-start) comint-prompt-regexp) - (set (make-local-variable 'font-lock-defaults) '(shell-font-lock-keywords t)) - (set (make-local-variable 'shell-dirstack) nil) - (set (make-local-variable 'shell-last-dir) nil) + (setq-local paragraph-separate "\\'") + (setq-local paragraph-start comint-prompt-regexp) + (setq-local font-lock-defaults '(shell-font-lock-keywords t)) + (setq-local shell-dirstack nil) + (setq-local shell-last-dir nil) + ;; People expect Shell mode to keep the last line of output at + ;; window bottom. + (setq-local scroll-conservatively 101) (shell-dirtrack-mode 1) ;; By default, ansi-color applies faces using overlays. This is commit 87027734e99c1fc4ad7803421e1086e3388d20f3 Author: Michael Hoffman Date: Fri Jan 27 11:26:36 2017 +0200 Support Bash Ctrl-Z indication of directory name in term.el * term.el (term-emulate-terminal): Do not display ?\032 escape codes even when 'handled-ansi-message' is non-nil. (Bug#11919) Copyright-paperwork-exempt: yes diff --git a/lisp/term.el b/lisp/term.el index 5259571eb6..063a6ea592 100644 --- a/lisp/term.el +++ b/lisp/term.el @@ -2901,15 +2901,16 @@ See `term-prompt-regexp'." ((eq char ?\017)) ; Shift In - ignored ((eq char ?\^G) ;; (terminfo: bel) (beep t)) - ((and (eq char ?\032) - (not handled-ansi-message)) + ((eq char ?\032) (let ((end (string-match "\r?\n" str i))) (if end - (funcall term-command-hook - (decode-coding-string - (prog1 (substring str (1+ i) end) - (setq i (1- (match-end 0)))) - locale-coding-system)) + (progn + (unless handled-ansi-message + (funcall term-command-hook + (decode-coding-string + (substring str (1+ i) end) + locale-coding-system))) + (setq i (1- (match-end 0)))) (setq term-terminal-parameter (substring str i)) (setq term-terminal-state 4) (setq i str-length)))) commit 525a6d2c4fcd4a319e196ede0513275f6b07eb2c Author: Eli Zaretskii Date: Fri Jan 27 10:51:53 2017 +0200 Don't report zero errno for inaccessible directory * src/fileio.c (Ffile_accessible_directory_p): Report EACCES when a file handler reports a failure. (Bug#25419) diff --git a/src/fileio.c b/src/fileio.c index ac6d781941..8e549a4485 100644 --- a/src/fileio.c +++ b/src/fileio.c @@ -2815,7 +2815,14 @@ really is a readable and searchable directory. */) if (!NILP (handler)) { Lisp_Object r = call2 (handler, Qfile_accessible_directory_p, absname); - errno = 0; + + /* This might be a lie (e.g., the directory might not exist, or + be a regular file), but at least it does TRT in the "usual" + case of an existing directory that is not accessible by the + current user, and avoids reporting "Success" for a failed + operation. */ + if (!EQ (r, Qt)) + errno = EACCES; return r; } commit e26166aae0616264a476cac3ba1e2c5979d442b5 Author: Eli Zaretskii Date: Fri Jan 27 10:28:15 2017 +0200 Fix filenotify-tests on MS-Windows * test/lisp/filenotify-tests.el (file-notify-test04-file-validity) (file-notify-test05-dir-validity) (file-notify-test06-many-events) (file-notify-test08-watched-file-in-watched-dir): Manually remove the watch descriptor before calling file-notify--test-cleanup-p. (Bug#25539) diff --git a/test/lisp/filenotify-tests.el b/test/lisp/filenotify-tests.el index d237d0cc06..db7f55e8fc 100644 --- a/test/lisp/filenotify-tests.el +++ b/test/lisp/filenotify-tests.el @@ -850,6 +850,13 @@ delivered." ;; After deleting the parent directory, the descriptor must ;; not be valid anymore. (should-not (file-notify-valid-p file-notify--test-desc)) + ;; w32notify doesn't generate 'stopped' events when the parent + ;; directory is deleted, which doesn't provide a chance for + ;; filenotify.el to remove the descriptor from the internal + ;; hash table it maintains. So we must remove the descriptor + ;; manually. + (if (string-equal (file-notify--test-library) "w32notify") + (file-notify--rm-descriptor file-notify--test-desc)) ;; The environment shall be cleaned up. (file-notify--test-cleanup-p)) @@ -906,6 +913,8 @@ delivered." (file-notify--test-timeout) (not (file-notify-valid-p file-notify--test-desc))) (should-not (file-notify-valid-p file-notify--test-desc)) + (if (string-equal (file-notify--test-library) "w32notify") + (file-notify--rm-descriptor file-notify--test-desc)) ;; The environment shall be cleaned up. (file-notify--test-cleanup-p)) @@ -975,6 +984,8 @@ delivered." (file-notify--test-read-event) (delete-file file))) (delete-directory file-notify--test-tmpfile) + (if (string-equal (file-notify--test-library) "w32notify") + (file-notify--rm-descriptor file-notify--test-desc)) ;; The environment shall be cleaned up. (file-notify--test-cleanup-p)) @@ -1184,6 +1195,9 @@ the file watch." (delete-directory file-notify--test-tmpfile 'recursive)) (should-not (file-notify-valid-p file-notify--test-desc1)) (should-not (file-notify-valid-p file-notify--test-desc2)) + (when (string-equal (file-notify--test-library) "w32notify") + (file-notify--rm-descriptor file-notify--test-desc1) + (file-notify--rm-descriptor file-notify--test-desc2)) ;; The environment shall be cleaned up. (file-notify--test-cleanup-p)) commit 7cb7a582f44db94292709d35f4f5474f891f03b0 Author: Hong Xu Date: Mon Dec 12 17:55:25 2016 -0800 python-mode: Fix detection for opening blocks. * python.el (python-info-dedenter-opening-block-positions): There can't be any back-indented lines between an opening block and the current line. * python-tests.el (python-indent-electric-colon-4): Add an indent test case where there is one-more indented previous opening block. diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index d8262dd0a7..90b5e4e0dc 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el @@ -4693,7 +4693,8 @@ likely an invalid python file." (let ((dedenter-pos (python-info-dedenter-statement-p))) (when dedenter-pos (goto-char dedenter-pos) - (let* ((pairs '(("elif" "elif" "if") + (let* ((cur-line (line-beginning-position)) + (pairs '(("elif" "elif" "if") ("else" "if" "elif" "except" "for" "while") ("except" "except" "try") ("finally" "else" "except" "try"))) @@ -4709,7 +4710,22 @@ likely an invalid python file." (let ((indentation (current-indentation))) (when (and (not (memq indentation collected-indentations)) (or (not collected-indentations) - (< indentation (apply #'min collected-indentations)))) + (< indentation (apply #'min collected-indentations))) + ;; There must be no line with indentation + ;; smaller than `indentation' (except for + ;; blank lines) between the found opening + ;; block and the current line, otherwise it + ;; is not an opening block. + (save-excursion + (forward-line) + (let ((no-back-indent t)) + (save-match-data + (while (and (< (point) cur-line) + (setq no-back-indent + (or (> (current-indentation) indentation) + (python-info-current-line-empty-p)))) + (forward-line))) + no-back-indent))) (setq collected-indentations (cons indentation collected-indentations)) (when (member (match-string-no-properties 0) diff --git a/test/lisp/progmodes/python-tests.el b/test/lisp/progmodes/python-tests.el index 2df1bbf50d..158c52f080 100644 --- a/test/lisp/progmodes/python-tests.el +++ b/test/lisp/progmodes/python-tests.el @@ -1156,6 +1156,27 @@ if do: (python-tests-look-at "that)") (should (= (current-indentation) 6)))) +(ert-deftest python-indent-electric-colon-4 () + "Test indentation case where there is one more-indented previous open block." + (python-tests-with-temp-buffer + " +def f(): + if True: + a = 5 + + if True: + a = 10 + + b = 3 + +else +" + (python-tests-look-at "else") + (goto-char (line-end-position)) + (python-tests-self-insert ":") + (python-tests-look-at "else" -1) + (should (= (current-indentation) 4)))) + (ert-deftest python-indent-region-1 () "Test indentation case from Bug#18843." (let ((contents " commit 3485c1693efb709cfc15023d9b38978278731a32 Author: Lars Ingebrigtsen Date: Fri Jan 27 01:04:59 2017 +0100 Fix Message check for bogus domain names * lisp/gnus/message.el (message-make-fqdn): Fix check for bogus system names (bug#24570). diff --git a/lisp/gnus/message.el b/lisp/gnus/message.el index 73d44da1ea..4f08b0b272 100644 --- a/lisp/gnus/message.el +++ b/lisp/gnus/message.el @@ -5785,7 +5785,7 @@ give as trustworthy answer as possible." (not (string-match message-bogus-system-names message-user-fqdn))) ;; `message-user-fqdn' seems to be valid message-user-fqdn) - ((and (string-match message-bogus-system-names sysname)) + ((not (string-match message-bogus-system-names sysname)) ;; `system-name' returned the right result. sysname) ;; Try `mail-host-address'. commit 7416f008f03214e4be6d3fac7de80ee82d041611 Author: Øyvind Stegard Date: Fri Jan 27 01:02:23 2017 +0100 Subject: Restore correct Gnus newsgroup name after sending message * lisp/gnus/gnus-msg.el (gnus-msg-mail): Set the value of gnus-newsgroup-name in the correct buffer (bug#24329). Copyright-paperwork-exempt: yes diff --git a/lisp/gnus/gnus-msg.el b/lisp/gnus/gnus-msg.el index e56f50cdad..a193ab4134 100644 --- a/lisp/gnus/gnus-msg.el +++ b/lisp/gnus/gnus-msg.el @@ -546,7 +546,8 @@ instead." (gnus-setup-message 'message (message-mail to subject other-headers continue nil yank-action send-actions return-action))) - (setq gnus-newsgroup-name group-name)) + (with-current-buffer buf + (setq gnus-newsgroup-name group-name))) (when switch-action (setq mail-buf (current-buffer)) (switch-to-buffer buf) commit 110cd0b439101a15f0fbc9fb86bf22b77f8ec260 Author: Lars Ingebrigtsen Date: Fri Jan 27 00:33:03 2017 +0100 Mention the new Gnus sorting command diff --git a/etc/NEWS b/etc/NEWS index 0ad5f70075..12ff21f39a 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -354,6 +354,10 @@ bound to 'Buffer-menu-unmark-all-buffers'. *** The .newsrc file will now only be saved if the native select method is an NNTP select method. ++++ +*** A new command for sorting articles by readedness marks has been +added: `C-c C-s C-m C-m'. + ** Ibuffer --- commit 5dd303fe7720f47d7d845723a2111e059a3b3ef6 Author: Lars Ingebrigtsen Date: Fri Jan 27 00:29:20 2017 +0100 Don't try to find charsets of non-text MIME parts * lisp/gnus/mml.el (mml-generate-mime-1): It seems nonsensical to try to determine the charset of non-text message parts, so skip that (bug#24190). This will also remove messages like "bunzip2ing /tmp/acsb.cpio.bz2...done" while sending messages if you include such files. diff --git a/lisp/gnus/mml.el b/lisp/gnus/mml.el index a4a47f929f..a0ca624909 100644 --- a/lisp/gnus/mml.el +++ b/lisp/gnus/mml.el @@ -695,11 +695,7 @@ be \"related\" or \"alternate\"." ((and filename (not (equal (cdr (assq 'nofile cont)) "yes"))) (let ((coding-system-for-read mm-binary-coding-system)) - (mm-insert-file-contents filename nil nil nil nil t)) - (unless charset - (setq charset (mm-coding-system-to-mime-charset - (mm-find-buffer-file-coding-system - filename))))) + (mm-insert-file-contents filename nil nil nil nil t))) (t (let ((contents (cdr (assq 'contents cont)))) (if (multibyte-string-p contents) commit a3b6d8e2ebf06f8d9b95e7b47894c8287cdcb15f Author: Lars Ingebrigtsen Date: Fri Jan 27 00:03:41 2017 +0100 Add new command gnus-article-sort-by-marks * doc/misc/gnus.texi (Summary Sorting): Mention gnus-summary-sort-by-marks. * lisp/gnus/gnus-sum.el (gnus-article-sort-by-marks): New function (bug#23393). (gnus-thread-sort-by-marks): Ditto. (gnus-summary-sort-by-mark): New command suggested by Dan Jacobson. (gnus-summary-mode-map): Add keystroke. (gnus-summary-make-menu-bar): Add to menu. diff --git a/doc/misc/gnus.texi b/doc/misc/gnus.texi index 4b0d0cac23..ceeb42b918 100644 --- a/doc/misc/gnus.texi +++ b/doc/misc/gnus.texi @@ -10197,6 +10197,11 @@ Sort by lines (@code{gnus-summary-sort-by-lines}). @findex gnus-summary-sort-by-chars Sort by article length (@code{gnus-summary-sort-by-chars}). +@item C-c C-s C-m C-m +@kindex C-c C-s C-m C-m (Summary) +@findex gnus-summary-sort-by-marks +Sort by article ``readedness'' marks (@code{gnus-summary-sort-by-marks}). + @item C-c C-s C-i @kindex C-c C-s C-i (Summary) @findex gnus-summary-sort-by-score diff --git a/lisp/gnus/gnus-sum.el b/lisp/gnus/gnus-sum.el index 4390a2c07d..2631514e42 100644 --- a/lisp/gnus/gnus-sum.el +++ b/lisp/gnus/gnus-sum.el @@ -1895,6 +1895,7 @@ increase the score of each group you read." "\C-c\C-s\C-m\C-n" gnus-summary-sort-by-most-recent-number "\C-c\C-s\C-l" gnus-summary-sort-by-lines "\C-c\C-s\C-c" gnus-summary-sort-by-chars + "\C-c\C-s\C-m\C-m" gnus-summary-sort-by-marks "\C-c\C-s\C-a" gnus-summary-sort-by-author "\C-c\C-s\C-t" gnus-summary-sort-by-recipient "\C-c\C-s\C-s" gnus-summary-sort-by-subject @@ -2748,6 +2749,7 @@ gnus-summary-show-article-from-menu-as-charset-%s" cs)))) ["Sort by score" gnus-summary-sort-by-score t] ["Sort by lines" gnus-summary-sort-by-lines t] ["Sort by characters" gnus-summary-sort-by-chars t] + ["Sort by marks" gnus-summary-sort-by-marks t] ["Randomize" gnus-summary-sort-by-random t] ["Original sort" gnus-summary-sort-by-original t]) ("Help" @@ -4946,6 +4948,16 @@ using some other form will lead to serious barfage." (gnus-article-sort-by-chars (gnus-thread-header h1) (gnus-thread-header h2))) +(defsubst gnus-article-sort-by-marks (h1 h2) + "Sort articles by octet length." + (< (gnus-article-mark (mail-header-number h1)) + (gnus-article-mark (mail-header-number h2)))) + +(defun gnus-thread-sort-by-marks (h1 h2) + "Sort threads by root article octet length." + (gnus-article-sort-by-marks + (gnus-thread-header h1) (gnus-thread-header h2))) + (defsubst gnus-article-sort-by-author (h1 h2) "Sort articles by root author." (gnus-string< @@ -11930,6 +11942,12 @@ Argument REVERSE means reverse order." (interactive "P") (gnus-summary-sort 'chars reverse)) +(defun gnus-summary-sort-by-mark (&optional reverse) + "Sort the summary buffer by article marks. +Argument REVERSE means reverse order." + (interactive "P") + (gnus-summary-sort 'marks reverse)) + (defun gnus-summary-sort-by-original (&optional reverse) "Sort the summary buffer using the default sorting method. Argument REVERSE means reverse order." commit f15bbbec0b11be7bbcde83cf905875b61f24e8bb Author: Katsumi Yamaoka Date: Thu Jan 26 22:43:31 2017 +0000 Make `C-h b' work correctly in Gnus article buffer (bug#18257) * lisp/gnus/gnus-art.el (gnus-article-describe-bindings): Ignore summary commands that aren't bound to gnus-article-read-summary-keys keys (bug#18257). diff --git a/lisp/gnus/gnus-art.el b/lisp/gnus/gnus-art.el index a0f14402fb..43e1231914 100644 --- a/lisp/gnus/gnus-art.el +++ b/lisp/gnus/gnus-art.el @@ -6846,17 +6846,21 @@ then we display only bindings that start with that prefix." (let ((keymap (copy-keymap gnus-article-mode-map)) (map (copy-keymap gnus-article-send-map)) (sumkeys (where-is-internal 'gnus-article-read-summary-keys)) + (summap (make-sparse-keymap)) parent agent draft) (define-key keymap "S" map) (define-key map [t] nil) + (define-key summap [t] 'undefined) (with-current-buffer gnus-article-current-summary + (dolist (key sumkeys) + (define-key summap key (key-binding key (current-local-map)))) (set-keymap-parent keymap (if (setq parent (keymap-parent gnus-article-mode-map)) (prog1 (setq parent (copy-keymap parent)) - (set-keymap-parent parent (current-local-map))) - (current-local-map))) + (set-keymap-parent parent summap)) + summap)) (set-keymap-parent map (key-binding "S")) (let (key def gnus-pick-mode) (while sumkeys commit ffdf409ebbab03799da394ba04e2600dfb9fa217 Author: Lars Ingebrigtsen Date: Thu Jan 26 23:11:50 2017 +0100 Fix crossposting in non-primary groups * lisp/gnus/message.el (message-cross-post-followup-to-header): Gnus server prefixes shouldn't be included in the group names (bug#21661). (message-cross-post-followup-to): Ditto. diff --git a/lisp/gnus/message.el b/lisp/gnus/message.el index e45ab1080a..73d44da1ea 100644 --- a/lisp/gnus/message.el +++ b/lisp/gnus/message.el @@ -2286,13 +2286,15 @@ body, set `message-archive-note' to nil." "Mangles FollowUp-To and Newsgroups header to point to TARGET-GROUP. With prefix-argument just set Follow-Up, don't cross-post." (interactive - (list ; Completion based on Gnus - (completing-read "Followup To: " - (if (boundp 'gnus-newsrc-alist) - gnus-newsrc-alist) - nil nil '("poster" . 0) - (if (boundp 'gnus-group-history) - 'gnus-group-history)))) + (list ; Completion based on Gnus + (replace-regexp-in-string + "\\`.*:" "" + (completing-read "Followup To: " + (if (boundp 'gnus-newsrc-alist) + gnus-newsrc-alist) + nil nil '("poster" . 0) + (if (boundp 'gnus-group-history) + 'gnus-group-history))))) (message-remove-header "Follow[Uu]p-[Tt]o" t) (message-goto-newsgroups) (beginning-of-line) @@ -2361,13 +2363,15 @@ been made to before the user asked for a Crosspost." "Crossposts message and set Followup-To to TARGET-GROUP. With prefix-argument just set Follow-Up, don't cross-post." (interactive - (list ; Completion based on Gnus - (completing-read "Followup To: " - (if (boundp 'gnus-newsrc-alist) - gnus-newsrc-alist) - nil nil '("poster" . 0) - (if (boundp 'gnus-group-history) - 'gnus-group-history)))) + (list ; Completion based on Gnus + (replace-regexp-in-string + "\\`.*:" "" + (completing-read "Followup To: " + (if (boundp 'gnus-newsrc-alist) + gnus-newsrc-alist) + nil nil '("poster" . 0) + (if (boundp 'gnus-group-history) + 'gnus-group-history))))) (when (fboundp 'gnus-group-real-name) (setq target-group (gnus-group-real-name target-group))) (cond ((not (or (null target-group) ; new subject not empty commit 2db8794fcae971928792099dbcb5772f9321cd87 Author: Lars Ingebrigtsen Date: Thu Jan 26 23:00:24 2017 +0100 Gnus doc clarification * doc/misc/gnus.texi (Unavailable Servers): Explicitly say that "unreachable" is the same as disabling it (bug#21630). diff --git a/doc/misc/gnus.texi b/doc/misc/gnus.texi index 9c87259ab0..4b0d0cac23 100644 --- a/doc/misc/gnus.texi +++ b/doc/misc/gnus.texi @@ -13515,7 +13515,8 @@ Close the connection (if any) to the server @kindex D (Server) @findex gnus-server-deny-server Mark the current server as unreachable -(@code{gnus-server-deny-server}). +(@code{gnus-server-deny-server}). This will effectively disable the +server. @item M-o @kindex M-o (Server) commit 3539657bb726b91f2bc475d4e1c5fe276feb064f Author: Lars Ingebrigtsen Date: Thu Jan 26 22:52:16 2017 +0100 Remove dead code from rfc2047 * lisp/mail/rfc2047.el (rfc2047-fold-field): Remove dead code. It's been disabled since 2005, when I made the change with the following comment. (rfc2047-encode-message-header): Disabled header folding -- not all headers can be folded, and this should be done by the message composition mode. Probably. I think. diff --git a/lisp/mail/rfc2047.el b/lisp/mail/rfc2047.el index 2a8160921a..bcbdc17631 100644 --- a/lisp/mail/rfc2047.el +++ b/lisp/mail/rfc2047.el @@ -281,17 +281,7 @@ Should be called narrowed to the head of the message." (encode-coding-region (point-min) (point-max) (mm-charset-to-coding-system - (car message-posting-charset)))) - ;; No encoding necessary, but folding is nice - (when nil - (rfc2047-fold-region - (save-excursion - (goto-char (point-min)) - (skip-chars-forward "^:") - (when (looking-at ": ") - (forward-char 2)) - (point)) - (point-max)))) + (car message-posting-charset))))) ;; We found something that may perhaps be encoded. (re-search-forward "^[^:]+: *" nil t) (cond commit 77bbca8c82f6e553c42abbfafca28f55fc995d00 Author: Lars Ingebrigtsen Date: Thu Jan 26 22:51:19 2017 +0100 Fill too long mail headers * lisp/gnus/message.el (message--fold-long-headers): New function to fold too-long headers (bug#21608). (message-send-mail): Use it to fill headers longer than 998 characters (which is the protocol limit). diff --git a/lisp/gnus/message.el b/lisp/gnus/message.el index 50d2380dd7..e45ab1080a 100644 --- a/lisp/gnus/message.el +++ b/lisp/gnus/message.el @@ -4552,6 +4552,9 @@ This function could be useful in `message-setup-hook'." (forward-line 1) (unless (y-or-n-p "Send anyway? ") (error "Failed to send the message"))))) + ;; Fold too-long header lines. They should be no longer than + ;; 998 octets long. + (message--fold-long-headers) ;; Let the user do all of the above. (run-hooks 'message-header-hook)) (setq options message-options) @@ -4648,6 +4651,14 @@ If you always want Gnus to send messages in one piece, set (setq message-options options) (push 'mail message-sent-message-via))) +(defun message--fold-long-headers () + (goto-char (point-min)) + (while (not (eobp)) + (when (and (looking-at "[^:]+:") + (> (- (line-end-position) (point)) 998)) + (mail-header-fold-field)) + (forward-line 1))) + (defvar sendmail-program) (defvar smtpmail-smtp-server) (defvar smtpmail-smtp-service) commit 47e82854ba12d5ac79ed66b90ba727e1b1c44d52 Author: Lars Ingebrigtsen Date: Thu Jan 26 22:28:17 2017 +0100 Make nndoc more resilient against corrupted files * lisp/gnus/nndoc.el (nndoc-possibly-change-buffer): Don't bug out on invalid files, like invalid .gz files (bug#21538). This may hinder Gnus from starting up. diff --git a/lisp/gnus/nndoc.el b/lisp/gnus/nndoc.el index ede118d6eb..7f7db8721d 100644 --- a/lisp/gnus/nndoc.el +++ b/lisp/gnus/nndoc.el @@ -356,14 +356,18 @@ from the document.") (setq nndoc-dissection-alist nil) (with-current-buffer nndoc-current-buffer (erase-buffer) - (if (and (stringp nndoc-address) - (string-match nndoc-binary-file-names nndoc-address)) - (let ((coding-system-for-read 'binary)) - (mm-insert-file-contents nndoc-address)) - (if (stringp nndoc-address) - (nnheader-insert-file-contents nndoc-address) - (insert-buffer-substring nndoc-address)) - (run-hooks 'nndoc-open-document-hook))))) + (condition-case error + (if (and (stringp nndoc-address) + (string-match nndoc-binary-file-names nndoc-address)) + (let ((coding-system-for-read 'binary)) + (mm-insert-file-contents nndoc-address)) + (if (stringp nndoc-address) + (nnheader-insert-file-contents nndoc-address) + (insert-buffer-substring nndoc-address)) + (run-hooks 'nndoc-open-document-hook)) + (file-error + (nnheader-report 'nndoc "Couldn't open %s: %s" + group error)))))) ;; Initialize the nndoc structures according to this new document. (when (and nndoc-current-buffer (not nndoc-dissection-alist)) commit 3a9e56d840b5551a90fe9068ee335cc37ed12ef2 Author: Lars Ingebrigtsen Date: Thu Jan 26 21:38:40 2017 +0100 Respect buffer-local message-fcc-handler-function * lisp/gnus/message.el (message-do-fcc): Copy the local variables from the Message buffer so that local settings of `message-fcc-handler-function' etc are respected (bug#21174). diff --git a/lisp/gnus/message.el b/lisp/gnus/message.el index 7cff8b80a2..50d2380dd7 100644 --- a/lisp/gnus/message.el +++ b/lisp/gnus/message.el @@ -5399,6 +5399,7 @@ Otherwise, generate and save a value for `canlock-password' first." (when file (with-temp-buffer (insert-buffer-substring buf) + (message-clone-locals buf) (message-encode-message-body) (save-restriction (message-narrow-to-headers) commit eba8046f05ca288608ebd065e089764275a503d2 Author: Lars Ingebrigtsen Date: Thu Jan 26 21:35:58 2017 +0100 (message-do-fcc): Modernise the code slightly. * lisp/gnus/message.el (message-do-fcc): Modernise the code slightly. diff --git a/lisp/gnus/message.el b/lisp/gnus/message.el index 9af38c01ed..7cff8b80a2 100644 --- a/lisp/gnus/message.el +++ b/lisp/gnus/message.el @@ -5393,15 +5393,11 @@ Otherwise, generate and save a value for `canlock-password' first." "Process Fcc headers in the current buffer." (let ((case-fold-search t) (buf (current-buffer)) - list file - (mml-externalize-attachments message-fcc-externalize-attachments)) - (save-excursion - (save-restriction - (message-narrow-to-headers) - (setq file (message-fetch-field "fcc" t))) - (when file - (set-buffer (get-buffer-create " *message temp*")) - (erase-buffer) + (mml-externalize-attachments message-fcc-externalize-attachments) + (file (message-field-value "fcc" t)) + list) + (when file + (with-temp-buffer (insert-buffer-substring buf) (message-encode-message-body) (save-restriction @@ -5442,8 +5438,7 @@ Otherwise, generate and save a value for `canlock-password' first." (if (and (file-readable-p file) (mail-file-babyl-p file)) (rmail-output file 1 nil t) (let ((mail-use-rfc822 t)) - (rmail-output file 1 t t)))))) - (kill-buffer (current-buffer)))))) + (rmail-output file 1 t t)))))))))) (defun message-output (filename) "Append this article to Unix/babyl mail file FILENAME." commit 301ee3d0319d489087bc548beb2ea5e7900224b6 Author: Lars Ingebrigtsen Date: Thu Jan 26 21:12:05 2017 +0100 Avoid a regexp overflow in message-goto-body * lisp/gnus/message.el (message-goto-body-1): Avoid using a complicated backtracking regexp, because they may overflow on large headers (bug#21160). diff --git a/lisp/gnus/message.el b/lisp/gnus/message.el index ce0d9769a5..9af38c01ed 100644 --- a/lisp/gnus/message.el +++ b/lisp/gnus/message.el @@ -3111,16 +3111,26 @@ M-RET `message-newline-and-reformat' (break the line and reformat)." (message-goto-body-1)) (defun message-goto-body-1 () + "Go to the body and return point." (goto-char (point-min)) (or (search-forward (concat "\n" mail-header-separator "\n") nil t) - (search-forward-regexp "[^:]+:\\([^\n]\\|\n[ \t]\\)+\n\n" nil t))) + ;; If the message is mangled, find the end of the headers the + ;; hard way. + (progn + ;; Skip past all headers and continuation lines. + (while (looking-at "[^:]+:\\|[\t ]+[^\t ]") + (forward-line 1)) + ;; We're now at the first empty line, so perhaps move past it. + (when (and (eolp) + (not (eobp))) + (forward-line 1)) + (point)))) (defun message-in-body-p () "Return t if point is in the message body." (>= (point) (save-excursion - (message-goto-body-1) - (point)))) + (message-goto-body-1)))) (defun message-goto-eoh () "Move point to the end of the headers." commit b720f1a33636b3764ef82bdb6d69e2d627304fea Author: Lars Ingebrigtsen Date: Thu Jan 26 21:04:00 2017 +0100 Refactor message-goto-body * lisp/gnus/message.el (message-goto-body-1): Refactor out for reuse. diff --git a/lisp/gnus/message.el b/lisp/gnus/message.el index 043ebbc579..ce0d9769a5 100644 --- a/lisp/gnus/message.el +++ b/lisp/gnus/message.el @@ -3108,6 +3108,9 @@ M-RET `message-newline-and-reformat' (break the line and reformat)." (looking-at "[ \t]*\n")) (expand-abbrev)) (push-mark) + (message-goto-body-1)) + +(defun message-goto-body-1 () (goto-char (point-min)) (or (search-forward (concat "\n" mail-header-separator "\n") nil t) (search-forward-regexp "[^:]+:\\([^\n]\\|\n[ \t]\\)+\n\n" nil t))) @@ -3116,9 +3119,7 @@ M-RET `message-newline-and-reformat' (break the line and reformat)." "Return t if point is in the message body." (>= (point) (save-excursion - (goto-char (point-min)) - (or (search-forward (concat "\n" mail-header-separator "\n") nil t) - (search-forward-regexp "[^:]+:\\([^\n]\\|\n[ \t]\\)+\n\n" nil t)) + (message-goto-body-1) (point)))) (defun message-goto-eoh () commit aeecbc09adc46d6a681ed30609ff23cb1c37204b Author: Lars Ingebrigtsen Date: Thu Jan 26 19:45:39 2017 +0100 Fix typo in last checkin * lisp/gnus/nnimap.el (nnimap-shell-program): Document nnimap-shell-program (bug#20651). diff --git a/lisp/gnus/nnimap.el b/lisp/gnus/nnimap.el index 5d38924b57..2943c8dc7d 100644 --- a/lisp/gnus/nnimap.el +++ b/lisp/gnus/nnimap.el @@ -70,8 +70,8 @@ back on `network'.") "ssh %s imapd") "What command to execute to connect to an IMAP server. This will only be used if the connection type is `shell'. See -the `make-network-process' documentation for an explanation of -the format.) +the `open-network-stream' documentation for an explanation of +the format.") (defvoo nnimap-inbox nil "The mail box where incoming mail arrives and should be split out of. commit a1cb68be6c94513c436fd52e4453cb7afe28f2ba Author: Lars Ingebrigtsen Date: Thu Jan 26 19:44:01 2017 +0100 Document nnimap-shell-program * lisp/gnus/nnimap.el (nnimap-shell-program): Document nnimap-shell-program (bug#20651). diff --git a/lisp/gnus/nnimap.el b/lisp/gnus/nnimap.el index 700e86a0c5..5d38924b57 100644 --- a/lisp/gnus/nnimap.el +++ b/lisp/gnus/nnimap.el @@ -67,7 +67,11 @@ back on `network'.") (if (listp imap-shell-program) (car imap-shell-program) imap-shell-program) - "ssh %s imapd")) + "ssh %s imapd") + "What command to execute to connect to an IMAP server. +This will only be used if the connection type is `shell'. See +the `make-network-process' documentation for an explanation of +the format.) (defvoo nnimap-inbox nil "The mail box where incoming mail arrives and should be split out of. commit d32623f040272d9c3bc46b2b1b37c986e7fb8bf1 Author: Lars Ingebrigtsen Date: Thu Jan 26 19:41:56 2017 +0100 Document :shell-command in `make-network-process' * doc/lispref/processes.texi (Network): Document :shell-command. * lisp/net/network-stream.el (open-network-stream): Document the :shell-command parameter (bug#20651). diff --git a/doc/lispref/processes.texi b/doc/lispref/processes.texi index 014a0aed91..58e04a311a 100644 --- a/doc/lispref/processes.texi +++ b/doc/lispref/processes.texi @@ -2414,6 +2414,14 @@ If non-@code{nil}, the host's capability string. The connection type: @samp{plain} or @samp{tls}. @end table +@item :shell-command @var{string-or-nil} +If the connection @code{type} is @code{shell}, this parameter will be +interpreted as a format-spec string that will be executed to make the +connection. The specs available are @samp{%s} for the host name and +@samp{%p} for the port number. For instance, if you want to first ssh +to @samp{gateway} before making a plain connection, then this +parameter could be something like @samp{ssh gateway nc %s %p}. + @end table @end defun diff --git a/lisp/net/network-stream.el b/lisp/net/network-stream.el index 93e1bae5fc..bf60eee673 100644 --- a/lisp/net/network-stream.el +++ b/lisp/net/network-stream.el @@ -139,6 +139,10 @@ a greeting from the server. :nowait, if non-nil, says the connection should be made asynchronously, if possible. +:shell-command is a format-spec string that can be used if :type +is `shell'. It has two specs, %s for host and %p for port +number. Example: \"ssh gateway nc %s %p\". + :tls-parameters is a list that should be supplied if you're opening a TLS connection. The first element is the TLS type (either `gnutls-x509pki' or `gnutls-anon'), and the commit 079b6bebcbf4d556c8d45a667d8e95dcb350dc3f Author: Lars Ingebrigtsen Date: Thu Jan 26 19:21:59 2017 +0100 Gnus doc clarification * lisp/gnus/gnus-sum.el (gnus-summary-save-article): Mention the gnus-prompt-before-saving variable (bug#20500). diff --git a/lisp/gnus/gnus-sum.el b/lisp/gnus/gnus-sum.el index e21d6bdb67..4390a2c07d 100644 --- a/lisp/gnus/gnus-sum.el +++ b/lisp/gnus/gnus-sum.el @@ -11975,7 +11975,10 @@ save those articles instead. The variable `gnus-default-article-saver' specifies the saver function. If the optional second argument NOT-SAVED is non-nil, articles saved -will not be marked as saved." +will not be marked as saved. + +The `gnus-prompt-before-saving' variable says how prompting is +performed." (interactive "P") (require 'gnus-art) (let* ((articles (gnus-summary-work-articles n)) commit d47dadd1687e37e9d399a8b22edf11dd3f1c3f29 Author: Lars Ingebrigtsen Date: Thu Jan 26 19:09:58 2017 +0100 Fix the previous mml patch better * lisp/gnus/mml.el (mml-minibuffer-read-file): Fix the previous patch in a better way (bug#20480). diff --git a/lisp/gnus/mml.el b/lisp/gnus/mml.el index 19c19deced..a4a47f929f 100644 --- a/lisp/gnus/mml.el +++ b/lisp/gnus/mml.el @@ -1249,13 +1249,12 @@ If not set, `default-directory' will be used." (defun mml-minibuffer-read-file (prompt) (let* ((completion-ignored-extensions nil) + (buffer-file-name nil) (file (read-file-name prompt (or mml-default-directory default-directory) - "" t))) + nil t))) ;; Prevent some common errors. This is inspired by similar code in ;; VM. - (when (zerop (length file)) - (error "No file name entered")) (when (file-directory-p file) (error "%s is a directory, cannot attach" file)) (unless (file-exists-p file) commit 9fc67ae2dd49ab574d4858496c33fdd6c00f9c9b Author: Lars Ingebrigtsen Date: Thu Jan 26 19:07:00 2017 +0100 Give a slight better error message in mml-minibuffer-read-file * lisp/gnus/mml.el (mml-minibuffer-read-file): Give a slightly better error message when the user enters nothing (bug#20480). diff --git a/lisp/gnus/mml.el b/lisp/gnus/mml.el index df541fbccc..19c19deced 100644 --- a/lisp/gnus/mml.el +++ b/lisp/gnus/mml.el @@ -1251,9 +1251,11 @@ If not set, `default-directory' will be used." (let* ((completion-ignored-extensions nil) (file (read-file-name prompt (or mml-default-directory default-directory) - nil t))) + "" t))) ;; Prevent some common errors. This is inspired by similar code in ;; VM. + (when (zerop (length file)) + (error "No file name entered")) (when (file-directory-p file) (error "%s is a directory, cannot attach" file)) (unless (file-exists-p file) commit cf60608803b88321a43b7ff110d9caec09c270e7 Author: Mark Oteiza Date: Thu Jan 26 13:12:54 2017 -0500 ; Just use octal * lisp/recentf.el (recentf-save-file-modes): Write file mode in octal. diff --git a/lisp/recentf.el b/lisp/recentf.el index 2b1d22bb90..4f0573911b 100644 --- a/lisp/recentf.el +++ b/lisp/recentf.el @@ -82,7 +82,7 @@ See the command `recentf-save-list'." recentf-mode (recentf-load-list))))) -(defcustom recentf-save-file-modes 384 ;; 0600 +(defcustom recentf-save-file-modes #o600 "Mode bits of recentf save file, as an integer, or nil. If non-nil, after writing `recentf-save-file', set its mode bits to this value. By default give R/W access only to the user who owns that commit 950c0d8969bae1e763016adedc62345c79cfad8a Author: Lars Ingebrigtsen Date: Thu Jan 26 18:32:48 2017 +0100 Make eww buffers prettier in the buffer listing * lisp/net/eww.el (eww-render): Put the currently visited URL into the buffer listing (bug#23738). (eww-render): Ditto. diff --git a/lisp/net/eww.el b/lisp/net/eww.el index 172044a12e..15911f6e85 100644 --- a/lisp/net/eww.el +++ b/lisp/net/eww.el @@ -355,9 +355,11 @@ Currently this means either text/html or application/xhtml+xml." "utf-8")))) (data-buffer (current-buffer)) last-coding-system-used) - ;; Save the https peer status. (with-current-buffer buffer - (plist-put eww-data :peer (plist-get status :peer))) + ;; Save the https peer status. + (plist-put eww-data :peer (plist-get status :peer)) + ;; Make buffer listings more informative. + (setq list-buffers-directory url)) (unwind-protect (progn (cond @@ -849,6 +851,8 @@ the like." (erase-buffer) (insert text) (goto-char (plist-get elem :point)) + ;; Make buffer listings more informative. + (setq list-buffers-directory (plist-get elem :url)) (eww-update-header-line-format)))) (defun eww-next-url () commit 9527d201c1c5a323eb605e260f057b163722712e Author: Lars Ingebrigtsen Date: Thu Jan 26 18:19:46 2017 +0100 Allow mml-attach-file to prompt less * lisp/gnus/mml.el (mml-attach-file): If given a prefix, don't prompt for type/description/disposition, but use defaults (bug#19202). diff --git a/lisp/gnus/mml.el b/lisp/gnus/mml.el index 6d9e24e708..df541fbccc 100644 --- a/lisp/gnus/mml.el +++ b/lisp/gnus/mml.el @@ -1383,12 +1383,23 @@ content-type, a string of the form \"type/subtype\". DESCRIPTION is a one-line description of the attachment. The DISPOSITION specifies how the attachment is intended to be displayed. It can be either \"inline\" (displayed automatically within the message -body) or \"attachment\" (separate from the body)." +body) or \"attachment\" (separate from the body). + +If given a prefix interactively, no prompting will be done for +the TYPE, DESCRIPTION or DISPOSITION values. Instead defaults +will be computed and used." (interactive (let* ((file (mml-minibuffer-read-file "Attach file: ")) - (type (mml-minibuffer-read-type file)) - (description (mml-minibuffer-read-description)) - (disposition (mml-minibuffer-read-disposition type nil file))) + (type (if current-prefix-arg + (or (mm-default-file-encoding file) + "application/octet-stream") + (mml-minibuffer-read-type file))) + (description (if current-prefix-arg + nil + (mml-minibuffer-read-description))) + (disposition (if current-prefix-arg + (mml-content-disposition type file) + (mml-minibuffer-read-disposition type nil file)))) (list file type description disposition))) ;; If in the message header, attach at the end and leave point unchanged. (let ((head (unless (message-in-body-p) (point)))) commit eff6c6ac8503d44cf1d4cb2406fc57148b6a1844 Author: Lars Ingebrigtsen Date: Thu Jan 26 15:07:38 2017 +0100 Don't allow message-newline-and-reformat to be run outside the body * lisp/gnus/message.el (message-newline-and-reformat): Error out if run outside the body of a message (bug#18820). diff --git a/lisp/gnus/message.el b/lisp/gnus/message.el index 4f9dd093fa..043ebbc579 100644 --- a/lisp/gnus/message.el +++ b/lisp/gnus/message.el @@ -3330,6 +3330,8 @@ of lines before the signature intact." "Insert four newlines, and then reformat if inside quoted text. Prefix arg means justify as well." (interactive (list (if current-prefix-arg 'full))) + (unless (message-in-body-p) + (error "This command only works in the body of the message")) (let (quoted point beg end leading-space bolp fill-paragraph-function) (setq point (point)) (beginning-of-line)