changeset 100113:bd6671636b3b

Aaron S. Hawley <aaronh at garden.org> (texinfo-insert-quote): Handle corner case where point is at the beginning of the buffer. (Bug#1239)
author Glenn Morris <rgm@gnu.org>
date Tue, 02 Dec 2008 03:34:19 +0000
parents d72f163ce147
children bf1d69cb4681
files lisp/textmodes/texinfo.el
diffstat 1 files changed, 5 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/textmodes/texinfo.el	Tue Dec 02 03:32:41 2008 +0000
+++ b/lisp/textmodes/texinfo.el	Tue Dec 02 03:34:19 2008 +0000
@@ -682,7 +682,9 @@
     (if (or arg
 	    (= (preceding-char) ?\\)
 	    (save-excursion
-	      (backward-char (length texinfo-open-quote))
+              (if (> (point) (length texinfo-open-quote))
+                  (backward-char (length texinfo-open-quote))
+                (goto-char (point-min)))
 	      (when (or (looking-at texinfo-open-quote)
 			(looking-at texinfo-close-quote))
 		(delete-char (length texinfo-open-quote))
@@ -694,7 +696,8 @@
 		    (setq in-env t)))))
 	(self-insert-command (prefix-numeric-value arg))
       (insert
-       (if (memq (char-syntax (preceding-char)) '(?\( ?> ?\s))
+       (if (or (bobp)
+               (memq (char-syntax (preceding-char)) '(?\( ?> ?\s)))
 	   texinfo-open-quote
 	 texinfo-close-quote)))))