[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] trunk r112885: * newcomment.el (comment-search-backward):
From: |
Leo Liu |
Subject: |
[Emacs-diffs] trunk r112885: * newcomment.el (comment-search-backward): Revert last change. |
Date: |
Fri, 07 Jun 2013 11:51:38 +0000 |
User-agent: |
Bazaar (2.6b2) |
------------------------------------------------------------
revno: 112885
revision-id: address@hidden
parent: address@hidden
fixes bugs: http://debbugs.gnu.org/14434 http://debbugs.gnu.org/14303
committer: Leo Liu <address@hidden>
branch nick: trunk
timestamp: Fri 2013-06-07 19:48:28 +0800
message:
* newcomment.el (comment-search-backward): Revert last change.
* emacs-lisp/smie.el (smie--matching-block-data): Minor simplification.
* progmodes/octave.el (octave-mode): Set comment-use-global-state
to t. (Bug#14303)
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog 2013-06-07 09:26:02 +0000
+++ b/lisp/ChangeLog 2013-06-07 11:48:28 +0000
@@ -1,3 +1,13 @@
+2013-06-07 Leo Liu <address@hidden>
+
+ * progmodes/octave.el (octave-mode): Set comment-use-global-state
+ to t. (Bug#14303)
+
+ * newcomment.el (comment-search-backward): Revert last change.
+ (Bug#14434)
+
+ * emacs-lisp/smie.el (smie--matching-block-data): Minor simplification.
+
2013-06-07 Eli Zaretskii <address@hidden>
* Makefile.in (TAGS TAGS-LISP): Pass the (long) list of *.el files
=== modified file 'lisp/emacs-lisp/smie.el'
--- a/lisp/emacs-lisp/smie.el 2013-06-05 07:40:02 +0000
+++ b/lisp/emacs-lisp/smie.el 2013-06-07 11:48:28 +0000
@@ -1057,24 +1057,24 @@
(funcall smie-forward-token-function)))))))
(unless (nth 8 (syntax-ppss))
(condition-case nil
- (let ((here (funcall tok-at-pt)))
+ (let ((here (funcall tok-at-pt))
+ there pair)
(when here
- (let (pair there)
- (cond
- ((assoc (car here) smie-closer-alist) ; opener
- (forward-sexp 1)
- (setq there (funcall tok-at-pt))
- (setq pair (cons (car here) (car there))))
- ((rassoc (car here) smie-closer-alist) ; closer
- (funcall smie-forward-token-function)
- (forward-sexp -1)
- (setq there (funcall tok-at-pt))
- (setq pair (cons (car there) (car here)))))
- ;; Update the cache
- (setcdr smie--matching-block-data-cache
- (list (nth 1 here) (nth 2 here)
- (nth 1 there) (nth 2 there)
- (not (member pair smie-closer-alist)))))))
+ (cond
+ ((assoc (car here) smie-closer-alist) ; opener
+ (forward-sexp 1)
+ (setq there (funcall tok-at-pt))
+ (setq pair (cons (car here) (car there))))
+ ((rassoc (car here) smie-closer-alist) ; closer
+ (funcall smie-forward-token-function)
+ (forward-sexp -1)
+ (setq there (funcall tok-at-pt))
+ (setq pair (cons (car there) (car here)))))
+ ;; Update the cache
+ (setcdr smie--matching-block-data-cache
+ (list (nth 1 here) (nth 2 here)
+ (nth 1 there) (nth 2 there)
+ (not (member pair smie-closer-alist))))))
(scan-error))
(goto-char (car smie--matching-block-data-cache))))
(apply #'smie--matching-block-data orig args))))
=== modified file 'lisp/newcomment.el'
--- a/lisp/newcomment.el 2013-05-17 22:46:10 +0000
+++ b/lisp/newcomment.el 2013-06-07 11:48:28 +0000
@@ -485,29 +485,27 @@
Moves point to inside the comment and returns the position of the
comment-starter. If no comment is found, moves point to LIMIT
and raises an error or returns nil if NOERROR is non-nil."
- (let (found end)
- (while (and (not found)
- (re-search-backward comment-start-skip limit t))
- (setq end (match-end 0))
- (unless (and comment-use-syntax
- (nth 8 (syntax-ppss (or (match-end 1)
- (match-beginning 0)))))
- (setq found t)))
- (if (not found)
- (unless noerror (error "No comment"))
- (beginning-of-line)
- (let ((cs (comment-search-forward end t))
- (pt (point)))
- (if (not cs)
- (progn (beginning-of-line)
- (comment-search-backward limit noerror))
- (while (progn (goto-char cs)
- (comment-forward)
- (and (< (point) end)
- (setq cs (comment-search-forward end t))))
- (setq pt (point)))
- (goto-char pt)
- cs)))))
+ ;; FIXME: If a comment-start appears inside a comment, we may erroneously
+ ;; stop there. This can be rather bad in general, but since
+ ;; comment-search-backward is only used to find the comment-column (in
+ ;; comment-set-column) and to find the comment-start string (via
+ ;; comment-beginning) in indent-new-comment-line, it should be harmless.
+ (if (not (re-search-backward comment-start-skip limit t))
+ (unless noerror (error "No comment"))
+ (beginning-of-line)
+ (let* ((end (match-end 0))
+ (cs (comment-search-forward end t))
+ (pt (point)))
+ (if (not cs)
+ (progn (beginning-of-line)
+ (comment-search-backward limit noerror))
+ (while (progn (goto-char cs)
+ (comment-forward)
+ (and (< (point) end)
+ (setq cs (comment-search-forward end t))))
+ (setq pt (point)))
+ (goto-char pt)
+ cs))))
(defun comment-beginning ()
"Find the beginning of the enclosing comment.
=== modified file 'lisp/progmodes/octave.el'
--- a/lisp/progmodes/octave.el 2013-06-05 07:40:02 +0000
+++ b/lisp/progmodes/octave.el 2013-06-07 11:48:28 +0000
@@ -540,6 +540,7 @@
;; a ";" at those places where it's correct (i.e. outside of parens).
(setq-local electric-layout-rules '((?\; . after)))
+ (setq-local comment-use-global-state t)
(setq-local comment-start octave-comment-start)
(setq-local comment-end "")
(setq-local comment-start-skip octave-comment-start-skip)
@@ -664,6 +665,7 @@
:abbrev-table octave-abbrev-table
(setq comint-prompt-regexp inferior-octave-prompt)
+ (setq-local comment-use-global-state t)
(setq-local comment-start octave-comment-start)
(setq-local comment-end "")
(setq comment-column 32)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] trunk r112885: * newcomment.el (comment-search-backward): Revert last change.,
Leo Liu <=