From fbf74c158ea81ff6349f68760f8861c1c497c989 Mon Sep 17 00:00:00 2001 From: Dima Kogan Date: Tue, 31 Jan 2017 07:46:10 -0800 Subject: Revert two accidental commits This reverts commit f3c77d11af65f3b319b1784b4c3cf08c51aa7997. This reverts commit 3c941b900007c9e79c00af0f21d88154f6d8af1a. --- lisp/comint.el | 11 +++++----- lisp/emacs-lisp/debug.el | 54 ------------------------------------------------ lisp/shell.el | 2 -- 3 files changed, 5 insertions(+), 62 deletions(-) (limited to 'lisp') diff --git a/lisp/comint.el b/lisp/comint.el index c82c3d09df3..830f4ca88f9 100644 --- a/lisp/comint.el +++ b/lisp/comint.el @@ -1879,7 +1879,6 @@ Similarly for Soar, Scheme, etc." (let ((echo-len (- comint-last-input-end comint-last-input-start))) ;; Wait for all input to be echoed: - (while (and (> (+ comint-last-input-end echo-len) (point-max)) (accept-process-output proc) @@ -1891,7 +1890,6 @@ Similarly for Soar, Scheme, etc." ;; (+ comint-last-input-start ;; (- (point-max) comint-last-input-end)) nil comint-last-input-end (point-max))))) - (if (and (<= (+ comint-last-input-end echo-len) (point-max)) @@ -1903,7 +1901,6 @@ Similarly for Soar, Scheme, etc." ;; Certain parts of the text to be deleted may have ;; been mistaken for prompts. We have to prevent ;; problems when `comint-prompt-read-only' is non-nil. - (let ((inhibit-read-only t)) (delete-region comint-last-input-end (+ comint-last-input-end echo-len)) @@ -1912,7 +1909,6 @@ Similarly for Soar, Scheme, etc." (goto-char comint-last-input-end) (comint-update-fence))))))) - ;; This used to call comint-output-filter-functions, ;; but that scrolled the buffer in undesirable ways. (run-hook-with-args 'comint-output-filter-functions ""))))) @@ -2243,7 +2239,10 @@ the current line with any initial string matching the regexp (null (get-char-property (setq bof (field-beginning)) 'field))) (field-string-no-properties bof) (comint-bol) - (buffer-substring-no-properties (point) (line-end-position))))) + (buffer-substring-no-properties (point) + (if comint-use-prompt-regexp + (line-end-position) + (field-end)))))) (defun comint-copy-old-input () "Insert after prompt old input at point as new input to be edited. @@ -2670,7 +2669,7 @@ This command is like `M-.' in bash." (set-marker comint-insert-previous-argument-last-start-pos (point)) ;; Insert the argument. (let ((input-string (comint-previous-input-string 0))) - (when (string-match "[ \t\n]*&[ \t\n]*$" input-string) + (when (string-match "[ \t\n]*&" input-string) ;; strip terminating '&' (setq input-string (substring input-string 0 (match-beginning 0)))) (insert (comint-arguments input-string index index))) diff --git a/lisp/emacs-lisp/debug.el b/lisp/emacs-lisp/debug.el index faa323f733a..cb77148c285 100644 --- a/lisp/emacs-lisp/debug.el +++ b/lisp/emacs-lisp/debug.el @@ -816,60 +816,6 @@ Redefining FUNCTION also cancels it." '((depth . -100))) function) -;;;###autoload -;; (defun debug-on-set (symbol) -;; "Request FUNCTION to invoke debugger each time it is called. - -;; When called interactively, prompt for FUNCTION in the minibuffer. - -;; This works by modifying the definition of FUNCTION. If you tell the -;; debugger to continue, FUNCTION's execution proceeds. If FUNCTION is a -;; normal function or a macro written in Lisp, you can also step through -;; its execution. FUNCTION can also be a primitive that is not a special -;; form, in which case stepping is not possible. Break-on-entry for -;; primitive functions only works when that function is called from Lisp. - -;; Use \\[cancel-debug-on-entry] to cancel the effect of this command. -;; Redefining FUNCTION also cancels it." -;; (interactive -;; (let ((v (variable-at-point)) -;; (enable-recursive-minibuffers t) -;; (orig-buffer (current-buffer)) -;; val) -;; (setq val (completing-read -;; (if (symbolp v) -;; (format -;; "Debug on set to symbol (default %s): " v) -;; "Debug on set to symbol: ") -;; #'help--symbol-completion-table -;; (lambda (vv) -;; ;; In case the variable only exists in the buffer -;; ;; the command we switch back to that buffer before -;; ;; we examine the variable. -;; (with-current-buffer orig-buffer -;; (or (get vv 'variable-documentation) -;; (and (boundp vv) (not (keywordp vv)))))) -;; t nil nil -;; (if (symbolp v) (symbol-name v)))) -;; (list (if (equal val "") -;; v (intern val))))) - - - -;; (interactive -;; (let* ((var-default (variable-at-point)) -;; (var (completing-read -;; (if var-default -;; (format "Debug on set to symbol (default %s): " var-default) -;; "Debug on set to symbol: ") -;; nil -;; #'boundp -;; t nil nil (symbol-name var-default)))) -;; (list (if (equal var "") var-default (intern var))))) -;; (advice-add function :before #'debug--implement-debug-on-entry -;; '((depth . -100))) -;; function) - (defun debug--function-list () "List of functions currently set for debug on entry." (let ((funs '())) diff --git a/lisp/shell.el b/lisp/shell.el index c7ba64ecf4e..c8a8555d632 100644 --- a/lisp/shell.el +++ b/lisp/shell.el @@ -1000,8 +1000,6 @@ command again." (let ((pt (point)) (regexp (concat - ;; comint-process-echoes is the thing that breaks the - ;; throbber (if comint-process-echoes ;; Skip command echo if the process echoes (concat "\\(" (regexp-quote shell-dirstack-query) "\n\\)") -- cgit v1.2.1 From 189df8262e54c486658784801da3e90b29a548df Mon Sep 17 00:00:00 2001 From: Dima Kogan Date: Mon, 30 Jan 2017 21:43:32 -0800 Subject: Handle patch terminators produced by git and bzr patch export Patch by Juri Linkov posted in the #9597 bug report * lisp/vc/diff-mode.el (diff-sanity-check-hunk): Find and ignore terminator (Bug #9597, #5302) --- lisp/vc/diff-mode.el | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) (limited to 'lisp') diff --git a/lisp/vc/diff-mode.el b/lisp/vc/diff-mode.el index e609ca9f943..7ffa115bde4 100644 --- a/lisp/vc/diff-mode.el +++ b/lisp/vc/diff-mode.el @@ -437,6 +437,9 @@ See http://lists.gnu.org/archive/html/emacs-devel/2007-11/msg01990.html") (defconst diff-hunk-header-re (concat "^\\(?:" diff-hunk-header-re-unified ".*\\|\\*\\{15\\}.*\n\\*\\*\\* .+ \\*\\*\\*\\*\\|[0-9]+\\(,[0-9]+\\)?[acd][0-9]+\\(,[0-9]+\\)?\\)$")) (defconst diff-file-header-re (concat "^\\(--- .+\n\\+\\+\\+ \\|\\*\\*\\* .+\n--- \\|[^-+!<>0-9@* \n]\\).+\n" (substring diff-hunk-header-re 1))) + +(defconst diff-separator-re "^--+ ?$") + (defvar diff-narrowed-to nil) (defun diff-hunk-style (&optional style) @@ -1537,15 +1540,20 @@ Only works for unified diffs." (pcase (char-after) (?\s (cl-decf before) (cl-decf after) t) (?- - (if (and (looking-at diff-file-header-re) - (zerop before) (zerop after)) - ;; No need to query: this is a case where two patches - ;; are concatenated and only counting the lines will - ;; give the right result. Let's just add an empty - ;; line so that our code which doesn't count lines - ;; will not get confused. - (progn (save-excursion (insert "\n")) nil) - (cl-decf before) t)) + (cond + ((and (looking-at diff-separator-re) + (zerop before) (zerop after)) + nil) + ((and (looking-at diff-file-header-re) + (zerop before) (zerop after)) + ;; No need to query: this is a case where two patches + ;; are concatenated and only counting the lines will + ;; give the right result. Let's just add an empty + ;; line so that our code which doesn't count lines + ;; will not get confused. + (save-excursion (insert "\n")) nil) + (t + (cl-decf before) t))) (?+ (cl-decf after) t) (_ (cond -- cgit v1.2.1 From 18a3fccd89d04afc13ce7b4561e224874c317283 Mon Sep 17 00:00:00 2001 From: Juri Linkov Date: Tue, 31 Jan 2017 17:36:06 +0100 Subject: Allow C-s C-w to yank ' to the search ring in the Gnus article buffer * lisp/gnus/gnus-art.el (gnus-article-mode-syntax-table): Make M-. in article buffers work for `foo' strings, and still allow C-s C-w to yank ' to the search ring (bug#22248). --- lisp/gnus/gnus-art.el | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'lisp') diff --git a/lisp/gnus/gnus-art.el b/lisp/gnus/gnus-art.el index 43e1231914c..a4ff840f755 100644 --- a/lisp/gnus/gnus-art.el +++ b/lisp/gnus/gnus-art.el @@ -1713,9 +1713,10 @@ regexp." ;; (modify-syntax-entry ?- "w" table) (modify-syntax-entry ?> ")<" table) (modify-syntax-entry ?< "(>" table) - ;; make M-. in article buffers work for `foo' strings - (modify-syntax-entry ?' " " table) - (modify-syntax-entry ?` " " table) + ;; make M-. in article buffers work for `foo' strings, + ;; and still allow C-s C-w to yank ' to the search ring + (modify-syntax-entry ?' "'" table) + (modify-syntax-entry ?` "'" table) table) "Syntax table used in article mode buffers. Initialized from `text-mode-syntax-table'.") -- cgit v1.2.1 From d1c931009004aef847105b7bac6b6ffafd985b82 Mon Sep 17 00:00:00 2001 From: Lars Ingebrigtsen Date: Tue, 31 Jan 2017 17:52:51 +0100 Subject: DOn't use string-as-unibyte in Gnus * lisp/gnus/nnmail.el (nnmail-parse-active): Don't use string-as-unibyte. (nnmail-insert-xref): Ditto. * lisp/gnus/canlock.el (canlock-make-cancel-key): Ditto. * lisp/gnus/gnus-art.el (gnus-article-browse-html-parts): Ditto. * lisp/gnus/gnus-srvr.el (gnus-browse-foreign-server): Ditto. (gnus-browse-foreign-server): Ditto. (gnus-browse-foreign-server): Ditto. * lisp/gnus/gnus-start.el (gnus-update-active-hashtb-from-killed): Ditto. (gnus-read-newsrc-el-file): Ditto. * lisp/gnus/mml.el (mml-generate-mime-1): Ditto. * lisp/gnus/nnir.el (nnir-get-active): Ditto. (nnir-get-active): Ditto. --- lisp/gnus/canlock.el | 2 +- lisp/gnus/gnus-art.el | 3 ++- lisp/gnus/gnus-srvr.el | 10 ++++++---- lisp/gnus/gnus-start.el | 4 ++-- lisp/gnus/mml.el | 5 +++-- lisp/gnus/nnir.el | 10 ++++++---- lisp/gnus/nnmail.el | 7 ++++--- 7 files changed, 24 insertions(+), 17 deletions(-) (limited to 'lisp') diff --git a/lisp/gnus/canlock.el b/lisp/gnus/canlock.el index 9e13ced4670..6c28b1c66df 100644 --- a/lisp/gnus/canlock.el +++ b/lisp/gnus/canlock.el @@ -90,7 +90,7 @@ buffer does not look like a news message." (canlock-sha1 (concat opad (canlock-sha1 - (concat ipad (string-as-unibyte message-id)))))))) + (concat ipad (encode-coding-string message-id 'utf-8)))))))) (defun canlock-narrow-to-header () "Narrow the buffer to the head of the message." diff --git a/lisp/gnus/gnus-art.el b/lisp/gnus/gnus-art.el index a4ff840f755..d96c511ec0d 100644 --- a/lisp/gnus/gnus-art.el +++ b/lisp/gnus/gnus-art.el @@ -2938,7 +2938,8 @@ message header will be added to the bodies of the \"text/html\" parts." (encode-coding-string title coding)) body content)) - (setq eheader (string-as-unibyte (buffer-string)) + (setq eheader (encode-coding-string + (buffer-string) 'utf-8) body content))) (erase-buffer) (mm-disable-multibyte) diff --git a/lisp/gnus/gnus-srvr.el b/lisp/gnus/gnus-srvr.el index bed5993b9c1..67744cebc87 100644 --- a/lisp/gnus/gnus-srvr.el +++ b/lisp/gnus/gnus-srvr.el @@ -821,12 +821,13 @@ claim them." (while (not (eobp)) (ignore-errors (push (cons - (string-as-unibyte + (encode-coding-string (buffer-substring (point) (progn (skip-chars-forward "^ \t") - (point)))) + (point))) + 'utf-8) (let ((last (read cur))) (cons (read cur) last))) groups)) @@ -834,7 +835,7 @@ claim them." (while (not (eobp)) (ignore-errors (push (cons - (string-as-unibyte + (encode-coding-string (if (eq (char-after) ?\") (read cur) (let ((p (point)) (name "")) @@ -846,7 +847,8 @@ claim them." (skip-chars-forward "^ \t\\\\") (setq name (concat name (buffer-substring p (point))))) - name))) + name)) + 'utf-8) (let ((last (read cur))) (cons (read cur) last))) groups)) diff --git a/lisp/gnus/gnus-start.el b/lisp/gnus/gnus-start.el index be46339cd38..2cefc78fb9e 100644 --- a/lisp/gnus/gnus-start.el +++ b/lisp/gnus/gnus-start.el @@ -1990,7 +1990,7 @@ backend check whether the group actually exists." (while lists (setq killed (car lists)) (while killed - (gnus-sethash (string-as-unibyte (car killed)) nil hashtb) + (gnus-sethash (encode-coding-string (car killed) 'utf-8) nil hashtb) (setq killed (cdr killed))) (setq lists (cdr lists))))) @@ -2453,7 +2453,7 @@ If FORCE is non-nil, the .newsrc file is read." (dolist (elem gnus-newsrc-alist) ;; Protect against broken .newsrc.el files. (when (car elem) - (setcar elem (string-as-unibyte (car elem))))) + (setcar elem (encode-coding-string (car elem) 'utf-8)))) (gnus-make-hashtable-from-newsrc-alist) (when (file-newer-than-file-p file ding-file) ;; Old format quick file diff --git a/lisp/gnus/mml.el b/lisp/gnus/mml.el index 3a31349d378..aaadf0c7778 100644 --- a/lisp/gnus/mml.el +++ b/lisp/gnus/mml.el @@ -696,9 +696,10 @@ be \"related\" or \"alternate\"." (set-buffer-multibyte nil) (cond ((cdr (assq 'buffer cont)) - (insert (string-as-unibyte + (insert (encode-coding-string (with-current-buffer (cdr (assq 'buffer cont)) - (buffer-string))))) + (buffer-string)) + 'utf-8))) ((and filename (not (equal (cdr (assq 'nofile cont)) "yes"))) (let ((coding-system-for-read mm-binary-coding-system)) diff --git a/lisp/gnus/nnir.el b/lisp/gnus/nnir.el index 9640f2c746f..174be65035f 100644 --- a/lisp/gnus/nnir.el +++ b/lisp/gnus/nnir.el @@ -1818,19 +1818,20 @@ article came from is also searched." (if (eq (car method) 'nntp) (while (not (eobp)) (ignore-errors - (push (string-as-unibyte + (push (encode-coding-string (gnus-group-full-name (buffer-substring (point) (progn (skip-chars-forward "^ \t") (point))) - method)) + method) + 'utf-8) groups)) (forward-line)) (while (not (eobp)) (ignore-errors - (push (string-as-unibyte + (push (encode-coding-string (if (eq (char-after) ?\") (gnus-group-full-name (read cur) method) (let ((p (point)) (name "")) @@ -1842,7 +1843,8 @@ article came from is also searched." (skip-chars-forward "^ \t\\\\") (setq name (concat name (buffer-substring p (point))))) - (gnus-group-full-name name method)))) + (gnus-group-full-name name method))) + 'utf-8) groups)) (forward-line))))) groups)) diff --git a/lisp/gnus/nnmail.el b/lisp/gnus/nnmail.el index 3f2e08171e0..224d5db5427 100644 --- a/lisp/gnus/nnmail.el +++ b/lisp/gnus/nnmail.el @@ -665,7 +665,7 @@ nn*-request-list should have been called before calling this function." (setq group (symbol-name group))) (if (and (numberp (setq max (read buffer))) (numberp (setq min (read buffer)))) - (push (list (string-as-unibyte group) (cons min max)) + (push (list (encode-coding-string group 'utf-8) (cons min max)) group-assoc))) (error nil)) (widen) @@ -1251,8 +1251,9 @@ Return the number of characters in the body." (insert (if (mm-multibyte-p) (string-as-multibyte (format " %s:%d" (caar group-alist) (cdar group-alist))) - (string-as-unibyte - (format " %s:%d" (caar group-alist) (cdar group-alist))))) + (encode-coding-string + (format " %s:%d" (caar group-alist) (cdar group-alist)) + 'utf-8))) (setq group-alist (cdr group-alist))) (insert "\n"))) -- cgit v1.2.1 From 52515f1133f2b87c573524d83c86b08e70ce1c30 Mon Sep 17 00:00:00 2001 From: Ted Zlatanov Date: Tue, 31 Jan 2017 14:12:41 -0500 Subject: auth-source-user-and-password: add forgotten user parameter * lisp/auth-source.el (auth-source-user-and-password): Use accidentally unused "user" parameter. Reported by Oscar Najera . --- lisp/auth-source.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lisp') diff --git a/lisp/auth-source.el b/lisp/auth-source.el index c26935fcc97..7402ab21d74 100644 --- a/lisp/auth-source.el +++ b/lisp/auth-source.el @@ -2129,7 +2129,7 @@ MODE can be \"login\" or \"password\"." (if user (auth-source-search :host host - :user "yourusername" + :user user :max 1 :require '(:user :secret) :create nil) -- cgit v1.2.1 From 5af51bd4451ae6d00ab878a7cfc6782280a81c84 Mon Sep 17 00:00:00 2001 From: Ted Zlatanov Date: Tue, 31 Jan 2017 14:17:58 -0500 Subject: read-multiple-choice: explain dialog popups more * lisp/emacs-lisp/subr-x.el (read-multiple-choice): Explain when a graphical popup is used and how it can be avoided. --- lisp/emacs-lisp/subr-x.el | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'lisp') diff --git a/lisp/emacs-lisp/subr-x.el b/lisp/emacs-lisp/subr-x.el index 7736225b5fa..52331b9ad36 100644 --- a/lisp/emacs-lisp/subr-x.el +++ b/lisp/emacs-lisp/subr-x.el @@ -214,6 +214,11 @@ user enters `recenter', `scroll-up', or `scroll-down' responses, perform the requested window recentering or scrolling and ask again. +When `use-dialog-box' is t (the default), this function can pop +up a dialog window to collect the user input. That functionality +requires `display-popup-menus-p' to return t. Otherwise, a text +dialog will be used. + The return value is the matching entry from the CHOICES list. Usage example: -- cgit v1.2.1 From 12da2a5beafc4595fe4dd922431ba9f013b84830 Mon Sep 17 00:00:00 2001 From: Mark Oteiza Date: Tue, 31 Jan 2017 19:46:28 -0500 Subject: ; Bump let-alist * lisp/emacs-lisp/let-alist.el: Bump micro version (bug#24641). --- lisp/emacs-lisp/let-alist.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lisp') diff --git a/lisp/emacs-lisp/let-alist.el b/lisp/emacs-lisp/let-alist.el index a45fc0a05c3..cf82fe3ec63 100644 --- a/lisp/emacs-lisp/let-alist.el +++ b/lisp/emacs-lisp/let-alist.el @@ -4,7 +4,7 @@ ;; Author: Artur Malabarba ;; Package-Requires: ((emacs "24.1")) -;; Version: 1.0.4 +;; Version: 1.0.5 ;; Keywords: extensions lisp ;; Prefix: let-alist ;; Separator: - -- cgit v1.2.1 From d805757618092d5d46b8a95d2a046146c4916dc6 Mon Sep 17 00:00:00 2001 From: Michael Albinus Date: Wed, 1 Feb 2017 10:06:37 +0100 Subject: Fix a subtle problem in Tramp with timers * lisp/net/tramp.el (tramp-accept-process-output): Change argument list. Make it work when called inside a timer. See . --- lisp/net/tramp.el | 30 ++++++++++++++++++++++++------ 1 file changed, 24 insertions(+), 6 deletions(-) (limited to 'lisp') diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index fc7fdd30850..48dcd5edd11 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el @@ -3614,18 +3614,36 @@ connection buffer." ;;; Utility functions: -(defun tramp-accept-process-output (&optional proc timeout timeout-msecs) +(defun tramp-accept-process-output (proc timeout) "Like `accept-process-output' for Tramp processes. This is needed in order to hide `last-coding-system-used', which is set for process communication also." + ;; FIXME: There are problems, when an asynchronous process runs in + ;; parallel, and also timers are active. See + ;; . + (when (and timer-event-last + (string-prefix-p "*tramp/" (process-name proc)) + (let (result) + (maphash + (lambda (key _value) + (and (processp key) + (not (string-prefix-p "*tramp/" (process-name key))) + (tramp-compat-process-live-p key) + (setq result t))) + tramp-cache-data) + result)) + (sit-for 0.01 'nodisp)) (with-current-buffer (process-buffer proc) (let (buffer-read-only last-coding-system-used) ;; Under Windows XP, accept-process-output doesn't return - ;; sometimes. So we add an additional timeout. - (with-timeout ((or timeout 1)) - (accept-process-output proc timeout timeout-msecs (and proc t))) - (tramp-message proc 10 "%s %s\n%s" - proc (process-status proc) (buffer-string))))) + ;; sometimes. So we add an additional timeout. JUST-THIS-ONE + ;; is set due to Bug#12145. + (tramp-message + proc 10 "%s %s %s\n%s" + proc (process-status proc) + (with-timeout (timeout) + (accept-process-output proc timeout nil t)) + (buffer-string))))) (defun tramp-check-for-regexp (proc regexp) "Check, whether REGEXP is contained in process buffer of PROC. -- cgit v1.2.1 From 5d61ef0de9a3f5b1be9e93465cb88aae995975ba Mon Sep 17 00:00:00 2001 From: Lars Ingebrigtsen Date: Wed, 1 Feb 2017 13:48:02 +0100 Subject: Revert "DOn't use string-as-unibyte in Gnus" This reverts commit d1c931009004aef847105b7bac6b6ffafd985b82. Not all the cases where we had string-as-unibyte were characters, so this needs to be considered more thoroughly before being redone. --- lisp/gnus/canlock.el | 2 +- lisp/gnus/gnus-art.el | 3 +-- lisp/gnus/gnus-srvr.el | 10 ++++------ lisp/gnus/gnus-start.el | 4 ++-- lisp/gnus/mml.el | 5 ++--- lisp/gnus/nnir.el | 10 ++++------ lisp/gnus/nnmail.el | 7 +++---- 7 files changed, 17 insertions(+), 24 deletions(-) (limited to 'lisp') diff --git a/lisp/gnus/canlock.el b/lisp/gnus/canlock.el index 6c28b1c66df..9e13ced4670 100644 --- a/lisp/gnus/canlock.el +++ b/lisp/gnus/canlock.el @@ -90,7 +90,7 @@ buffer does not look like a news message." (canlock-sha1 (concat opad (canlock-sha1 - (concat ipad (encode-coding-string message-id 'utf-8)))))))) + (concat ipad (string-as-unibyte message-id)))))))) (defun canlock-narrow-to-header () "Narrow the buffer to the head of the message." diff --git a/lisp/gnus/gnus-art.el b/lisp/gnus/gnus-art.el index d96c511ec0d..a4ff840f755 100644 --- a/lisp/gnus/gnus-art.el +++ b/lisp/gnus/gnus-art.el @@ -2938,8 +2938,7 @@ message header will be added to the bodies of the \"text/html\" parts." (encode-coding-string title coding)) body content)) - (setq eheader (encode-coding-string - (buffer-string) 'utf-8) + (setq eheader (string-as-unibyte (buffer-string)) body content))) (erase-buffer) (mm-disable-multibyte) diff --git a/lisp/gnus/gnus-srvr.el b/lisp/gnus/gnus-srvr.el index 67744cebc87..bed5993b9c1 100644 --- a/lisp/gnus/gnus-srvr.el +++ b/lisp/gnus/gnus-srvr.el @@ -821,13 +821,12 @@ claim them." (while (not (eobp)) (ignore-errors (push (cons - (encode-coding-string + (string-as-unibyte (buffer-substring (point) (progn (skip-chars-forward "^ \t") - (point))) - 'utf-8) + (point)))) (let ((last (read cur))) (cons (read cur) last))) groups)) @@ -835,7 +834,7 @@ claim them." (while (not (eobp)) (ignore-errors (push (cons - (encode-coding-string + (string-as-unibyte (if (eq (char-after) ?\") (read cur) (let ((p (point)) (name "")) @@ -847,8 +846,7 @@ claim them." (skip-chars-forward "^ \t\\\\") (setq name (concat name (buffer-substring p (point))))) - name)) - 'utf-8) + name))) (let ((last (read cur))) (cons (read cur) last))) groups)) diff --git a/lisp/gnus/gnus-start.el b/lisp/gnus/gnus-start.el index 2cefc78fb9e..be46339cd38 100644 --- a/lisp/gnus/gnus-start.el +++ b/lisp/gnus/gnus-start.el @@ -1990,7 +1990,7 @@ backend check whether the group actually exists." (while lists (setq killed (car lists)) (while killed - (gnus-sethash (encode-coding-string (car killed) 'utf-8) nil hashtb) + (gnus-sethash (string-as-unibyte (car killed)) nil hashtb) (setq killed (cdr killed))) (setq lists (cdr lists))))) @@ -2453,7 +2453,7 @@ If FORCE is non-nil, the .newsrc file is read." (dolist (elem gnus-newsrc-alist) ;; Protect against broken .newsrc.el files. (when (car elem) - (setcar elem (encode-coding-string (car elem) 'utf-8)))) + (setcar elem (string-as-unibyte (car elem))))) (gnus-make-hashtable-from-newsrc-alist) (when (file-newer-than-file-p file ding-file) ;; Old format quick file diff --git a/lisp/gnus/mml.el b/lisp/gnus/mml.el index aaadf0c7778..3a31349d378 100644 --- a/lisp/gnus/mml.el +++ b/lisp/gnus/mml.el @@ -696,10 +696,9 @@ be \"related\" or \"alternate\"." (set-buffer-multibyte nil) (cond ((cdr (assq 'buffer cont)) - (insert (encode-coding-string + (insert (string-as-unibyte (with-current-buffer (cdr (assq 'buffer cont)) - (buffer-string)) - 'utf-8))) + (buffer-string))))) ((and filename (not (equal (cdr (assq 'nofile cont)) "yes"))) (let ((coding-system-for-read mm-binary-coding-system)) diff --git a/lisp/gnus/nnir.el b/lisp/gnus/nnir.el index 174be65035f..9640f2c746f 100644 --- a/lisp/gnus/nnir.el +++ b/lisp/gnus/nnir.el @@ -1818,20 +1818,19 @@ article came from is also searched." (if (eq (car method) 'nntp) (while (not (eobp)) (ignore-errors - (push (encode-coding-string + (push (string-as-unibyte (gnus-group-full-name (buffer-substring (point) (progn (skip-chars-forward "^ \t") (point))) - method) - 'utf-8) + method)) groups)) (forward-line)) (while (not (eobp)) (ignore-errors - (push (encode-coding-string + (push (string-as-unibyte (if (eq (char-after) ?\") (gnus-group-full-name (read cur) method) (let ((p (point)) (name "")) @@ -1843,8 +1842,7 @@ article came from is also searched." (skip-chars-forward "^ \t\\\\") (setq name (concat name (buffer-substring p (point))))) - (gnus-group-full-name name method))) - 'utf-8) + (gnus-group-full-name name method)))) groups)) (forward-line))))) groups)) diff --git a/lisp/gnus/nnmail.el b/lisp/gnus/nnmail.el index 224d5db5427..3f2e08171e0 100644 --- a/lisp/gnus/nnmail.el +++ b/lisp/gnus/nnmail.el @@ -665,7 +665,7 @@ nn*-request-list should have been called before calling this function." (setq group (symbol-name group))) (if (and (numberp (setq max (read buffer))) (numberp (setq min (read buffer)))) - (push (list (encode-coding-string group 'utf-8) (cons min max)) + (push (list (string-as-unibyte group) (cons min max)) group-assoc))) (error nil)) (widen) @@ -1251,9 +1251,8 @@ Return the number of characters in the body." (insert (if (mm-multibyte-p) (string-as-multibyte (format " %s:%d" (caar group-alist) (cdar group-alist))) - (encode-coding-string - (format " %s:%d" (caar group-alist) (cdar group-alist)) - 'utf-8))) + (string-as-unibyte + (format " %s:%d" (caar group-alist) (cdar group-alist))))) (setq group-alist (cdr group-alist))) (insert "\n"))) -- cgit v1.2.1 From 94ad13b93c6fc099a353c8eb27c00a68ee79a952 Mon Sep 17 00:00:00 2001 From: Alan Mackenzie Date: Wed, 1 Feb 2017 20:20:09 +0000 Subject: Allow C++ nested brace-list-entries to be better indented. This fixes bug #24431. The key change of this bug fix is correctly analyzing nested brace lists when the opening element stands on the same line as both its introductory brace and an enclosing parameter list parenthesis. * list/progmodes/cc-align.el (c-lineup-under-anchor): New line-up function. * list/progmodes/cc-engine.el (c-looking-at-or-maybe-in-bracelist): Accept the presence of exactly an identifier between an open parenthesis and an open brace as evidence of the brace starting a brace list. (c-looking-at-statement-block): New function, extracted from c-looking-at-inexpr-block. Enhance it to analyze inner blocks recursively when needed. (c-looking-at-inexpr-block): Extract new function (see above) and call it. (c-add-stmt-syntax): Enhance, with new &optional parameter, to supply the prime syntactic symbol with a fixed anchor point. When this is used, restrict all added syntactic symbols to those having an anchor point on the same line. Add, in addition to the current additional symbols, c-brace-list-entry when needed; use c-looking-at-statement-block to determine the latter. (c-guess-basic-syntax, CASE 9D): Use c-add-stmt-syntax rather than just c-add-syntax, to assemble the syntactic context of a 'brace-list-entry, thus getting, possibly, several accompanying syntactic entries. * lisp/progmodes/cc-styles.el (c-style-alist, "gnu" style): New entry for 'brace-list-intro, namely c-lineup-arglist-intro-after-paren. * lisp/progmodes/cc-vars.el (c-offsets-alist): Change the factory default offset for 'brace-list-entry from 0 to c-lineup-under-anchor. * doc/misc/cc-mode.texi (Syntactic Symbols): Amend the definition of brace-list-intro. (Brace List Symbols): Amend the example to show the new analysis of brace lists when the first element comes on the same line as the opening brace. (Misc Line-Up): Document the new line-up function c-lineup-under-anchor. --- lisp/progmodes/cc-align.el | 12 ++++++ lisp/progmodes/cc-engine.el | 101 +++++++++++++++++++++++++++++++------------- lisp/progmodes/cc-styles.el | 1 + lisp/progmodes/cc-vars.el | 2 +- 4 files changed, 86 insertions(+), 30 deletions(-) (limited to 'lisp') diff --git a/lisp/progmodes/cc-align.el b/lisp/progmodes/cc-align.el index 7cb36c4396b..0f7e4b598dc 100644 --- a/lisp/progmodes/cc-align.el +++ b/lisp/progmodes/cc-align.el @@ -1221,6 +1221,18 @@ Works with: arglist-cont, arglist-cont-nonempty." (vector (progn (goto-char alignto) (current-column))))))) +(defun c-lineup-under-anchor (langelem) + "Line up the current line directly under the anchor position in LANGELEM. + +This is like 0, except it supersedes any indentation already calculated for +previous syntactic elements in the syntactic context. + +Works with: Any syntactic symbol which has an anchor position." + (save-excursion + (goto-char (c-langelem-pos langelem)) + (vector (current-column)))) + + (defun c-lineup-dont-change (langelem) "Do not change the indentation of the current line. diff --git a/lisp/progmodes/cc-engine.el b/lisp/progmodes/cc-engine.el index fd7aa50840f..dfd7aebd569 100644 --- a/lisp/progmodes/cc-engine.el +++ b/lisp/progmodes/cc-engine.el @@ -10260,13 +10260,22 @@ comment at the start of cc-engine.el for more info." (t nil))))) (setq pos (point)) - (if (and after-type-id-pos - (goto-char after-type-id-pos) - (setq res (c-back-over-member-initializers)) - (goto-char res) - (eq (car (c-beginning-of-decl-1 lim)) 'same)) - (cons (point) nil) ; Return value. - + (cond + ((and after-type-id-pos + (goto-char after-type-id-pos) + (setq res (c-back-over-member-initializers)) + (goto-char res) + (eq (car (c-beginning-of-decl-1 lim)) 'same)) + (cons (point) nil)) ; Return value. + + ((and after-type-id-pos + (progn + (c-backward-syntactic-ws) + (eq (char-before) ?\())) + ;; Single identifier between '(' and '{'. We have a bracelist. + (cons after-type-id-pos nil)) + + (t (goto-char pos) ;; Checks to do on all sexps before the brace, up to the ;; beginning of the statement. @@ -10368,7 +10377,7 @@ comment at the start of cc-engine.el for more info." ; languages where ; `c-opt-inexpr-brace-list-key' is ; non-nil and we have macros. - (t t))) ;; The caller can go up one level. + (t t)))) ;; The caller can go up one level. ))) (defun c-inside-bracelist-p (containing-sexp paren-state) @@ -10493,6 +10502,30 @@ comment at the start of cc-engine.el for more info." (c-at-statement-start-p)) (make-obsolete 'c-looking-at-bos 'c-at-statement-start-p "22.1") +(defun c-looking-at-statement-block () + ;; Point is at an opening brace. If this is a statement block (i.e. the + ;; elements in it are terminated by semicolons) return t. Otherwise, return + ;; nil. + (let ((here (point))) + (prog1 + (if (c-go-list-forward) + (let ((there (point))) + (backward-char) + (c-syntactic-skip-backward + "^;," here t) + (cond + ((eq (char-before) ?\;) t) + ((eq (char-before) ?,) nil) + (t (goto-char here) + (forward-char) + (and (c-syntactic-re-search-forward "{" there t t) + (progn (backward-char) + (c-looking-at-statement-block)))))) + (forward-char) + (and (c-syntactic-re-search-forward "[;,]" nil t t) + (eq (char-before) ?\;))) + (goto-char here)))) + (defun c-looking-at-inexpr-block (lim containing-sexp &optional check-at-end) ;; Return non-nil if we're looking at the beginning of a block ;; inside an expression. The value returned is actually a cons of @@ -10648,15 +10681,7 @@ comment at the start of cc-engine.el for more info." (and (c-major-mode-is 'c++-mode) (save-excursion (goto-char block-follows) - (if (c-go-list-forward) - (progn - (backward-char) - (c-syntactic-skip-backward - "^;," block-follows t) - (not (eq (char-before) ?\;))) - (or (not (c-syntactic-re-search-forward - "[;,]" nil t t)) - (not (eq (char-before) ?\;))))))) + (not (c-looking-at-statement-block))))) nil (cons 'inexpr-statement (point))))) @@ -10792,17 +10817,20 @@ comment at the start of cc-engine.el for more info." syntax-extra-args stop-at-boi-only containing-sexp - paren-state) + paren-state + &optional fixed-anchor) ;; Add the indicated SYNTAX-SYMBOL to `c-syntactic-context', extending it as ;; needed with further syntax elements of the types `substatement', - ;; `inexpr-statement', `arglist-cont-nonempty', `statement-block-intro', and - ;; `defun-block-intro'. + ;; `inexpr-statement', `arglist-cont-nonempty', `statement-block-intro', + ;; `defun-block-intro', and `brace-list-intro'. ;; - ;; Do the generic processing to anchor the given syntax symbol on - ;; the preceding statement: Skip over any labels and containing - ;; statements on the same line, and then search backward until we - ;; find a statement or block start that begins at boi without a - ;; label or comment. + ;; Do the generic processing to anchor the given syntax symbol on the + ;; preceding statement: First skip over any labels and containing statements + ;; on the same line. If FIXED-ANCHOR is non-nil, use this as the + ;; anchor-point for the given syntactic symbol, and don't make syntactic + ;; entries for constructs beginning on lines before that containing + ;; ANCHOR-POINT. Otherwise search backward until we find a statement or + ;; block start that begins at boi without a label or comment. ;; ;; Point is assumed to be at the prospective anchor point for the ;; given SYNTAX-SYMBOL. More syntax entries are added if we need to @@ -10831,6 +10859,7 @@ comment at the start of cc-engine.el for more info." (let ((syntax-last c-syntactic-context) (boi (c-point 'boi)) + (anchor-boi (c-point 'boi)) ;; Set when we're on a label, so that we don't stop there. ;; FIXME: To be complete we should check if we're on a label ;; now at the start. @@ -10908,7 +10937,9 @@ comment at the start of cc-engine.el for more info." (c-add-syntax 'substatement nil)))) ))) - containing-sexp) + containing-sexp + (or (null fixed-anchor) + (> containing-sexp anchor-boi))) ;; Now we have to go out of this block. (goto-char containing-sexp) @@ -10982,6 +11013,14 @@ comment at the start of cc-engine.el for more info." (cdr (assoc (match-string 1) c-other-decl-block-key-in-symbols-alist)) (max (c-point 'boi paren-pos) (point)))) + ((save-excursion + (goto-char paren-pos) + (c-looking-at-or-maybe-in-bracelist containing-sexp)) + (if (save-excursion + (goto-char paren-pos) + (c-looking-at-statement-block)) + (c-add-syntax 'defun-block-intro nil) + (c-add-syntax 'brace-list-intro nil))) (t (c-add-syntax 'defun-block-intro nil)))) (c-add-syntax 'statement-block-intro nil))) @@ -11001,7 +11040,10 @@ comment at the start of cc-engine.el for more info." (setq q (cdr (car p))) ; e.g. (nil 28) [from (arglist-cont-nonempty nil 28)] (while q (unless (car q) - (setcar q (point))) + (setcar q (if (or (cdr p) + (null fixed-anchor)) + (point) + fixed-anchor))) (setq q (cdr q))) (setq p (cdr p)))) ))) @@ -12354,7 +12396,8 @@ comment at the start of cc-engine.el for more info." (c-forward-syntactic-ws (c-point 'eol)) (c-looking-at-special-brace-list (point))))) (c-add-syntax 'brace-entry-open (point)) - (c-add-syntax 'brace-list-entry (point)) + (c-add-stmt-syntax 'brace-list-entry nil t containing-sexp + paren-state (point)) )) )))) @@ -12848,7 +12891,7 @@ Cannot combine absolute offsets %S and %S in `add' method" ;; ;; Note that topmost-intro always has an anchor position at bol, for ;; historical reasons. It's often used together with other symbols - ;; that has more sane positions. Since we always use the first + ;; that have more sane positions. Since we always use the first ;; found anchor position, we rely on that these other symbols always ;; precede topmost-intro in the LANGELEMS list. ;; diff --git a/lisp/progmodes/cc-styles.el b/lisp/progmodes/cc-styles.el index d3505490505..b3848a74f97 100644 --- a/lisp/progmodes/cc-styles.el +++ b/lisp/progmodes/cc-styles.el @@ -67,6 +67,7 @@ (arglist-close . c-lineup-arglist) (inline-open . 0) (brace-list-open . +) + (brace-list-intro . c-lineup-arglist-intro-after-paren) (topmost-intro-cont . (first c-lineup-topmost-intro-cont c-lineup-gnu-DEFUN-intro-cont)))) diff --git a/lisp/progmodes/cc-vars.el b/lisp/progmodes/cc-vars.el index a6a96d15188..1114b21381d 100644 --- a/lisp/progmodes/cc-vars.el +++ b/lisp/progmodes/cc-vars.el @@ -1115,7 +1115,7 @@ can always override the use of `c-default-style' by making calls to ;; Anchor pos: At the brace list decl start(*). (brace-list-intro . +) ;; Anchor pos: At the brace list decl start(*). - (brace-list-entry . 0) + (brace-list-entry . c-lineup-under-anchor) ;; Anchor pos: At the first non-ws char after the open paren if ;; the first token is on the same line, otherwise boi at that ;; token. -- cgit v1.2.1 From 910e63de89500e577be266b9cf8c815c5b47cfce Mon Sep 17 00:00:00 2001 From: Mark Oteiza Date: Wed, 1 Feb 2017 20:51:00 -0500 Subject: Prevent creating thumbnails of all gif frames With the previous defaults, doing image-dired on a directory with an animated foo.gif would cause creation of foo.thumb-N.gif for each of N frames in foo.gif. By default image-dired looks for foo.thumb.gif, so there additionally is no usable thumbnail after all the needless effort. image-dired never handled animation, regardless. * lisp/image-dired.el: Mention limitation. (image-dired-cmd-create-thumbnail-options): (image-dired-cmd-create-temp-image-options): (image-dired-cmd-create-standard-thumbnail-options): Append [0] to filename to indicate only converting the 0th frame. (image-dired-display-image-mode): Don't show a cursor. --- lisp/image-dired.el | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'lisp') diff --git a/lisp/image-dired.el b/lisp/image-dired.el index 901225fa2e9..2a4064560a7 100644 --- a/lisp/image-dired.el +++ b/lisp/image-dired.el @@ -94,6 +94,7 @@ ;; * WARNING: The "database" format used might be changed so keep a ;; backup of `image-dired-db-file' when testing new versions. ;; +;; * `image-dired-display-image-mode' does not support animation ;; ;; TODO ;; ==== @@ -228,7 +229,7 @@ Used together with `image-dired-cmd-create-thumbnail-options'." :group 'image-dired) (defcustom image-dired-cmd-create-thumbnail-options - '("-size" "%wx%h" "%f" "-resize" "%wx%h>" "-strip" "jpeg:%t") + '("-size" "%wx%h" "%f[0]" "-resize" "%wx%h>" "-strip" "jpeg:%t") "Options of command used to create thumbnail image. Used with `image-dired-cmd-create-thumbnail-program'. Available format specifiers are: %w which is replaced by @@ -246,7 +247,7 @@ Used together with `image-dired-cmd-create-temp-image-options'." :group 'image-dired) (defcustom image-dired-cmd-create-temp-image-options - '("-size" "%wx%h" "%f" "-resize" "%wx%h>" "-strip" "jpeg:%t") + '("-size" "%wx%h" "%f[0]" "-resize" "%wx%h>" "-strip" "jpeg:%t") "Options of command used to create temporary image for display window. Used together with `image-dired-cmd-create-temp-image-program', Available format specifiers are: %w and %h which are replaced by @@ -316,7 +317,7 @@ Available format specifiers are described in :group 'image-dired) (defcustom image-dired-cmd-create-standard-thumbnail-options - (append '("-size" "%wx%h" "%f") + (append '("-size" "%wx%h" "%f[0]") (unless (or image-dired-cmd-pngcrush-program image-dired-cmd-pngnq-program) (list @@ -1626,6 +1627,7 @@ Resized or in full-size." :group 'image-dired (buffer-disable-undo) (image-mode-setup-winprops) + (setq cursor-type nil) (add-hook 'file-name-at-point-functions 'image-dired-file-name-at-point nil t)) (defvar image-dired-minor-mode-map -- cgit v1.2.1 From 70d36dda26465b43c1a63e8e13153e070af86456 Mon Sep 17 00:00:00 2001 From: Mark Oteiza Date: Wed, 1 Feb 2017 21:01:45 -0500 Subject: Turn on lexical-binding in parse-time.el * lisp/calendar/parse-time.el: Turn on lexical-binding. (parse-time-iso8601-regexp, parse-iso8601-time-string): Remove unused bindings. --- lisp/calendar/parse-time.el | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) (limited to 'lisp') diff --git a/lisp/calendar/parse-time.el b/lisp/calendar/parse-time.el index 7651c5da1f4..b781cb0eb48 100644 --- a/lisp/calendar/parse-time.el +++ b/lisp/calendar/parse-time.el @@ -1,4 +1,4 @@ -;;; parse-time.el --- parsing time strings +;;; parse-time.el --- parsing time strings -*- lexical-binding: t -*- ;; Copyright (C) 1996, 2000-2017 Free Software Foundation, Inc. @@ -203,12 +203,9 @@ any values that are unknown are returned as nil." (time-second 2digit) (time-secfrac "\\(\\.[0-9]+\\)?") (time-numoffset (concat "\\([-+]\\)" time-hour ":?" time-minute "?")) - (time-offset (concat "Z" time-numoffset)) (partial-time (concat time-hour colon time-minute colon time-second time-secfrac)) - (full-date (concat date-fullyear dash date-month dash date-mday)) - (full-time (concat partial-time time-offset)) - (date-time (concat full-date "T" full-time))) + (full-date (concat date-fullyear dash date-month dash date-mday))) (list (concat "^" full-date) (concat "T" partial-time) (concat "\\(Z\\|" time-numoffset "\\)"))) @@ -225,7 +222,7 @@ If DATE-STRING cannot be parsed, it falls back to (time-re (nth 1 parse-time-iso8601-regexp)) (tz-re (nth 2 parse-time-iso8601-regexp)) re-start - time seconds minute hour fractional-seconds + time seconds minute hour day month year day-of-week dst tz) ;; We need to populate 'time' with ;; (SEC MIN HOUR DAY MON YEAR DOW DST TZ) @@ -240,9 +237,6 @@ If DATE-STRING cannot be parsed, it falls back to (setq hour (string-to-number (match-string 1 date-string)) minute (string-to-number (match-string 2 date-string)) seconds (string-to-number (match-string 3 date-string)) - fractional-seconds (string-to-number (or - (match-string 4 date-string) - "0")) re-start (match-end 0)) (when (string-match tz-re date-string re-start) (if (string= "Z" (match-string 1 date-string)) -- cgit v1.2.1