mirror of
git://git.sv.gnu.org/emacs.git
synced 2025-12-05 22:20:24 -08:00
Revert addition of electric-block-comment-mode & follow-up commits
As presently under discussion in bug#77823, the intended new functionality is not really about comments at all. Remove it for now to allow us to redesign from a clean slate, and to deal with the regression reported in bug#77823. This reverts the following three changesets: Author: Elías Gabriel Pérez <eg642616@gmail.com> AuthorDate: Mon Mar 17 12:56:52 2025 -0600 New minor mode: `electric-block-comment-mode' Author: Elías Gabriel Pérez <eg642616@gmail.com> AuthorDate: Mon Mar 31 17:58:16 2025 -0600 Add block-comment-start and block-comment-end to supported modes Author: Elías Gabriel Pérez <eg642616@gmail.com> AuthorDate: Sun Apr 13 12:26:08 2025 -0600 Add block-comment variables to cc-mode
This commit is contained in:
parent
871ec9615a
commit
4808f785cc
17 changed files with 5 additions and 78 deletions
9
etc/NEWS
9
etc/NEWS
|
|
@ -1984,15 +1984,6 @@ A major mode based on the tree-sitter library for editing "go.work"
|
|||
files. If tree-sitter is properly set-up by the user, it can be
|
||||
enabled for files named "go.work".
|
||||
|
||||
** New minor mode 'electric-block-comment-mode'.
|
||||
This mode automatically closes block comments. Typing the value of
|
||||
'block-comment-start' closes it inserting the corresponding
|
||||
'block-comment-end'. Thus, allows closing block comments for major
|
||||
modes that support it, such as: 'c-mode', 'c++-mode', 'java-mode',
|
||||
'js-mode', 'css-mode', and derived: 'html-mode', 'mhtml-mode',
|
||||
'xml-mode' and 'nxml-mode', 'pascal-mode', 'lua-ts-mode', 'lisp-mode'
|
||||
and 'common-lisp-mode'.
|
||||
|
||||
|
||||
* Incompatible Lisp Changes in Emacs 31.1
|
||||
|
||||
|
|
|
|||
|
|
@ -731,38 +731,6 @@ use `electric-quote-local-mode'."
|
|||
(setq-default electric-quote-mode nil) ; But keep it globally disabled.
|
||||
)))
|
||||
|
||||
;;; Electric comment block
|
||||
|
||||
(defun electric-block-comment-post-self-insert-function ()
|
||||
"Function that `electric-block-comment' adds to `post-self-insert-hook'.
|
||||
This closes block comment with `block-comment-end' when `block-comment-start'
|
||||
is typed."
|
||||
(when (and block-comment-start block-comment-end
|
||||
;; Check if we are exactly behind a `block-comment-start'
|
||||
(save-excursion
|
||||
(save-match-data
|
||||
(re-search-backward (regexp-quote block-comment-start)
|
||||
(- (point) (length block-comment-start))
|
||||
t)))
|
||||
;; And if there is not anything front us
|
||||
(looking-at-p (concat "[^[:space:]]")))
|
||||
(insert " ")
|
||||
(save-excursion
|
||||
(insert (concat " " block-comment-end)))))
|
||||
|
||||
(define-minor-mode electric-block-comment-mode
|
||||
"Toggle automatic closing of block comments (Electric Block Comment mode).
|
||||
|
||||
When enabled, typing `block-comment-start' closes it inserting their
|
||||
corresponding `block-comment-end'."
|
||||
:group 'electricity
|
||||
:version "31.1"
|
||||
(if electric-block-comment-mode
|
||||
(add-hook 'post-self-insert-hook
|
||||
#'electric-block-comment-post-self-insert-function 10 t)
|
||||
(remove-hook 'post-self-insert-hook
|
||||
#'electric-block-comment-post-self-insert-function t)))
|
||||
|
||||
(provide 'electric)
|
||||
|
||||
;;; electric.el ends here
|
||||
|
|
|
|||
|
|
@ -828,8 +828,6 @@ or to switch back to an existing one."
|
|||
"\\(\\(^\\|[^\\\n]\\)\\(\\\\\\\\\\)*\\)\\(;+\\|#|\\) *")
|
||||
(setq-local comment-end-skip "[ \t]*\\(\\s>\\||#\\)")
|
||||
(setq-local font-lock-comment-end-skip "|#")
|
||||
(setq-local block-comment-start "#|")
|
||||
(setq-local block-comment-end "|#")
|
||||
(setq imenu-case-fold-search t))
|
||||
|
||||
(defun lisp-find-tag-default ()
|
||||
|
|
|
|||
|
|
@ -56,6 +56,7 @@
|
|||
;; - spill auto-fill of comments onto the end of the next line.
|
||||
;; - uncomment-region with a consp (for blocks) or somehow make the
|
||||
;; deletion of continuation markers less dangerous.
|
||||
;; - drop block-comment-<foo> unless it's really used.
|
||||
;; - uncomment-region on a subpart of a comment.
|
||||
;; - support gnu-style "multi-line with space in continue".
|
||||
;; - somehow allow comment-dwim to use the region even if transient-mark-mode
|
||||
|
|
@ -182,11 +183,9 @@ guaranteed to be correctly ordered. It is called within `save-excursion'.
|
|||
Applicable at least in modes for languages like fixed-format Fortran where
|
||||
comments always start in column zero.")
|
||||
|
||||
(defvar block-comment-start nil
|
||||
"String to insert to start a new block comment, or nil if no supported.")
|
||||
|
||||
(defvar block-comment-end nil
|
||||
"String to insert to end a new block comment, or nil if no supported.")
|
||||
;; ?? never set
|
||||
(defvar block-comment-start nil)
|
||||
(defvar block-comment-end nil)
|
||||
|
||||
(defvar comment-quote-nested t
|
||||
"Non-nil if nested comments should be quoted.
|
||||
|
|
|
|||
|
|
@ -529,8 +529,6 @@ Many aspects this mode can be customized using
|
|||
(setq-local comment-start-skip "<!--[ \t\r\n]*")
|
||||
(setq-local comment-end "-->")
|
||||
(setq-local comment-end-skip "[ \t\r\n]*-->")
|
||||
(setq-local block-comment-start "<!--")
|
||||
(setq-local block-comment-end "-->")
|
||||
(setq-local comment-line-break-function #'nxml-newline-and-indent)
|
||||
(setq-local comment-quote-nested-function #'nxml-comment-quote-nested)
|
||||
(setq-local comment-continue "") ; avoid double-hyphens as a padding
|
||||
|
|
|
|||
|
|
@ -282,8 +282,6 @@ Set up:
|
|||
- `comment-end'
|
||||
- `comment-start-skip'
|
||||
- `comment-end-skip'
|
||||
- `block-comment-start'
|
||||
- `block-comment-end'
|
||||
- `adaptive-fill-mode'
|
||||
- `adaptive-fill-first-line-regexp'
|
||||
- `paragraph-start'
|
||||
|
|
@ -300,8 +298,6 @@ Set up:
|
|||
(rx (* (syntax whitespace))
|
||||
(group (or (syntax comment-end)
|
||||
(seq (+ "*") "/")))))
|
||||
(setq-local block-comment-start "/*")
|
||||
(setq-local block-comment-end "*/")
|
||||
(setq-local adaptive-fill-mode t)
|
||||
(setq-local adaptive-fill-function #'c-ts-common--adaptive-fill-prefix)
|
||||
;; Always accept * or | as prefix, even if there's only one line in
|
||||
|
|
|
|||
|
|
@ -5015,7 +5015,6 @@ If a fill prefix is specified, it overrides all the above."
|
|||
(setq comment-start "/* " comment-end " */"))
|
||||
(unless (string-match "[ \t]*//" comment-start)
|
||||
(setq comment-start "// " comment-end "")))
|
||||
(setq block-comment-start "/*" block-comment-end "*/")
|
||||
(setq col (save-excursion
|
||||
(back-to-indentation)
|
||||
(current-column)))
|
||||
|
|
|
|||
|
|
@ -610,8 +610,6 @@ that requires a literal mode spec at compile time."
|
|||
(make-local-variable 'comment-start)
|
||||
(make-local-variable 'comment-end)
|
||||
(make-local-variable 'comment-start-skip)
|
||||
(make-local-variable 'block-comment-start)
|
||||
(make-local-variable 'block-comment-end)
|
||||
|
||||
(make-local-variable 'paragraph-start)
|
||||
(make-local-variable 'paragraph-separate)
|
||||
|
|
|
|||
|
|
@ -692,8 +692,6 @@ what the parent of the node would be if it were a node."
|
|||
(setq-local comment-start "// ")
|
||||
(setq-local comment-end "")
|
||||
(setq-local comment-start-skip (rx "//" (* (syntax whitespace))))
|
||||
(setq-local block-comment-start "/*")
|
||||
(setq-local block-comment-end "*/")
|
||||
|
||||
;; Indent.
|
||||
(setq-local indent-tabs-mode t
|
||||
|
|
|
|||
|
|
@ -3846,8 +3846,6 @@ Currently there are `js-mode' and `js-ts-mode'."
|
|||
(setq-local comment-start "// ")
|
||||
(setq-local comment-start-skip "\\(?://+\\|/\\*+\\)\\s *")
|
||||
(setq-local comment-end "")
|
||||
(setq-local block-comment-start "/*")
|
||||
(setq-local block-comment-end "*/")
|
||||
(setq-local fill-paragraph-function #'js-fill-paragraph)
|
||||
(setq-local normal-auto-fill-function #'js-do-auto-fill)
|
||||
|
||||
|
|
|
|||
|
|
@ -142,8 +142,6 @@ Return nil if there is no name or if NODE is not a defun node."
|
|||
(setq-local comment-start "// ")
|
||||
(setq-local comment-start-skip "\\(?://+\\|/\\*+\\)\\s *")
|
||||
(setq-local comment-end "")
|
||||
(setq-local block-comment-start "/*")
|
||||
(setq-local block-comment-end "*/")
|
||||
|
||||
;; Electric
|
||||
(setq-local electric-indent-chars
|
||||
|
|
|
|||
|
|
@ -673,8 +673,6 @@ Calls REPORT-FN directly."
|
|||
(setq-local comment-start "--")
|
||||
(setq-local comment-start-skip "--\\s-*")
|
||||
(setq-local comment-end "")
|
||||
(setq-local block-comment-start "--[[" )
|
||||
(setq-local block-comment-end "]]")
|
||||
|
||||
;; Font-lock.
|
||||
(setq-local treesit-font-lock-settings lua-ts--font-lock-settings)
|
||||
|
|
|
|||
|
|
@ -1767,9 +1767,7 @@ Coloring:
|
|||
|
||||
(setq-local comment-start "// ")
|
||||
(setq-local comment-start-skip "\\(?://\\|(\\*\\|{\\)[ \t]*")
|
||||
(setq-local comment-end-skip "[ \t]*\\(?:\n\\|\\*)\\|}\\)")
|
||||
(setq-local block-comment-start "(*")
|
||||
(setq-local block-comment-end "*)"))
|
||||
(setq-local comment-end-skip "[ \t]*\\(?:\n\\|\\*)\\|}\\)"))
|
||||
|
||||
(provide 'opascal)
|
||||
;;; opascal.el ends here
|
||||
|
|
|
|||
|
|
@ -348,8 +348,6 @@ See also the user variables `pascal-type-keywords', `pascal-start-keywords' and
|
|||
(setq-local comment-start "{")
|
||||
(setq-local comment-start-skip "(\\*+ *\\|{ *")
|
||||
(setq-local comment-end "}")
|
||||
(setq-local block-comment-start "(*")
|
||||
(setq-local block-comment-end "*)")
|
||||
(add-hook 'completion-at-point-functions 'pascal-completions-at-point nil t)
|
||||
;; Font lock support
|
||||
(setq-local font-lock-defaults '(pascal-font-lock-keywords nil t))
|
||||
|
|
|
|||
|
|
@ -665,8 +665,6 @@ at least 3 (which is the default value)."
|
|||
;; Comments.
|
||||
(setq-local comment-start "// ")
|
||||
(setq-local comment-end "")
|
||||
(setq-local block-comment-start "/*")
|
||||
(setq-local block-comment-end "*/")
|
||||
(setq-local comment-start-skip (rx (or (seq "/" (+ "/"))
|
||||
(seq "/" (+ "*")))
|
||||
(* (syntax whitespace))))
|
||||
|
|
|
|||
|
|
@ -1858,8 +1858,6 @@ implementations: `css-mode' and `css-ts-mode'."
|
|||
(setq-local comment-start-skip "/\\*+[ \t]*")
|
||||
(setq-local comment-end "*/")
|
||||
(setq-local comment-end-skip "[ \t]*\\*+/")
|
||||
(setq-local block-comment-start "/*")
|
||||
(setq-local block-comment-end "*/")
|
||||
(setq-local electric-indent-chars
|
||||
(append css-electric-keys electric-indent-chars))
|
||||
;; The default "." creates ambiguity with class selectors.
|
||||
|
|
@ -2083,8 +2081,6 @@ be used to fill comments.
|
|||
"Major mode to edit \"Sassy CSS\" files."
|
||||
(setq-local comment-start "// ")
|
||||
(setq-local comment-end "")
|
||||
(setq-local block-comment-start "/*")
|
||||
(setq-local block-comment-end "*/")
|
||||
(setq-local comment-continue " *")
|
||||
(setq-local comment-start-skip "/[*/]+[ \t]*")
|
||||
(setq-local comment-end-skip "[ \t]*\\(?:\n\\|\\*+/\\)")
|
||||
|
|
|
|||
|
|
@ -622,8 +622,6 @@ Do \\[describe-key] on the following bindings to discover what they do.
|
|||
(setq-local indent-line-function #'sgml-indent-line)
|
||||
(setq-local comment-start "<!-- ")
|
||||
(setq-local comment-end " -->")
|
||||
(setq-local block-comment-start "<!--")
|
||||
(setq-local block-comment-end "-->")
|
||||
(setq-local comment-indent-function #'sgml-comment-indent)
|
||||
(setq-local comment-line-break-function #'sgml-comment-indent-new-line)
|
||||
(setq-local skeleton-further-elements '((completion-ignore-case t)))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue