commit 7a68ebe0485d049a3fbbfd77d0ba5773e8e6ae87 (HEAD, refs/remotes/origin/master) Author: Paul Eggert Date: Mon Aug 17 23:46:38 2015 -0700 Clarify what happens to match data on failure Problem reported by Ernesto Alfonso (Bug#21279). * doc/lispref/searching.texi (Regexp Search, Simple Match Data): Document more carefully what happens to match data after a failed search. * src/search.c (Fmatch_beginning, Fmatch_end): Document that the return value is undefined if the last search failed. (Fmatch_data): Simplify doc string line 1. diff --git a/doc/lispref/searching.texi b/doc/lispref/searching.texi index 5a05c7c..60360cb 100644 --- a/doc/lispref/searching.texi +++ b/doc/lispref/searching.texi @@ -1102,7 +1102,7 @@ For example, The index of the first character of the string is 0, the index of the second character is 1, and so on. -After this function returns, the index of the first character beyond +If this function finds a match, the index of the first character beyond the match is available as @code{(match-end 0)}. @xref{Match Data}. @example @@ -1425,8 +1425,9 @@ has no text properties. @end defun @defun match-beginning count -This function returns the position of the start of the text matched by the -last regular expression searched for, or a subexpression of it. +If the last regular expression search found a match, this function +returns the position of the start of the matching text or of a +subexpression of it. If @var{count} is zero, then the value is the position of the start of the entire match. Otherwise, @var{count} specifies a subexpression in diff --git a/src/search.c b/src/search.c index 5da99c4..106a462 100644 --- a/src/search.c +++ b/src/search.c @@ -2754,7 +2754,9 @@ SUBEXP, a number, specifies which parenthesized expression in the last regexp. Value is nil if SUBEXPth pair didn't match, or there were less than SUBEXP pairs. -Zero means the entire text matched by the whole regexp or whole string. */) +Zero means the entire text matched by the whole regexp or whole string. + +Return value is undefined if the last search failed. */) (Lisp_Object subexp) { return match_limit (subexp, 1); @@ -2766,14 +2768,16 @@ SUBEXP, a number, specifies which parenthesized expression in the last regexp. Value is nil if SUBEXPth pair didn't match, or there were less than SUBEXP pairs. -Zero means the entire text matched by the whole regexp or whole string. */) +Zero means the entire text matched by the whole regexp or whole string. + +Return value is undefined if the last search failed. */) (Lisp_Object subexp) { return match_limit (subexp, 0); } DEFUN ("match-data", Fmatch_data, Smatch_data, 0, 3, 0, - doc: /* Return a list containing all info on what the last search matched. + doc: /* Return a list describing what the last search matched. Element 2N is `(match-beginning N)'; element 2N + 1 is `(match-end N)'. All the elements are markers or nil (nil if the Nth pair didn't match) if the last match was on a buffer; integers or nil if a string was matched. commit 9a1175cb0a33aeb13601ae8997931a853cb45249 Author: Daiki Ueno Date: Tue Aug 18 15:02:41 2015 +0900 Revert "pinentry.el: Support external passphrase cache" This reverts commit e086e55a664ec27fbca7b3231c4b32cb78a89337. pinentry.el shouldn't directly interact with the secrets service, but ask the caller to cache the passphrase. diff --git a/lisp/net/pinentry.el b/lisp/net/pinentry.el index aee8647..13a15c9 100644 --- a/lisp/net/pinentry.el +++ b/lisp/net/pinentry.el @@ -63,11 +63,6 @@ :type 'integer :group 'pinentry) -(defcustom pinentry-use-secrets nil - "If non-nil, use secrets.el to store passwords in login keyring." - :type 'boolean - :group 'pinentry) - (defvar pinentry--server-process nil) (defvar pinentry--connection-process-list nil) @@ -75,10 +70,6 @@ (put 'pinentry-read-point 'permanent-local t) (defvar pinentry--read-point nil) (put 'pinentry--read-point 'permanent-local t) -(defvar pinentry--allow-external-password-cache nil) -(put 'pinentry--allow-external-password-cache 'permanent-local t) -(defvar pinentry--key-info nil) -(put 'pinentry--key-info 'permanent-local t) (defvar pinentry--prompt-buffer nil) @@ -152,10 +143,6 @@ If local sockets are not supported, this is nil.") (concat prompt (substring short-prompt -2)) query-args))) -(defvar secrets-enabled) -(declare-function secrets-search-items "secrets" (collection &rest attributes)) -(declare-function secrets-get-secret "secrets" (collection item)) - ;;;###autoload (defun pinentry-start () "Start a Pinentry service. @@ -290,23 +277,6 @@ Assuan protocol." (defun pinentry--send-error (process error) (process-send-string process (format "ERR %d %s\n" (car error) (cdr error)))) -(defun pinentry--send-passphrase (process passphrase) - (let (escaped-passphrase encoded-passphrase) - (unwind-protect - (condition-case nil - (progn - (setq escaped-passphrase (pinentry--escape-string passphrase)) - (setq encoded-passphrase (encode-coding-string escaped-passphrase - 'utf-8)) - (pinentry--send-data process encoded-passphrase) - (process-send-string process "OK\n")) - (error - (pinentry--send-error process pinentry--error-cancelled))) - (if escaped-passphrase - (clear-string escaped-passphrase)) - (if encoded-passphrase - (clear-string encoded-passphrase))))) - (defun pinentry--process-filter (process input) (unless (buffer-live-p (process-buffer process)) (let ((buffer (generate-new-buffer " *pinentry*"))) @@ -316,9 +286,7 @@ Assuan protocol." (set-buffer-multibyte nil)) (make-local-variable 'pinentry--read-point) (setq pinentry--read-point (point-min)) - (make-local-variable 'pinentry--labels) - (make-local-variable 'pinentry--allow-external-password-cache) - (make-local-variable 'pinentry--key-info)))) + (make-local-variable 'pinentry--labels)))) (with-current-buffer (process-buffer process) (save-excursion (goto-char (point-max)) @@ -343,79 +311,52 @@ Assuan protocol." ("NOP" (ignore-errors (process-send-string process "OK\n"))) - ("OPTION" - (if (and pinentry-use-secrets - (require 'secrets) - secrets-enabled - (equal string "allow-external-password-cache")) - (setq pinentry--allow-external-password-cache t)) - (ignore-errors - (process-send-string process "OK\n"))) - ("SETKEYINFO" - (setq pinentry--key-info string) - (ignore-errors - (process-send-string process "OK\n"))) ("GETPIN" - (let (passphrase-sent) - (when (and pinentry--allow-external-password-cache - pinentry--key-info) - (let ((items - (secrets-search-items "login" - :keygrip pinentry--key-info))) - (if items - (let (passphrase) - (unwind-protect - (progn - (setq passphrase (secrets-get-secret - "login" - (car items))) - (ignore-errors - (process-send-string - process - "S PASSWORD_FROM_CACHE\n") - (pinentry--send-passphrase - process passphrase) - (setq passphrase-sent t))) - (if passphrase - (clear-string passphrase))))))) - (unless passphrase-sent - (let ((prompt - (or (cdr (assq 'desc pinentry--labels)) - (cdr (assq 'prompt pinentry--labels)) - "")) - (confirm - (not (null (assq 'repeat pinentry--labels)))) - entry) - (if (setq entry (assq 'error pinentry--labels)) - (setq prompt (concat "Error: " - (propertize - (copy-sequence (cdr entry)) - 'face 'error) - "\n" - prompt))) - (if (setq entry (assq 'title pinentry--labels)) - (setq prompt (format "[%s] %s" - (cdr entry) prompt))) - (let (passphrase) - (unwind-protect - (condition-case nil - (progn - (setq passphrase - (pinentry--prompt prompt "Password: " - #'read-passwd - confirm)) - (ignore-errors - (pinentry--send-passphrase process - passphrase) - (process-send-string process "OK\n"))) - (error - (ignore-errors - (pinentry--send-error - process - pinentry--error-cancelled)))) - (if passphrase - (clear-string passphrase)))) - (setq pinentry--labels nil))))) + (let ((prompt + (or (cdr (assq 'desc pinentry--labels)) + (cdr (assq 'prompt pinentry--labels)) + "")) + (confirm (not (null (assq 'repeat pinentry--labels)))) + entry) + (if (setq entry (assq 'error pinentry--labels)) + (setq prompt (concat "Error: " + (propertize + (copy-sequence (cdr entry)) + 'face 'error) + "\n" + prompt))) + (if (setq entry (assq 'title pinentry--labels)) + (setq prompt (format "[%s] %s" + (cdr entry) prompt))) + (let (passphrase escaped-passphrase encoded-passphrase) + (unwind-protect + (condition-case nil + (progn + (setq passphrase + (pinentry--prompt prompt "Password: " + #'read-passwd confirm)) + (setq escaped-passphrase + (pinentry--escape-string + passphrase)) + (setq encoded-passphrase (encode-coding-string + escaped-passphrase + 'utf-8)) + (ignore-errors + (pinentry--send-data + process encoded-passphrase) + (process-send-string process "OK\n"))) + (error + (ignore-errors + (pinentry--send-error + process + pinentry--error-cancelled)))) + (if passphrase + (clear-string passphrase)) + (if escaped-passphrase + (clear-string escaped-passphrase)) + (if encoded-passphrase + (clear-string encoded-passphrase)))) + (setq pinentry--labels nil))) ("CONFIRM" (let ((prompt (or (cdr (assq 'desc pinentry--labels)) commit 9403daff6a8818d9c1ff11de4f339f958f52f3e2 Author: Xue Fuqiao Date: Tue Aug 18 11:42:21 2015 +0800 * doc/emacs/sending.texi (Mail Misc): Fix two index entries for Message mode hooks. diff --git a/doc/emacs/mule.texi b/doc/emacs/mule.texi index ef274c6..477f24e 100644 --- a/doc/emacs/mule.texi +++ b/doc/emacs/mule.texi @@ -539,6 +539,8 @@ searching for what you have already entered. To find out how to input the character after point using the current input method, type @kbd{C-u C-x =}. @xref{Position Info}. +@c TODO: document complex-only/default/t of +@c @code{input-method-verbose-flag} @vindex input-method-verbose-flag @vindex input-method-highlight-flag The variables @code{input-method-highlight-flag} and diff --git a/doc/emacs/sending.texi b/doc/emacs/sending.texi index b4bdb93..49a4aa7 100644 --- a/doc/emacs/sending.texi +++ b/doc/emacs/sending.texi @@ -568,8 +568,8 @@ was yanked, but it checks the text that you yourself inserted (it looks for indentation or @code{mail-yank-prefix} to distinguish the cited lines from your input). @xref{Spelling}. -@vindex mail-mode-hook -@vindex mail-setup-hook +@vindex message-mode-hook +@vindex message-setup-hook Turning on Message mode (which @kbd{C-x m} does automatically) runs the normal hooks @code{text-mode-hook} and @code{message-mode-hook}. Initializing a new outgoing message runs the normal hook commit 2b2eac26c898ef290e29f96cbd1d83ee7ac5b070 Author: Daiki Ueno Date: Tue Aug 18 12:12:17 2015 +0900 epg.el: Make gpgconf output parsing future proof * lisp/epg.el (epg--start): Count the number of fields in "gpgconf --list-options" output. diff --git a/lisp/epg.el b/lisp/epg.el index 7e3cec7..0c8f5c9 100644 --- a/lisp/epg.el +++ b/lisp/epg.el @@ -611,7 +611,9 @@ callback data (if any)." "--list-options" "gpg-agent") 0) (goto-char (point-min)) - (re-search-forward "^allow-emacs-pinentry:.*:1$" nil t)))) + (re-search-forward + "^allow-emacs-pinentry:\\(?:.*:\\)\\{8\\}1" + nil t)))) (pinentry-start)) (setq process-environment (cons (format "INSIDE_EMACS=%s,epg" emacs-version) commit e086e55a664ec27fbca7b3231c4b32cb78a89337 Author: Daiki Ueno Date: Tue Aug 18 11:55:26 2015 +0900 pinentry.el: Support external passphrase cache * lisp/net/pinentry.el (pinentry-use-secrets): New user option. (pinentry--allow-external-password-cache): New local variable. (pinentry--key-info): New local variable. (secrets-enabled, secrets-search-items, secrets-get-secret): Declare. (pinentry--send-passphrase): New function, split from `pinentry--process-filter'. (pinentry--process-filter): Use secrets.el to retrieve passphrase from login keyring. diff --git a/lisp/net/pinentry.el b/lisp/net/pinentry.el index 13a15c9..aee8647 100644 --- a/lisp/net/pinentry.el +++ b/lisp/net/pinentry.el @@ -63,6 +63,11 @@ :type 'integer :group 'pinentry) +(defcustom pinentry-use-secrets nil + "If non-nil, use secrets.el to store passwords in login keyring." + :type 'boolean + :group 'pinentry) + (defvar pinentry--server-process nil) (defvar pinentry--connection-process-list nil) @@ -70,6 +75,10 @@ (put 'pinentry-read-point 'permanent-local t) (defvar pinentry--read-point nil) (put 'pinentry--read-point 'permanent-local t) +(defvar pinentry--allow-external-password-cache nil) +(put 'pinentry--allow-external-password-cache 'permanent-local t) +(defvar pinentry--key-info nil) +(put 'pinentry--key-info 'permanent-local t) (defvar pinentry--prompt-buffer nil) @@ -143,6 +152,10 @@ If local sockets are not supported, this is nil.") (concat prompt (substring short-prompt -2)) query-args))) +(defvar secrets-enabled) +(declare-function secrets-search-items "secrets" (collection &rest attributes)) +(declare-function secrets-get-secret "secrets" (collection item)) + ;;;###autoload (defun pinentry-start () "Start a Pinentry service. @@ -277,6 +290,23 @@ Assuan protocol." (defun pinentry--send-error (process error) (process-send-string process (format "ERR %d %s\n" (car error) (cdr error)))) +(defun pinentry--send-passphrase (process passphrase) + (let (escaped-passphrase encoded-passphrase) + (unwind-protect + (condition-case nil + (progn + (setq escaped-passphrase (pinentry--escape-string passphrase)) + (setq encoded-passphrase (encode-coding-string escaped-passphrase + 'utf-8)) + (pinentry--send-data process encoded-passphrase) + (process-send-string process "OK\n")) + (error + (pinentry--send-error process pinentry--error-cancelled))) + (if escaped-passphrase + (clear-string escaped-passphrase)) + (if encoded-passphrase + (clear-string encoded-passphrase))))) + (defun pinentry--process-filter (process input) (unless (buffer-live-p (process-buffer process)) (let ((buffer (generate-new-buffer " *pinentry*"))) @@ -286,7 +316,9 @@ Assuan protocol." (set-buffer-multibyte nil)) (make-local-variable 'pinentry--read-point) (setq pinentry--read-point (point-min)) - (make-local-variable 'pinentry--labels)))) + (make-local-variable 'pinentry--labels) + (make-local-variable 'pinentry--allow-external-password-cache) + (make-local-variable 'pinentry--key-info)))) (with-current-buffer (process-buffer process) (save-excursion (goto-char (point-max)) @@ -311,52 +343,79 @@ Assuan protocol." ("NOP" (ignore-errors (process-send-string process "OK\n"))) + ("OPTION" + (if (and pinentry-use-secrets + (require 'secrets) + secrets-enabled + (equal string "allow-external-password-cache")) + (setq pinentry--allow-external-password-cache t)) + (ignore-errors + (process-send-string process "OK\n"))) + ("SETKEYINFO" + (setq pinentry--key-info string) + (ignore-errors + (process-send-string process "OK\n"))) ("GETPIN" - (let ((prompt - (or (cdr (assq 'desc pinentry--labels)) - (cdr (assq 'prompt pinentry--labels)) - "")) - (confirm (not (null (assq 'repeat pinentry--labels)))) - entry) - (if (setq entry (assq 'error pinentry--labels)) - (setq prompt (concat "Error: " - (propertize - (copy-sequence (cdr entry)) - 'face 'error) - "\n" - prompt))) - (if (setq entry (assq 'title pinentry--labels)) - (setq prompt (format "[%s] %s" - (cdr entry) prompt))) - (let (passphrase escaped-passphrase encoded-passphrase) - (unwind-protect - (condition-case nil - (progn - (setq passphrase - (pinentry--prompt prompt "Password: " - #'read-passwd confirm)) - (setq escaped-passphrase - (pinentry--escape-string - passphrase)) - (setq encoded-passphrase (encode-coding-string - escaped-passphrase - 'utf-8)) - (ignore-errors - (pinentry--send-data - process encoded-passphrase) - (process-send-string process "OK\n"))) - (error - (ignore-errors - (pinentry--send-error - process - pinentry--error-cancelled)))) - (if passphrase - (clear-string passphrase)) - (if escaped-passphrase - (clear-string escaped-passphrase)) - (if encoded-passphrase - (clear-string encoded-passphrase)))) - (setq pinentry--labels nil))) + (let (passphrase-sent) + (when (and pinentry--allow-external-password-cache + pinentry--key-info) + (let ((items + (secrets-search-items "login" + :keygrip pinentry--key-info))) + (if items + (let (passphrase) + (unwind-protect + (progn + (setq passphrase (secrets-get-secret + "login" + (car items))) + (ignore-errors + (process-send-string + process + "S PASSWORD_FROM_CACHE\n") + (pinentry--send-passphrase + process passphrase) + (setq passphrase-sent t))) + (if passphrase + (clear-string passphrase))))))) + (unless passphrase-sent + (let ((prompt + (or (cdr (assq 'desc pinentry--labels)) + (cdr (assq 'prompt pinentry--labels)) + "")) + (confirm + (not (null (assq 'repeat pinentry--labels)))) + entry) + (if (setq entry (assq 'error pinentry--labels)) + (setq prompt (concat "Error: " + (propertize + (copy-sequence (cdr entry)) + 'face 'error) + "\n" + prompt))) + (if (setq entry (assq 'title pinentry--labels)) + (setq prompt (format "[%s] %s" + (cdr entry) prompt))) + (let (passphrase) + (unwind-protect + (condition-case nil + (progn + (setq passphrase + (pinentry--prompt prompt "Password: " + #'read-passwd + confirm)) + (ignore-errors + (pinentry--send-passphrase process + passphrase) + (process-send-string process "OK\n"))) + (error + (ignore-errors + (pinentry--send-error + process + pinentry--error-cancelled)))) + (if passphrase + (clear-string passphrase)))) + (setq pinentry--labels nil))))) ("CONFIRM" (let ((prompt (or (cdr (assq 'desc pinentry--labels)) commit 3a23c477d90ce7401c24de8610be7d1340cd8ee3 Author: Daiki Ueno Date: Tue Aug 18 11:19:41 2015 +0900 ; pinentry.el: Update header comment and fix typos diff --git a/lisp/net/pinentry.el b/lisp/net/pinentry.el index 05cb124..13a15c9 100644 --- a/lisp/net/pinentry.el +++ b/lisp/net/pinentry.el @@ -43,10 +43,8 @@ ;; subset of the Pinentry Assuan protocol described in (info ;; "(pinentry) Protocol"). ;; -;; NOTE: As of June 2015, this feature requires newer versions of -;; GnuPG (2.1.5+) and Pinentry (not yet released, possibly 0.9.5+). -;; For details, see the discussion on gnupg-devel mailing list: -;; . +;; NOTE: As of August 2015, this feature requires newer versions of +;; GnuPG (2.1.5+) and Pinentry (0.9.5+). ;;; Code: @@ -56,12 +54,12 @@ :group 'external) (defcustom pinentry-popup-prompt-window t - "If non-nil, display status information from epa commands in another window." + "If non-nil, display multiline prompt in another window." :type 'boolean :group 'pinentry) (defcustom pinentry-prompt-window-height 5 - "Number of lines used to display status information." + "Number of lines used to display multiline prompt." :type 'integer :group 'pinentry) commit 9bc757830a9c6edeb950c294a32f058504550148 Author: Daiki Ueno Date: Tue Aug 18 11:09:29 2015 +0900 pinentry.el: Popup window for multiline prompt * lisp/net/pinentry.el (pinentry): New custom group. (pinentry-popup-prompt-window): New user option. (pinentry-prompt-window-height): New user option. (pinentry--prompt-buffer): New variable. (pinentry-prompt-mode-map): New variable. (pinentry-prompt-mode): New function. (pinentry--prompt): New function. (pinentry--process-filter): Use `pinentry--prompt' instead of `read-passwd' and `y-or-n-p'. diff --git a/lisp/net/pinentry.el b/lisp/net/pinentry.el index 7cbe9f5..05cb124 100644 --- a/lisp/net/pinentry.el +++ b/lisp/net/pinentry.el @@ -50,6 +50,21 @@ ;;; Code: +(defgroup pinentry nil + "The Pinentry server" + :version "25.1" + :group 'external) + +(defcustom pinentry-popup-prompt-window t + "If non-nil, display status information from epa commands in another window." + :type 'boolean + :group 'pinentry) + +(defcustom pinentry-prompt-window-height 5 + "Number of lines used to display status information." + :type 'integer + :group 'pinentry) + (defvar pinentry--server-process nil) (defvar pinentry--connection-process-list nil) @@ -58,6 +73,8 @@ (defvar pinentry--read-point nil) (put 'pinentry--read-point 'permanent-local t) +(defvar pinentry--prompt-buffer nil) + ;; We use the same location as `server-socket-dir', when local sockets ;; are supported. (defvar pinentry--socket-dir @@ -82,6 +99,52 @@ If local sockets are not supported, this is nil.") (autoload 'server-ensure-safe-dir "server") +(defvar pinentry-prompt-mode-map + (let ((keymap (make-sparse-keymap))) + (define-key keymap "q" 'quit-window) + keymap)) + +(define-derived-mode pinentry-prompt-mode special-mode "Pinentry" + "Major mode for `pinentry--prompt-buffer'." + (buffer-disable-undo) + (setq truncate-lines t + buffer-read-only t)) + +(defun pinentry--prompt (prompt short-prompt query-function &rest query-args) + (if (and (string-match "\n" prompt) + pinentry-popup-prompt-window) + (save-window-excursion + (delete-other-windows) + (unless (and pinentry--prompt-buffer + (buffer-live-p pinentry--prompt-buffer)) + (setq pinentry--prompt-buffer (generate-new-buffer "*Pinentry*"))) + (if (get-buffer-window pinentry--prompt-buffer) + (delete-window (get-buffer-window pinentry--prompt-buffer))) + (with-current-buffer pinentry--prompt-buffer + (let ((inhibit-read-only t) + buffer-read-only) + (erase-buffer) + (insert prompt)) + (pinentry-prompt-mode) + (goto-char (point-min))) + (if (> (window-height) + pinentry-prompt-window-height) + (set-window-buffer (split-window nil + (- (window-height) + pinentry-prompt-window-height)) + pinentry--prompt-buffer) + (pop-to-buffer pinentry--prompt-buffer) + (if (> (window-height) pinentry-prompt-window-height) + (shrink-window (- (window-height) + pinentry-prompt-window-height)))) + (prog1 (apply query-function short-prompt query-args) + (quit-window))) + (apply query-function + ;; Append a suffix to the prompt, which can be derived from + ;; SHORT-PROMPT. + (concat prompt (substring short-prompt -2)) + query-args))) + ;;;###autoload (defun pinentry-start () "Start a Pinentry service. @@ -267,16 +330,13 @@ Assuan protocol." (if (setq entry (assq 'title pinentry--labels)) (setq prompt (format "[%s] %s" (cdr entry) prompt))) - (if (string-match ":?[ \n]*\\'" prompt) - (setq prompt (concat - (substring - prompt 0 (match-beginning 0)) ": "))) (let (passphrase escaped-passphrase encoded-passphrase) (unwind-protect (condition-case nil (progn (setq passphrase - (read-passwd prompt confirm)) + (pinentry--prompt prompt "Password: " + #'read-passwd confirm)) (setq escaped-passphrase (pinentry--escape-string passphrase)) @@ -350,7 +410,7 @@ Assuan protocol." (substring prompt 0 (match-beginning 0)) " "))) (if (condition-case nil - (y-or-n-p prompt) + (pinentry--prompt prompt "Confirm? " #'y-or-n-p) (quit)) (ignore-errors (process-send-string process "OK\n")) commit c24a067eacef1b5292116e367b0213c27f1195b9 Author: Katsumi Yamaoka Date: Tue Aug 18 01:31:57 2015 +0000 message.el: Silent the byte compiler * lisp/gnus/message.el (message-overlay-put, message-make-overlay) (message-kill-all-overlays, message-overlays-in, message-overlay-get) (message-delete-overlay, message-window-inside-pixel-edges): Declare before using. diff --git a/lisp/gnus/message.el b/lisp/gnus/message.el index 7e39aa9..a5196c8 100644 --- a/lisp/gnus/message.el +++ b/lisp/gnus/message.el @@ -2005,6 +2005,22 @@ You must have the \"hashcash\" binary installed, see `hashcash-path'." (unless (fboundp 'mail-dont-reply-to) (defalias 'mail-dont-reply-to 'rmail-dont-reply-to)) +(eval-and-compile + (if (featurep 'emacs) + (progn + (defalias 'message-delete-overlay 'delete-overlay) + (defun message-kill-all-overlays () + (mapcar #'delete-overlay (overlays-in (point-min) (point-max)))) + (defalias 'message-make-overlay 'make-overlay) + (defalias 'message-overlay-get 'overlay-get) + (defalias 'message-overlay-put 'overlay-put) + (defalias 'message-overlays-in 'overlays-in) + (defalias 'message-window-inside-pixel-edges + 'window-inside-pixel-edges)) + (defun message-kill-all-overlays () + (map-extents (lambda (extent ignore) (delete-extent extent)))) + (defalias 'message-window-inside-pixel-edges 'ignore))) + ;;; @@ -7885,20 +7901,6 @@ which specify the range to operate on." (goto-char (prog1 (mark t) (set-marker (mark-marker) (point))))) -(if (featurep 'emacs) - (progn - (defalias 'message-delete-overlay 'delete-overlay) - (defun message-kill-all-overlays () - (mapcar #'delete-overlay (overlays-in (point-min) (point-max)))) - (defalias 'message-make-overlay 'make-overlay) - (defalias 'message-overlay-get 'overlay-get) - (defalias 'message-overlay-put 'overlay-put) - (defalias 'message-overlays-in 'overlays-in) - (defalias 'message-window-inside-pixel-edges 'window-inside-pixel-edges)) - (defun message-kill-all-overlays () - (map-extents (lambda (extent ignore) (delete-extent extent)))) - (defalias 'message-window-inside-pixel-edges 'ignore)) - ;; Support for toolbar (defvar tool-bar-mode) commit 0b67a2005656395d1f8dbdaebf0150893e130aaf Author: Katsumi Yamaoka Date: Mon Aug 17 23:21:29 2015 +0000 * lisp/gnus/message.el (message-overlay-get, message-overlays-in) (message-window-inside-pixel-edges): XEmacs compatible functions. diff --git a/lisp/gnus/message.el b/lisp/gnus/message.el index bc6185f..7e39aa9 100644 --- a/lisp/gnus/message.el +++ b/lisp/gnus/message.el @@ -7885,13 +7885,19 @@ which specify the range to operate on." (goto-char (prog1 (mark t) (set-marker (mark-marker) (point))))) -(defalias 'message-make-overlay 'make-overlay) -(defalias 'message-delete-overlay 'delete-overlay) -(defalias 'message-overlay-put 'overlay-put) -(defun message-kill-all-overlays () - (if (featurep 'xemacs) - (map-extents (lambda (extent ignore) (delete-extent extent))) - (mapcar #'delete-overlay (overlays-in (point-min) (point-max))))) +(if (featurep 'emacs) + (progn + (defalias 'message-delete-overlay 'delete-overlay) + (defun message-kill-all-overlays () + (mapcar #'delete-overlay (overlays-in (point-min) (point-max)))) + (defalias 'message-make-overlay 'make-overlay) + (defalias 'message-overlay-get 'overlay-get) + (defalias 'message-overlay-put 'overlay-put) + (defalias 'message-overlays-in 'overlays-in) + (defalias 'message-window-inside-pixel-edges 'window-inside-pixel-edges)) + (defun message-kill-all-overlays () + (map-extents (lambda (extent ignore) (delete-extent extent)))) + (defalias 'message-window-inside-pixel-edges 'ignore)) ;; Support for toolbar (defvar tool-bar-mode) @@ -8559,12 +8565,12 @@ Used in `message-simplify-recipients'." (defun message-toggle-image-thumbnails () "For any included image files, insert a thumbnail of that image." (interactive) - (let ((overlays (overlays-in (point-min) (point-max))) + (let ((overlays (message-overlays-in (point-min) (point-max))) (displayed nil)) (while overlays (let ((overlay (car overlays))) - (when (overlay-get overlay 'put-image) - (delete-overlay overlay) + (when (message-overlay-get overlay 'put-image) + (message-delete-overlay overlay) (setq displayed t))) (setq overlays (cdr overlays))) (unless displayed @@ -8572,7 +8578,7 @@ Used in `message-simplify-recipients'." (goto-char (point-min)) (while (re-search-forward " Date: Mon Aug 17 22:18:21 2015 +0000 * message.el (message-toggle-image-thumbnails): New command. diff --git a/lisp/gnus/message.el b/lisp/gnus/message.el index 447a8d7..bc6185f 100644 --- a/lisp/gnus/message.el +++ b/lisp/gnus/message.el @@ -8546,14 +8546,44 @@ Used in `message-simplify-recipients'." ;;; multipart/related and HTML support. (defun message-make-html-message-with-image-files (files) + "Make a message containing the current dired-marked image files." (interactive (list (dired-get-marked-files nil current-prefix-arg))) (message-mail) (message-goto-body) (insert "<#part type=text/html>\n\n") (dolist (file files) (insert (format "\n\n" file))) + (message-toggle-image-thumbnails) (message-goto-to)) +(defun message-toggle-image-thumbnails () + "For any included image files, insert a thumbnail of that image." + (interactive) + (let ((overlays (overlays-in (point-min) (point-max))) + (displayed nil)) + (while overlays + (let ((overlay (car overlays))) + (when (overlay-get overlay 'put-image) + (delete-overlay overlay) + (setq displayed t))) + (setq overlays (cdr overlays))) + (unless displayed + (save-excursion + (goto-char (point-min)) + (while (re-search-forward " Date: Mon Aug 17 13:00:36 2015 -0700 Merge branch 'master' of git.sv.gnu.org:/srv/git/emacs commit b892438d7a424e61f174d8b8a57e78077aa96a0c Author: Noah Friedman Date: Mon Aug 17 12:59:12 2015 -0700 (blink-matching-open): Restore point before calling minibuffer-message. diff --git a/lisp/simple.el b/lisp/simple.el index 00c25db..a9ef93e 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -7005,8 +7005,11 @@ The function should return non-nil if the two tokens do not match.") (delete-overlay blink-matching--overlay))))) (t (save-excursion - (goto-char blinkpos) - (let ((open-paren-line-string + (let* ((orig-pos (prog1 + (point) + (goto-char blinkpos))) + + (open-paren-line-string ;; Show what precedes the open in its line, if anything. (cond ((save-excursion (skip-chars-backward " \t") (not (bolp))) @@ -7034,6 +7037,9 @@ The function should return non-nil if the two tokens do not match.") (buffer-substring blinkpos (1+ blinkpos)))) ;; There is nothing to show except the char itself. (t (buffer-substring blinkpos (1+ blinkpos)))))) + ;; Because minibuffer-message causes a full redisplay, go back + ;; to the original point before that happens. + (goto-char orig-pos) (minibuffer-message "Matches %s" (substring-no-properties open-paren-line-string))))))))) commit 62f65abf279da30e6fff4bcf3462b548aeb2dc97 Author: Ronnie Schnell Date: Mon Aug 17 15:30:15 2015 -0400 Update version number in header (now matches help) diff --git a/lisp/play/dunnet.el b/lisp/play/dunnet.el index 877e5db..205189e 100644 --- a/lisp/play/dunnet.el +++ b/lisp/play/dunnet.el @@ -4,7 +4,7 @@ ;; Author: Ron Schnell ;; Created: 25 Jul 1992 -;; Version: 2.01 +;; Version: 2.02 ;; Keywords: games ;; This file is part of GNU Emacs. commit 7f2b98d09d113e0f9b1fffb0524622adfafe3ac4 Author: Paul Eggert Date: Mon Aug 17 12:00:54 2015 -0700 Curved quotes in --batch diagnostics in non-UTF-8 When run with --batch, check that curved quotes are compatible with the system locale before outputting them in diagnostics. Problem reported by Eli Zaretskii in: http://lists.gnu.org/archive/html/emacs-devel/2015-08/msg00594.html * lisp/startup.el (command-line): Set internal--text-quoting-flag after the standard display table is initialized. * src/doc.c (default_to_grave_quoting_style): New function. (text_quoting_style): Use it. (text_quoting_flag): New static var, visible to Lisp as internal--text-quoting-flag. * src/emacs.c: Include if available. (using_utf8): New function. (main): Use it to initialize text_quoting_flag. * src/regex.h (btowc) [WIDE_CHAR_SUPPORT && emacs]: Don't define, as it's not needed and it clashes with wchar.h. diff --git a/lisp/startup.el b/lisp/startup.el index 3248a99..ec159c2 100644 --- a/lisp/startup.el +++ b/lisp/startup.el @@ -1023,6 +1023,7 @@ please check its value") (or standard-display-table (setq standard-display-table (make-display-table))) (aset standard-display-table (car char-repl) (cdr char-repl)))) + (setq internal--text-quoting-flag t) ;; Re-evaluate predefined variables whose initial value depends on ;; the runtime context. diff --git a/src/doc.c b/src/doc.c index 977953d..9c9bdf3 100644 --- a/src/doc.c +++ b/src/doc.c @@ -688,24 +688,31 @@ the same file name is found in the `doc-directory'. */) static unsigned char const LSQM[] = { uLSQM0, uLSQM1, uLSQM2 }; static unsigned char const RSQM[] = { uRSQM0, uRSQM1, uRSQM2 }; +static bool +default_to_grave_quoting_style (void) +{ + if (!text_quoting_flag) + return true; + if (! DISP_TABLE_P (Vstandard_display_table)) + return false; + Lisp_Object dv = DISP_CHAR_VECTOR (XCHAR_TABLE (Vstandard_display_table), + LEFT_SINGLE_QUOTATION_MARK); + return (VECTORP (dv) && ASIZE (dv) == 1 + && EQ (AREF (dv, 0), make_number ('`'))); +} + /* Return the current effective text quoting style. */ enum text_quoting_style text_quoting_style (void) { - if (EQ (Vtext_quoting_style, Qgrave)) + if (NILP (Vtext_quoting_style) + ? default_to_grave_quoting_style () + : EQ (Vtext_quoting_style, Qgrave)) return GRAVE_QUOTING_STYLE; else if (EQ (Vtext_quoting_style, Qstraight)) return STRAIGHT_QUOTING_STYLE; - else if (NILP (Vtext_quoting_style) - && DISP_TABLE_P (Vstandard_display_table)) - { - Lisp_Object dv = DISP_CHAR_VECTOR (XCHAR_TABLE (Vstandard_display_table), - LEFT_SINGLE_QUOTATION_MARK); - if (VECTORP (dv) && ASIZE (dv) == 1 - && EQ (AREF (dv, 0), make_number ('`'))) - return GRAVE_QUOTING_STYLE; - } - return CURVE_QUOTING_STYLE; + else + return CURVE_QUOTING_STYLE; } DEFUN ("substitute-command-keys", Fsubstitute_command_keys, @@ -1045,6 +1052,10 @@ The default value nil acts like ‘curve’ if curved single quotes are displayable, and like ‘grave’ otherwise. */); Vtext_quoting_style = Qnil; + DEFVAR_BOOL ("internal--text-quoting-flag", text_quoting_flag, + doc: /* If nil, a nil ‘text-quoting-style’ is treated as ‘grave’. */); + /* Initialized by ‘main’. */ + defsubr (&Sdocumentation); defsubr (&Sdocumentation_property); defsubr (&Ssnarf_documentation); diff --git a/src/emacs.c b/src/emacs.c index 80bb70c..1392209 100644 --- a/src/emacs.c +++ b/src/emacs.c @@ -95,6 +95,10 @@ extern void moncontrol (int mode); #include #endif +#if HAVE_WCHAR_H +# include +#endif + #ifdef HAVE_SETRLIMIT #include #include @@ -344,6 +348,19 @@ setlocale (int cat, char const *locale) } #endif +/* True if the current system locale uses UTF-8 encoding. */ +static bool +using_utf8 (void) +{ +#ifdef HAVE_WCHAR_H + wchar_t wc; + mbstate_t mbs = { 0 }; + return mbrtowc (&wc, "\xc4\x80", 2, &mbs) == 2 && wc == 0x100; +#else + return false; +#endif +} + /* Report a fatal error due to signal SIG, output a backtrace of at most BACKTRACE_LIMIT lines, and exit. */ @@ -924,6 +941,7 @@ main (int argc, char **argv) fixup_locale must wait until later, since it builds strings. */ if (do_initial_setlocale) setlocale (LC_ALL, ""); + text_quoting_flag = using_utf8 (); inhibit_window_system = 0; diff --git a/src/regex.h b/src/regex.h index 3dfecf0..c89ca46 100644 --- a/src/regex.h +++ b/src/regex.h @@ -603,7 +603,9 @@ typedef wchar_t re_wchar_t; # define re_wctype_to_bit(cc) 0 #else # define CHAR_CLASS_MAX_LENGTH 9 /* Namely, `multibyte'. */ -# define btowc(c) c +# ifndef emacs +# define btowc(c) c +# endif /* Character classes. */ typedef enum { RECC_ERROR = 0, commit 481859ba71253725f4aed4877b89123e11aaef0c Author: Glenn Morris Date: Mon Aug 17 14:12:20 2015 -0400 * doc/misc/tramp.texi (Configuration): Reword to avoid warning from makeinfo about spurious "Note:" cross-reference, and for grammar. diff --git a/doc/misc/tramp.texi b/doc/misc/tramp.texi index c9af6dd..012c586 100644 --- a/doc/misc/tramp.texi +++ b/doc/misc/tramp.texi @@ -524,9 +524,9 @@ can use to connect to remote hosts and transfer files If you don't know which method is right for you, see @xref{Default Method}. -@strong{Note:} In the following description, setting of user options -or variables is explained. Not all of them are autoloaded by -@value{emacsname}. All examples expect, that you have loaded +@strong{Note} that the following descriptions reference the setting of +user options or variables, not all of which are autoloaded by +@value{emacsname}. All examples assume that you have loaded @value{tramp} first: @lisp commit c1f34a993c4ae0f13d5dfc3f1da885e510e931e6 Author: Ilya Zakharevich Date: Mon Aug 17 20:15:30 2015 +0300 Minor change in variable initialization on MS-Windows * src/w32fns.c : Initialize to -1. (deliver_wm_chars): If after_deadkey is zero, don't set after_dead non-zero. diff --git a/src/w32fns.c b/src/w32fns.c index 4b29e64..2cb99c9 100644 --- a/src/w32fns.c +++ b/src/w32fns.c @@ -2941,7 +2941,11 @@ get_wm_chars (HWND aWnd, int *buf, int buflen, int ignore_ctrl, int ctrl, environments!) should have different values. Moreover, switching to a non-Emacs window with the same language environment, and using (dead)keys there would change the value stored in the kernel, but not this value. */ -static int after_deadkey = 0; +/* A layout may emit deadkey=0. It looks like this would reset the state + of the kernel's finite automaton (equivalent to emiting 0-length string, + which is otherwise impossible in the dead-key map of a layout). + Be ready to treat the case when this delivers WM_(SYS)DEADCHAR. */ +static int after_deadkey = -1; int deliver_wm_chars (int do_translate, HWND hwnd, UINT msg, UINT wParam, @@ -2951,7 +2955,7 @@ deliver_wm_chars (int do_translate, HWND hwnd, UINT msg, UINT wParam, points to a keypress. (However, the "old style" TranslateMessage() would deliver at most 16 of them.) Be on a safe side, and prepare to treat many more. */ - int ctrl_cnt, buf[1024], count, is_dead, after_dead = (after_deadkey != -1); + int ctrl_cnt, buf[1024], count, is_dead, after_dead = (after_deadkey > 0); /* Since the keypress processing logic of Windows has a lot of state, it is important to call TranslateMessage() for every keyup/keydown, AND commit 94cf37c8de3bc14cdadfe84dc8c405a477adbe3e Author: Ilya Zakharevich Date: Mon Aug 17 20:08:45 2015 +0300 Fix a bug with LWindow key remapping on MS-Windows * src/w32fns.c (deliver_wm_chars): Fix a typo. (Bug#21276) diff --git a/src/w32fns.c b/src/w32fns.c index 4532fb9..4b29e64 100644 --- a/src/w32fns.c +++ b/src/w32fns.c @@ -3131,7 +3131,7 @@ deliver_wm_chars (int do_translate, HWND hwnd, UINT msg, UINT wParam, } else if (wmsg.dwModifiers & (alt_modifier | meta_modifier) || (console_modifiers - & (RIGHT_WIN_PRESSED | RIGHT_WIN_PRESSED + & (LEFT_WIN_PRESSED | RIGHT_WIN_PRESSED | APPS_PRESSED | SCROLLLOCK_ON))) { /* Pure Alt (or combination of Alt, Win, APPS, scrolllock. */ commit c7a64af460b9c64107cebc9a2852efd0e61291d9 Author: Eli Zaretskii Date: Mon Aug 17 19:58:28 2015 +0300 Improve fontset support for latest OTF script tags * lisp/international/fontset.el (otf-script-alist): Add some missing script tags. (setup-default-fontset): Include settings for v2 versions of the script tags used by some modern OTF/TTF fonts. diff --git a/lisp/international/fontset.el b/lisp/international/fontset.el index 98f0170..4667a00 100644 --- a/lisp/international/fontset.el +++ b/lisp/international/fontset.el @@ -303,6 +303,9 @@ (lepc . lepcha) (limb . limbu) (linb . linear_b) + (lisu . lisu) + (lyci . lycian) + (lydi . lydian) (mlym . malayalam) (mlm2 . malayalam) (mand . mandaic) @@ -312,6 +315,7 @@ (mero . meroitic) (mong . mongolian) (musc . musical-symbol) + (mym2 . burmese) (mymr . burmese) (nko\ . nko) (ogam . ogham) @@ -346,6 +350,7 @@ (taml . tamil) (tml2 . tamil) (telu . telugu) + (tel2 . telugu) (thaa . thaana) (thai . thai) (tibt . tibetan) @@ -471,19 +476,29 @@ (nil . "TIS620*") (nil . "ISO8859-11")) - (devanagari ,(font-spec :registry "iso10646-1" :otf '(deva nil (rphf))) + (devanagari ,(font-spec :registry "iso10646-1" :otf '(dev2 nil (rphf))) + ,(font-spec :registry "iso10646-1" :otf '(deva nil (rphf))) (nil . "iso10646.indian-1")) - (bengali ,(font-spec :registry "iso10646-1" :otf '(beng nil (rphf)))) - (gurmukhi ,(font-spec :registry "iso10646-1" :otf '(guru nil (blwf)))) - (gujarati ,(font-spec :registry "iso10646-1" :otf '(gujr nil (rphf)))) - (oriya ,(font-spec :registry "iso10646-1" :otf '(orya nil (rphf)))) - (tamil ,(font-spec :registry "iso10646-1" :otf '(taml nil (akhn)))) - (telugu ,(font-spec :registry "iso10646-1" :otf '(telu nil (blwf)))) - (kannada ,(font-spec :registry "iso10646-1" :otf '(knda nil (rphf)))) + (bengali ,(font-spec :registry "iso10646-1" :otf '(bng2 nil (rphf))) + ,(font-spec :registry "iso10646-1" :otf '(beng nil (rphf)))) + (gurmukhi ,(font-spec :registry "iso10646-1" :otf '(gur2 nil (blwf))) + ,(font-spec :registry "iso10646-1" :otf '(guru nil (blwf)))) + (gujarati ,(font-spec :registry "iso10646-1" :otf '(gjr2 nil (rphf))) + ,(font-spec :registry "iso10646-1" :otf '(gujr nil (rphf)))) + (oriya ,(font-spec :registry "iso10646-1" :otf '(ory2 nil (rphf))) + ,(font-spec :registry "iso10646-1" :otf '(orya nil (rphf)))) + (tamil ,(font-spec :registry "iso10646-1" :otf '(tml2 nil (akhn))) + ,(font-spec :registry "iso10646-1" :otf '(taml nil (akhn)))) + (telugu ,(font-spec :registry "iso10646-1" :otf '(tel2 nil (blwf))) + ,(font-spec :registry "iso10646-1" :otf '(telu nil (blwf)))) + (kannada ,(font-spec :registry "iso10646-1" :otf '(knd2 nil (rphf))) + ,(font-spec :registry "iso10646-1" :otf '(knda nil (rphf)))) (sinhala ,(font-spec :registry "iso10646-1" :otf '(sinh nil (akhn)))) - (malayalam ,(font-spec :registry "iso10646-1" :otf '(mlym nil (akhn)))) + (malayalam ,(font-spec :registry "iso10646-1" :otf '(mlm2 nil (akhn))) + ,(font-spec :registry "iso10646-1" :otf '(mlym nil (akhn)))) - (burmese ,(font-spec :registry "iso10646-1" :otf '(mymr nil nil)) + (burmese ,(font-spec :registry "iso10646-1" :otf '(mym2 nil nil)) + ,(font-spec :registry "iso10646-1" :otf '(mymr nil nil)) ,(font-spec :registry "iso10646-1" :script 'burmese)) (lao ,(font-spec :registry "iso10646-1" :otf '(lao\ nil nil (mark)))