From: Stefan Monnier Date: Fri, 4 Apr 2008 00:41:47 +0000 (+0000) Subject: (comment-enter-backward): Be careful to restore point changed during narrowing. X-Git-Tag: emacs-pretest-22.2.90~242 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=389ea1e5e58d9dabe14d8c10a259d63fe1cd8a50;p=emacs.git (comment-enter-backward): Be careful to restore point changed during narrowing. --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 8efe904a294..00e51eb43ed 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2008-04-04 Stephen Berman + + * newcomment.el (comment-enter-backward): Be careful to restore + position changed during narrowing. + 2008-04-03 Nick Roberts * progmodes/gdb-ui.el (gdb-mouse-set-clear-breakpoint): @@ -10,8 +15,8 @@ 2008-04-02 Alan Mackenzie - * progmodes/cc-cmds.el (c-defun-name, c-cpp-define-name): New - optimised functions to get the name of the current defun/macro. + * progmodes/cc-cmds.el (c-defun-name, c-cpp-define-name): + New optimised functions to get the name of the current defun/macro. * add-log.el (add-log-current-defun): Move the functionality which gets the current function name for C like modes to cc-cmds.el, diff --git a/lisp/newcomment.el b/lisp/newcomment.el index 4aed3157ada..5ee32e2ffcb 100644 --- a/lisp/newcomment.el +++ b/lisp/newcomment.el @@ -487,10 +487,11 @@ Point is assumed to be just at the end of a comment." ;; comment-end = "" (progn (backward-char) (skip-syntax-backward " ")) (cond - ((save-restriction - (narrow-to-region (line-beginning-position) (point)) - (goto-char (point-min)) - (re-search-forward (concat comment-end-skip "\\'") nil t)) + ((save-excursion + (save-restriction + (narrow-to-region (line-beginning-position) (point)) + (goto-char (point-min)) + (re-search-forward (concat comment-end-skip "\\'") nil t))) (goto-char (match-beginning 0))) ;; comment-end-skip not found. Maybe we're at EOB which implicitly ;; closes the comment.