From: Dmitry Gutov Date: Sat, 5 Oct 2013 23:40:16 +0000 (+0300) Subject: * lisp/newcomment.el (comment-use-global-state): Change default value X-Git-Tag: emacs-24.3.90~173^2^2~42^2~45^2~387^2~1375 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=da9ea6d9803d6a12f93ed7b2effd85e254b390e8;p=emacs.git * lisp/newcomment.el (comment-use-global-state): Change default value to t, mark obsolete. (comment-beginning): In addition to `comment-to-syntax', check the value of `comment-use-global-state'. Fixes: debbugs:15251 --- diff --git a/etc/NEWS b/etc/NEWS index e26d18c93ed..4539f5f00d1 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -157,6 +157,9 @@ some enhancements, like the ability to restore deleted frames. Command ** The command `quail-help' is deleted. Use `C-h C-\' (`describe-input-method') instead. +** The default value of `comment-use-global-state' is changed to t, +and this variable has been marked obsolete. + * Editing Changes in Emacs 24.4 @@ -214,7 +217,7 @@ You can use the new function `remember-store-in-files' within the See `remember-data-directory' and `remember-directory-file-name-format' for new options related to this function. -** More packages look for ~/.emacs.d/ additionally to ~/.. +* More packages look for ~/.emacs.d/ additionally to ~/.. Affected files: ~/.emacs.d/timelog replaces ~/.timelog ~/.emacs.d/vip replaces ~/.vip diff --git a/lisp/ChangeLog b/lisp/ChangeLog index a7fbec849b5..24011e3584c 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,10 @@ +2013-10-05 Dmitry Gutov + + * newcomment.el (comment-use-global-state): Change default value + to t, mark obsolete (Bug#15251). + (comment-beginning): In addition to `comment-to-syntax', check the + value of `comment-use-global-state'. + 2013-10-05 Stefan Monnier * progmodes/ruby-mode.el (ruby-use-smie): Change default. diff --git a/lisp/newcomment.el b/lisp/newcomment.el index 3702b55f0aa..251c1605345 100644 --- a/lisp/newcomment.el +++ b/lisp/newcomment.el @@ -435,12 +435,15 @@ If UNP is non-nil, unquote nested comment markers." ;;;; Navigation ;;;; -(defvar comment-use-global-state nil +(defvar comment-use-global-state t "Non-nil means that the global syntactic context is used. More specifically, it means that `syntax-ppss' is used to find out whether -point is within a string or not. Major modes whose syntax is faithfully -described by the syntax-tables can set this to non-nil so comment markers -in strings will not confuse Emacs.") +point is within a string or not. Major modes whose syntax is not faithfully +described by the syntax-tables (or where `font-lock-syntax-table' is radically +different from the main syntax table) can set this to nil, +then `syntax-ppss' cache won't be used in comment-related routines.") + +(make-obsolete-variable 'comment-use-global-state 'comment-use-syntax "24.4") (defun comment-search-forward (limit &optional noerror) "Find a comment start between point and LIMIT. @@ -515,7 +518,7 @@ Ensure that `comment-normalize-vars' has been called before you use this." "Find the beginning of the enclosing comment. Returns nil if not inside a comment, else moves point and returns the same as `comment-search-backward'." - (if comment-use-syntax + (if (and comment-use-syntax comment-use-global-state) (let ((state (syntax-ppss))) (when (nth 4 state) (goto-char (nth 8 state))