From c736b08b6a65f6de124dd083fb21f486235b6061 Mon Sep 17 00:00:00 2001 From: Mark Wooding Date: Mon, 31 Dec 2012 05:40:32 +0000 Subject: [PATCH] el/dot-emacs (mdw-maybe-tabify): Fix incorrect region caching. Obviously `tabify' can change the length of the buffer. So caching its end position is not very clever. --- el/dot-emacs.el | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/el/dot-emacs.el b/el/dot-emacs.el index 2909fdd..497318a 100644 --- a/el/dot-emacs.el +++ b/el/dot-emacs.el @@ -647,13 +647,13 @@ This is mainly useful in `auto-fill-mode'.") (defun mdw-maybe-tabify (s) "Tabify or untabify the string S, according to `indent-tabs-mode'." - (with-temp-buffer - (save-match-data - (let ((tabfun (if indent-tabs-mode #'tabify #'untabify))) + (let ((tabfun (if indent-tabs-mode #'tabify #'untabify))) + (with-temp-buffer + (save-match-data (insert s "\n") (let ((start (point-min)) (end (point-max))) - (funcall tabfun start end) - (setq s (buffer-substring start (1- end)))))))) + (funcall tabfun (point-min) (point-max)) + (setq s (buffer-substring (point-min) (1- (point-max))))))))) (defun mdw-examine-fill-prefixes (l) "Given a list of dynamic fill prefixes, pick one which matches -- 2.11.0