all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* problem with "comment-auto-fill-only-comments"
@ 2021-01-30 12:51 michael-franzese
  0 siblings, 0 replies; only message in thread
From: michael-franzese @ 2021-01-30 12:51 UTC (permalink / raw)
  To: Help Gnu Emacs

I am having problem with the following code.  I cannot locate the
problem though.

;; Break lines using auto-fill made.
(defun break-comments-din ()
  "Break lines when they exceed a specific character length."
  (setq-local comment-auto-fill-only-comments t))

(defvar dfv-break-comments-state nil)

;; Cycles line breaking tool
(defun cycle-break-comments-din ()
  "Break comments in programming languages."

  (pcase dfv-break-comments-state
    ;;
    (1 (auto-fill-mode 1)
       (add-hook 'sh-mode-hook          #'break-comments-din)
       (add-hook 'fortran-mode-hook     #'break-comments-din)
       (add-hook 'emacs-lisp-mode-hook  #'break-comments-din)
       (add-hook 'c-mode-hook           #'break-comments-din)
       (add-hook 'c++-mode-hook         #'break-comments-din)
       (add-hook 'awk-mode-hook         #'break-comments-din)
       (add-hook 'R-mode-hook           #'break-comments-din)
       (add-hook 'octave-mode-hook      #'break-comments-din)
       (setq dfv-break-comments-state 2)
       (message "%s" "Enable: Break comments"))
    ;;
    (2 (auto-fill-mode 0)
       (setq dfv-break-comments-state 0)
       (message "%s" "Disable: Break comments"))
    ;;
    (_ (auto-fill-mode 1)
       (add-hook 'prog-mode-hook #'break-comments-din)
       (setq dfv-break-comments-state 1)
       (message "%s" "Break comments using prog-mode-hook")) )

  ;; Break comments  Keybinding for breaking comments using Auto Fill
  (add-hook 'texinfo-mode-hook  #'break-comment-din)
  (add-hook 'text-mode-hook     #'break-comment-din)
  (global-set-key (kbd "C-c q") #'break-comment-din) )






^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-01-30 12:51 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-01-30 12:51 problem with "comment-auto-fill-only-comments" michael-franzese

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.