diff options
| author | Leo Liu | 2013-06-07 19:48:28 +0800 |
|---|---|---|
| committer | Leo Liu | 2013-06-07 19:48:28 +0800 |
| commit | a175bf337ae1cb146bf01f69648cd5cbe35d4384 (patch) | |
| tree | bbde4dca7baf42da9b709051f22726011fb1d41a | |
| parent | a822acffe2a370ed1726db92aad64b5287582a73 (diff) | |
| download | emacs-a175bf337ae1cb146bf01f69648cd5cbe35d4384.tar.gz emacs-a175bf337ae1cb146bf01f69648cd5cbe35d4384.zip | |
* 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)
Fixes: debbugs:14434 debbugs:14303
| -rw-r--r-- | lisp/ChangeLog | 10 | ||||
| -rw-r--r-- | lisp/emacs-lisp/smie.el | 34 | ||||
| -rw-r--r-- | lisp/newcomment.el | 44 | ||||
| -rw-r--r-- | lisp/progmodes/octave.el | 2 |
4 files changed, 50 insertions, 40 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 50e4647b438..b6d934e95c4 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,13 @@ | |||
| 1 | 2013-06-07 Leo Liu <sdl.web@gmail.com> | ||
| 2 | |||
| 3 | * progmodes/octave.el (octave-mode): Set comment-use-global-state | ||
| 4 | to t. (Bug#14303) | ||
| 5 | |||
| 6 | * newcomment.el (comment-search-backward): Revert last change. | ||
| 7 | (Bug#14434) | ||
| 8 | |||
| 9 | * emacs-lisp/smie.el (smie--matching-block-data): Minor simplification. | ||
| 10 | |||
| 1 | 2013-06-07 Eli Zaretskii <eliz@gnu.org> | 11 | 2013-06-07 Eli Zaretskii <eliz@gnu.org> |
| 2 | 12 | ||
| 3 | * Makefile.in (TAGS TAGS-LISP): Pass the (long) list of *.el files | 13 | * Makefile.in (TAGS TAGS-LISP): Pass the (long) list of *.el files |
diff --git a/lisp/emacs-lisp/smie.el b/lisp/emacs-lisp/smie.el index f4eda606ad6..e97e9d066fd 100644 --- a/lisp/emacs-lisp/smie.el +++ b/lisp/emacs-lisp/smie.el | |||
| @@ -1057,24 +1057,24 @@ This uses SMIE's tables and is expected to be placed on `post-self-insert-hook'. | |||
| 1057 | (funcall smie-forward-token-function))))))) | 1057 | (funcall smie-forward-token-function))))))) |
| 1058 | (unless (nth 8 (syntax-ppss)) | 1058 | (unless (nth 8 (syntax-ppss)) |
| 1059 | (condition-case nil | 1059 | (condition-case nil |
| 1060 | (let ((here (funcall tok-at-pt))) | 1060 | (let ((here (funcall tok-at-pt)) |
| 1061 | there pair) | ||
| 1061 | (when here | 1062 | (when here |
| 1062 | (let (pair there) | 1063 | (cond |
| 1063 | (cond | 1064 | ((assoc (car here) smie-closer-alist) ; opener |
| 1064 | ((assoc (car here) smie-closer-alist) ; opener | 1065 | (forward-sexp 1) |
| 1065 | (forward-sexp 1) | 1066 | (setq there (funcall tok-at-pt)) |
| 1066 | (setq there (funcall tok-at-pt)) | 1067 | (setq pair (cons (car here) (car there)))) |
| 1067 | (setq pair (cons (car here) (car there)))) | 1068 | ((rassoc (car here) smie-closer-alist) ; closer |
| 1068 | ((rassoc (car here) smie-closer-alist) ; closer | 1069 | (funcall smie-forward-token-function) |
| 1069 | (funcall smie-forward-token-function) | 1070 | (forward-sexp -1) |
| 1070 | (forward-sexp -1) | 1071 | (setq there (funcall tok-at-pt)) |
| 1071 | (setq there (funcall tok-at-pt)) | 1072 | (setq pair (cons (car there) (car here))))) |
| 1072 | (setq pair (cons (car there) (car here))))) | 1073 | ;; Update the cache |
| 1073 | ;; Update the cache | 1074 | (setcdr smie--matching-block-data-cache |
| 1074 | (setcdr smie--matching-block-data-cache | 1075 | (list (nth 1 here) (nth 2 here) |
| 1075 | (list (nth 1 here) (nth 2 here) | 1076 | (nth 1 there) (nth 2 there) |
| 1076 | (nth 1 there) (nth 2 there) | 1077 | (not (member pair smie-closer-alist)))))) |
| 1077 | (not (member pair smie-closer-alist))))))) | ||
| 1078 | (scan-error)) | 1078 | (scan-error)) |
| 1079 | (goto-char (car smie--matching-block-data-cache)))) | 1079 | (goto-char (car smie--matching-block-data-cache)))) |
| 1080 | (apply #'smie--matching-block-data orig args)))) | 1080 | (apply #'smie--matching-block-data orig args)))) |
diff --git a/lisp/newcomment.el b/lisp/newcomment.el index e10b96f97f9..bcb5f721ae8 100644 --- a/lisp/newcomment.el +++ b/lisp/newcomment.el | |||
| @@ -485,29 +485,27 @@ and raises an error or returns nil if NOERROR is non-nil." | |||
| 485 | Moves point to inside the comment and returns the position of the | 485 | Moves point to inside the comment and returns the position of the |
| 486 | comment-starter. If no comment is found, moves point to LIMIT | 486 | comment-starter. If no comment is found, moves point to LIMIT |
| 487 | and raises an error or returns nil if NOERROR is non-nil." | 487 | and raises an error or returns nil if NOERROR is non-nil." |
| 488 | (let (found end) | 488 | ;; FIXME: If a comment-start appears inside a comment, we may erroneously |
| 489 | (while (and (not found) | 489 | ;; stop there. This can be rather bad in general, but since |
| 490 | (re-search-backward comment-start-skip limit t)) | 490 | ;; comment-search-backward is only used to find the comment-column (in |
| 491 | (setq end (match-end 0)) | 491 | ;; comment-set-column) and to find the comment-start string (via |
| 492 | (unless (and comment-use-syntax | 492 | ;; comment-beginning) in indent-new-comment-line, it should be harmless. |
| 493 | (nth 8 (syntax-ppss (or (match-end 1) | 493 | (if (not (re-search-backward comment-start-skip limit t)) |
| 494 | (match-beginning 0))))) | 494 | (unless noerror (error "No comment")) |
| 495 | (setq found t))) | 495 | (beginning-of-line) |
| 496 | (if (not found) | 496 | (let* ((end (match-end 0)) |
| 497 | (unless noerror (error "No comment")) | 497 | (cs (comment-search-forward end t)) |
| 498 | (beginning-of-line) | 498 | (pt (point))) |
| 499 | (let ((cs (comment-search-forward end t)) | 499 | (if (not cs) |
| 500 | (pt (point))) | 500 | (progn (beginning-of-line) |
| 501 | (if (not cs) | 501 | (comment-search-backward limit noerror)) |
| 502 | (progn (beginning-of-line) | 502 | (while (progn (goto-char cs) |
| 503 | (comment-search-backward limit noerror)) | 503 | (comment-forward) |
| 504 | (while (progn (goto-char cs) | 504 | (and (< (point) end) |
| 505 | (comment-forward) | 505 | (setq cs (comment-search-forward end t)))) |
| 506 | (and (< (point) end) | 506 | (setq pt (point))) |
| 507 | (setq cs (comment-search-forward end t)))) | 507 | (goto-char pt) |
| 508 | (setq pt (point))) | 508 | cs)))) |
| 509 | (goto-char pt) | ||
| 510 | cs))))) | ||
| 511 | 509 | ||
| 512 | (defun comment-beginning () | 510 | (defun comment-beginning () |
| 513 | "Find the beginning of the enclosing comment. | 511 | "Find the beginning of the enclosing comment. |
diff --git a/lisp/progmodes/octave.el b/lisp/progmodes/octave.el index efa735e99b9..14d04b0d03c 100644 --- a/lisp/progmodes/octave.el +++ b/lisp/progmodes/octave.el | |||
| @@ -540,6 +540,7 @@ definitions can also be stored in files and used in batch mode." | |||
| 540 | ;; a ";" at those places where it's correct (i.e. outside of parens). | 540 | ;; a ";" at those places where it's correct (i.e. outside of parens). |
| 541 | (setq-local electric-layout-rules '((?\; . after))) | 541 | (setq-local electric-layout-rules '((?\; . after))) |
| 542 | 542 | ||
| 543 | (setq-local comment-use-global-state t) | ||
| 543 | (setq-local comment-start octave-comment-start) | 544 | (setq-local comment-start octave-comment-start) |
| 544 | (setq-local comment-end "") | 545 | (setq-local comment-end "") |
| 545 | (setq-local comment-start-skip octave-comment-start-skip) | 546 | (setq-local comment-start-skip octave-comment-start-skip) |
| @@ -664,6 +665,7 @@ in the Inferior Octave buffer.") | |||
| 664 | :abbrev-table octave-abbrev-table | 665 | :abbrev-table octave-abbrev-table |
| 665 | (setq comint-prompt-regexp inferior-octave-prompt) | 666 | (setq comint-prompt-regexp inferior-octave-prompt) |
| 666 | 667 | ||
| 668 | (setq-local comment-use-global-state t) | ||
| 667 | (setq-local comment-start octave-comment-start) | 669 | (setq-local comment-start octave-comment-start) |
| 668 | (setq-local comment-end "") | 670 | (setq-local comment-end "") |
| 669 | (setq comment-column 32) | 671 | (setq comment-column 32) |