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/gnus') 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/gnus') 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 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/gnus') 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