]> git.eshelyaron.com Git - emacs.git/commitdiff
Avoid string-make-multibyte in ps-mode.el
authorLars Ingebrigtsen <larsi@gnus.org>
Thu, 13 Jun 2019 01:12:03 +0000 (03:12 +0200)
committerLars Ingebrigtsen <larsi@gnus.org>
Thu, 13 Jun 2019 01:12:03 +0000 (03:12 +0200)
* 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

index 0ea2bee0aa212dff64cbca1791fc696bba4c9bb5..989a9941b44bbb12d5a36e131440aa2774608963 100644 (file)
@@ -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)))))