* 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
This commit is contained in:
parent
a822acffe2
commit
a175bf337a
4 changed files with 50 additions and 40 deletions
|
@ -1,3 +1,13 @@
|
|||
2013-06-07 Leo Liu <sdl.web@gmail.com>
|
||||
|
||||
* 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 <eliz@gnu.org>
|
||||
|
||||
* Makefile.in (TAGS TAGS-LISP): Pass the (long) list of *.el files
|
||||
|
|
|
@ -1057,24 +1057,24 @@ This uses SMIE's tables and is expected to be placed on `post-self-insert-hook'.
|
|||
(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))))
|
||||
|
|
|
@ -485,29 +485,27 @@ and raises an error or returns nil if NOERROR is non-nil."
|
|||
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.
|
||||
|
|
|
@ -540,6 +540,7 @@ definitions can also be stored in files and used in batch mode."
|
|||
;; 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 @@ in the Inferior Octave buffer.")
|
|||
: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)
|
||||
|
|
Loading…
Add table
Reference in a new issue