Function: hbut:comment
hbut:comment is a byte-compiled function defined in hbut.el.
Signature
(hbut:comment START END)
Documentation
Comment button label spanning region START to END in current buffer.
Comment only when major mode is derived from prog-mode or sgml-mode and
comment-start is non-nil. Ignore email-related buffers.
Source Code
;; Defined in ~/.emacs.d/elpa/hyperbole-20260414.325/hbut.el
(defun hbut:comment (start end)
"Comment button label spanning region START to END in current buffer.
Comment only when major mode is derived from `prog-mode' or `sgml-mode' and
`comment-start' is non-nil. Ignore email-related buffers."
(when (and comment-start (not (memq major-mode '(mail-mode message-mode)))
(derived-mode-p 'prog-mode 'sgml-mode) (not (hmail:mode-is-p)) )
(save-excursion
(if (or (equal comment-end "")
(null comment-end))
(progn
(beginning-of-line)
(unless (search-forward comment-start start t)
(goto-char start)
(insert comment-start)
(unless (eq (preceding-char) ?\ )
(insert ?\ ))))
;; Comments have both start and end delimiters
(unless (and (re-search-backward
(concat (regexp-quote comment-start) "\\|"
(regexp-quote comment-end))
nil t)
(looking-at (regexp-quote comment-start)))
(goto-char start)
(insert comment-start)
(unless (eq (preceding-char) ?\ )
(insert ?\ ))
(goto-char (+ (point) (- end start)))
(unless (eq (following-char) ?\ )
(insert ?\ ))
(insert comment-end))))))