Function: comment-enter-backward
comment-enter-backward is a byte-compiled function defined in
newcomment.el.gz.
Signature
(comment-enter-backward)
Documentation
Move from the end of a comment to the end of its content.
Point is assumed to be just at the end of a comment.
Source Code
;; Defined in /usr/src/emacs/lisp/newcomment.el.gz
(defun comment-enter-backward ()
"Move from the end of a comment to the end of its content.
Point is assumed to be just at the end of a comment."
(if (bolp)
;; comment-end = ""
(progn (backward-char) (skip-syntax-backward " "))
(cond
((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 probably because it was not set
;; right. Since \\s> should catch the single-char case, let's
;; check that we're looking at a two-char comment ender.
((not (or (<= (- (point-max) (line-beginning-position)) 1)
(zerop (logand (car (syntax-after (- (point) 1)))
;; Here we take advantage of the fact that
;; the syntax class " " is encoded to 0,
;; so " 4" gives us just the 4 bit.
(car (string-to-syntax " 4"))))
(zerop (logand (car (syntax-after (- (point) 2)))
(car (string-to-syntax " 3"))))))
(backward-char 2)
(skip-chars-backward (string (char-after)))
(skip-syntax-backward " "))
;; No clue what's going on: maybe we're really not right after the
;; end of a comment. Maybe we're at the "end" because of EOB rather
;; than because of a marker.
(t (skip-syntax-backward " ")))))