emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master 4752de8 2/2: Avoid string-make-multibyte in ps-mode


From: Lars Ingebrigtsen
Subject: [Emacs-diffs] master 4752de8 2/2: Avoid string-make-multibyte in ps-mode.el
Date: Wed, 12 Jun 2019 21:12:14 -0400 (EDT)

branch: master
commit 4752de83493df806b8cce0ff430f62fdcda46db2
Author: Lars Ingebrigtsen <address@hidden>
Commit: Lars Ingebrigtsen <address@hidden>

    Avoid string-make-multibyte in ps-mode.el
    
    * lisp/progmodes/ps-mode.el (ps-mode-octal-region): Avoid usage of
    string-make-multibyte, but work in both unibyte and multibyte buffers.
---
 lisp/progmodes/ps-mode.el | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/lisp/progmodes/ps-mode.el b/lisp/progmodes/ps-mode.el
index 0ea2bee..989a994 100644
--- a/lisp/progmodes/ps-mode.el
+++ b/lisp/progmodes/ps-mode.el
@@ -737,11 +737,10 @@ Only one `%' is removed, and it has to be in the first 
column."
         (setq i 0)
         (while (re-search-forward "[\200-\377]" (marker-position endm) t)
           (setq i (1+ i))
-          (backward-char)
-          (insert (format "\\%03o" (string-to-char
-                                    (string-make-unibyte
-                                     (buffer-substring (point) (1+ 
(point)))))))
-          (delete-char 1))
+          (replace-match (format "\\%03o"
+                                 (multibyte-char-to-unibyte
+                                  (char-after (1- (point)))))
+                         t t))
         (message "%d change%s made" i (if (= i 1) "" "s"))
         (set-marker endm nil)))))
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]