unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: michael-franzese@gmx.com
To: Help Gnu Emacs <help-gnu-emacs@gnu.org>
Subject: problem with "comment-auto-fill-only-comments"
Date: Sat, 30 Jan 2021 13:51:15 +0100	[thread overview]
Message-ID: <trinity-f570c11e-7501-4702-bdff-7c1fdd88ac6c-1612011075706@3c-app-mailcom-bs16> (raw)

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) )






                 reply	other threads:[~2021-01-30 12:51 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=trinity-f570c11e-7501-4702-bdff-7c1fdd88ac6c-1612011075706@3c-app-mailcom-bs16 \
    --to=michael-franzese@gmx.com \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).