* Strange behaviour of auto-fill
@ 2021-04-23 21:42 michael-franzese
2021-04-23 22:20 ` Christopher Dimech
2021-04-23 23:21 ` Christopher Dimech
0 siblings, 2 replies; 7+ messages in thread
From: michael-franzese @ 2021-04-23 21:42 UTC (permalink / raw)
To: Help Gnu Emacs
I am trying to set "auto-fill", with some tools to change "on-off" behaviour.
Things get very confusing. When I comment out "(setq-default auto-fill-function 'do-auto-fill)", "auto-fill-mode" will still break comments even though "break-line" is "0"
and one sets "(auto-fill-mode 0)".
(setq-default auto-fill-function 'do-auto-fill)
(defvar break-line 0)
(defun break-line-ddd ()
"Breaks long lines using auto-fill tool."
(interactive)
(pcase break-line
((or 'nil 0)
(setq comment-auto-fill-only-comments nil)
(auto-fill-mode 0)
(message "%s %s"
"Disable: Break line; " break-line)
(setq break-line 1))
(1
(setq fill-column 72)
(setq comment-auto-fill-only-comments t)
(auto-fill-mode 1)
(message "%s" "Enable: Break only comments")
(setq break-line 2))
(_
(setq comment-auto-fill-only-comments nil)
(auto-fill-mode 1)
(message "%s" "Enable: Break all long lines")
(setq break-line 0)) ))
(defun break-line-set ()
"Breaks long lines using auto-fill."
(break-line-ddd)
(global-set-key (kbd "H-b") #'break-line-ddd) )
(break-line-set)
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Strange behaviour of auto-fill
2021-04-23 21:42 Strange behaviour of auto-fill michael-franzese
@ 2021-04-23 22:20 ` Christopher Dimech
2021-04-23 23:21 ` Christopher Dimech
1 sibling, 0 replies; 7+ messages in thread
From: Christopher Dimech @ 2021-04-23 22:20 UTC (permalink / raw)
To: michael-franzese; +Cc: Help Gnu Emacs
Have had a go months ago on that. It totally defeated me and gave
up on it.
> Sent: Saturday, April 24, 2021 at 9:42 AM
> From: michael-franzese@gmx.com
> To: "Help Gnu Emacs" <help-gnu-emacs@gnu.org>
> Subject: Strange behaviour of auto-fill
>
> I am trying to set "auto-fill", with some tools to change "on-off" behaviour.
>
> Things get very confusing. When I comment out "(setq-default auto-fill-function 'do-auto-fill)", "auto-fill-mode" will still break comments even though "break-line" is "0"
> and one sets "(auto-fill-mode 0)".
>
>
>
> (setq-default auto-fill-function 'do-auto-fill)
> (defvar break-line 0)
>
> (defun break-line-ddd ()
> "Breaks long lines using auto-fill tool."
> (interactive)
>
> (pcase break-line
> ((or 'nil 0)
> (setq comment-auto-fill-only-comments nil)
> (auto-fill-mode 0)
> (message "%s %s"
> "Disable: Break line; " break-line)
> (setq break-line 1))
> (1
> (setq fill-column 72)
> (setq comment-auto-fill-only-comments t)
> (auto-fill-mode 1)
> (message "%s" "Enable: Break only comments")
> (setq break-line 2))
> (_
> (setq comment-auto-fill-only-comments nil)
> (auto-fill-mode 1)
> (message "%s" "Enable: Break all long lines")
> (setq break-line 0)) ))
>
> (defun break-line-set ()
> "Breaks long lines using auto-fill."
> (break-line-ddd)
> (global-set-key (kbd "H-b") #'break-line-ddd) )
>
> (break-line-set)
>
>
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Strange behaviour of auto-fill
2021-04-23 21:42 Strange behaviour of auto-fill michael-franzese
2021-04-23 22:20 ` Christopher Dimech
@ 2021-04-23 23:21 ` Christopher Dimech
2021-04-23 23:23 ` michael-franzese
1 sibling, 1 reply; 7+ messages in thread
From: Christopher Dimech @ 2021-04-23 23:21 UTC (permalink / raw)
To: michael-franzese; +Cc: Help Gnu Emacs
Have had another go and noticed that calling
(turn-off-auto-fill)
will not break lines if the following is present
(setq-default auto-fill-function 'do-auto-fill)
My impression would be for developers to take a closer look at the
code, so that it's use would be simplified. Or perhaps some good
examples on how to use it, as it does not look so clear to me.
> Sent: Saturday, April 24, 2021 at 9:42 AM
> From: michael-franzese@gmx.com
> To: "Help Gnu Emacs" <help-gnu-emacs@gnu.org>
> Subject: Strange behaviour of auto-fill
>
> I am trying to set "auto-fill", with some tools to change "on-off" behaviour.
>
> Things get very confusing. When I comment out "(setq-default auto-fill-function 'do-auto-fill)", "auto-fill-mode" will still break comments even though "break-line" is "0"
> and one sets "(auto-fill-mode 0)".
>
>
>
> (setq-default auto-fill-function 'do-auto-fill)
> (defvar break-line 0)
>
> (defun break-line-ddd ()
> "Breaks long lines using auto-fill tool."
> (interactive)
>
> (pcase break-line
> ((or 'nil 0)
> (setq comment-auto-fill-only-comments nil)
> (auto-fill-mode 0)
> (message "%s %s"
> "Disable: Break line; " break-line)
> (setq break-line 1))
> (1
> (setq fill-column 72)
> (setq comment-auto-fill-only-comments t)
> (auto-fill-mode 1)
> (message "%s" "Enable: Break only comments")
> (setq break-line 2))
> (_
> (setq comment-auto-fill-only-comments nil)
> (auto-fill-mode 1)
> (message "%s" "Enable: Break all long lines")
> (setq break-line 0)) ))
>
> (defun break-line-set ()
> "Breaks long lines using auto-fill."
> (break-line-ddd)
> (global-set-key (kbd "H-b") #'break-line-ddd) )
>
> (break-line-set)
>
>
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Strange behaviour of auto-fill
2021-04-23 23:21 ` Christopher Dimech
@ 2021-04-23 23:23 ` michael-franzese
2021-04-23 23:36 ` Christopher Dimech
` (2 more replies)
0 siblings, 3 replies; 7+ messages in thread
From: michael-franzese @ 2021-04-23 23:23 UTC (permalink / raw)
To: Christopher Dimech; +Cc: Help Gnu Emacs
Actually, when I call (turn-off-auto-fill) after calling
(setq-default auto-fill-function 'do-auto-fill) does tell
turn the mode off.
> Sent: Saturday, April 24, 2021 at 11:21 AM
> From: "Christopher Dimech" <dimech@gmx.com>
> To: michael-franzese@gmx.com
> Cc: "Help Gnu Emacs" <help-gnu-emacs@gnu.org>
> Subject: Re: Strange behaviour of auto-fill
>
>
> Have had another go and noticed that calling
>
> (turn-off-auto-fill)
>
> will not break lines if the following is present
>
> (setq-default auto-fill-function 'do-auto-fill)
>
> My impression would be for developers to take a closer look at the
> code, so that it's use would be simplified. Or perhaps some good
> examples on how to use it, as it does not look so clear to me.
>
> > Sent: Saturday, April 24, 2021 at 9:42 AM
> > From: michael-franzese@gmx.com
> > To: "Help Gnu Emacs" <help-gnu-emacs@gnu.org>
> > Subject: Strange behaviour of auto-fill
> >
> > I am trying to set "auto-fill", with some tools to change "on-off" behaviour.
> >
> > Things get very confusing. When I comment out "(setq-default auto-fill-function 'do-auto-fill)", "auto-fill-mode" will still break comments even though "break-line" is "0"
> > and one sets "(auto-fill-mode 0)".
> >
> >
> >
> > (setq-default auto-fill-function 'do-auto-fill)
> > (defvar break-line 0)
> >
> > (defun break-line-ddd ()
> > "Breaks long lines using auto-fill tool."
> > (interactive)
> >
> > (pcase break-line
> > ((or 'nil 0)
> > (setq comment-auto-fill-only-comments nil)
> > (auto-fill-mode 0)
> > (message "%s %s"
> > "Disable: Break line; " break-line)
> > (setq break-line 1))
> > (1
> > (setq fill-column 72)
> > (setq comment-auto-fill-only-comments t)
> > (auto-fill-mode 1)
> > (message "%s" "Enable: Break only comments")
> > (setq break-line 2))
> > (_
> > (setq comment-auto-fill-only-comments nil)
> > (auto-fill-mode 1)
> > (message "%s" "Enable: Break all long lines")
> > (setq break-line 0)) ))
> >
> > (defun break-line-set ()
> > "Breaks long lines using auto-fill."
> > (break-line-ddd)
> > (global-set-key (kbd "H-b") #'break-line-ddd) )
> >
> > (break-line-set)
> >
> >
> >
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Strange behaviour of auto-fill
2021-04-23 23:23 ` michael-franzese
@ 2021-04-23 23:36 ` Christopher Dimech
2021-04-24 0:47 ` michael-franzese
2021-04-24 0:59 ` michael-franzese
2 siblings, 0 replies; 7+ messages in thread
From: Christopher Dimech @ 2021-04-23 23:36 UTC (permalink / raw)
To: michael-franzese; +Cc: Help Gnu Emacs
You are right, I meant to say that turn-off-auto-fill
does not respond as it should when you use
(setq-default auto-fill-function 'do-auto-fill)
> Sent: Saturday, April 24, 2021 at 11:23 AM
> From: michael-franzese@gmx.com
> To: "Christopher Dimech" <dimech@gmx.com>
> Cc: "Help Gnu Emacs" <help-gnu-emacs@gnu.org>
> Subject: Re: Strange behaviour of auto-fill
>
> Actually, when I call (turn-off-auto-fill) after calling
> (setq-default auto-fill-function 'do-auto-fill) does tell
> turn the mode off.
>
> > Sent: Saturday, April 24, 2021 at 11:21 AM
> > From: "Christopher Dimech" <dimech@gmx.com>
> > To: michael-franzese@gmx.com
> > Cc: "Help Gnu Emacs" <help-gnu-emacs@gnu.org>
> > Subject: Re: Strange behaviour of auto-fill
> >
> >
> > Have had another go and noticed that calling
> >
> > (turn-off-auto-fill)
> >
> > will not break lines if the following is present
> >
> > (setq-default auto-fill-function 'do-auto-fill)
> >
> > My impression would be for developers to take a closer look at the
> > code, so that it's use would be simplified. Or perhaps some good
> > examples on how to use it, as it does not look so clear to me.
> >
> > > Sent: Saturday, April 24, 2021 at 9:42 AM
> > > From: michael-franzese@gmx.com
> > > To: "Help Gnu Emacs" <help-gnu-emacs@gnu.org>
> > > Subject: Strange behaviour of auto-fill
> > >
> > > I am trying to set "auto-fill", with some tools to change "on-off" behaviour.
> > >
> > > Things get very confusing. When I comment out "(setq-default auto-fill-function 'do-auto-fill)", "auto-fill-mode" will still break comments even though "break-line" is "0"
> > > and one sets "(auto-fill-mode 0)".
> > >
> > >
> > >
> > > (setq-default auto-fill-function 'do-auto-fill)
> > > (defvar break-line 0)
> > >
> > > (defun break-line-ddd ()
> > > "Breaks long lines using auto-fill tool."
> > > (interactive)
> > >
> > > (pcase break-line
> > > ((or 'nil 0)
> > > (setq comment-auto-fill-only-comments nil)
> > > (auto-fill-mode 0)
> > > (message "%s %s"
> > > "Disable: Break line; " break-line)
> > > (setq break-line 1))
> > > (1
> > > (setq fill-column 72)
> > > (setq comment-auto-fill-only-comments t)
> > > (auto-fill-mode 1)
> > > (message "%s" "Enable: Break only comments")
> > > (setq break-line 2))
> > > (_
> > > (setq comment-auto-fill-only-comments nil)
> > > (auto-fill-mode 1)
> > > (message "%s" "Enable: Break all long lines")
> > > (setq break-line 0)) ))
> > >
> > > (defun break-line-set ()
> > > "Breaks long lines using auto-fill."
> > > (break-line-ddd)
> > > (global-set-key (kbd "H-b") #'break-line-ddd) )
> > >
> > > (break-line-set)
> > >
> > >
> > >
> >
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Strange behaviour of auto-fill
2021-04-23 23:23 ` michael-franzese
2021-04-23 23:36 ` Christopher Dimech
@ 2021-04-24 0:47 ` michael-franzese
2021-04-24 0:59 ` michael-franzese
2 siblings, 0 replies; 7+ messages in thread
From: michael-franzese @ 2021-04-24 0:47 UTC (permalink / raw)
To: michael-franzese; +Cc: Help Gnu Emacs
I am trying to write a workaround, but am struggling with elisp.
Would like to have a function that sets the order. But do not
know how to make string variables, then use pcase.
(defun break-line-order ()
(setq n )
(pcase n
("off-on"
;; initially do not break lines
(setq break-line 0))
("on-off"
;; initially break lines
(setq break-line 1)
(setq-default auto-fill-function 'do-auto-fill)) ))
> Sent: Saturday, April 24, 2021 at 11:23 AM
> From: michael-franzese@gmx.com
> To: "Christopher Dimech" <dimech@gmx.com>
> Cc: "Help Gnu Emacs" <help-gnu-emacs@gnu.org>
> Subject: Re: Strange behaviour of auto-fill
>
> Actually, when I call (turn-off-auto-fill) after calling
> (setq-default auto-fill-function 'do-auto-fill) does tell
> turn the mode off.
>
> > Sent: Saturday, April 24, 2021 at 11:21 AM
> > From: "Christopher Dimech" <dimech@gmx.com>
> > To: michael-franzese@gmx.com
> > Cc: "Help Gnu Emacs" <help-gnu-emacs@gnu.org>
> > Subject: Re: Strange behaviour of auto-fill
> >
> >
> > Have had another go and noticed that calling
> >
> > (turn-off-auto-fill)
> >
> > will not break lines if the following is present
> >
> > (setq-default auto-fill-function 'do-auto-fill)
> >
> > My impression would be for developers to take a closer look at the
> > code, so that it's use would be simplified. Or perhaps some good
> > examples on how to use it, as it does not look so clear to me.
> >
> > > Sent: Saturday, April 24, 2021 at 9:42 AM
> > > From: michael-franzese@gmx.com
> > > To: "Help Gnu Emacs" <help-gnu-emacs@gnu.org>
> > > Subject: Strange behaviour of auto-fill
> > >
> > > I am trying to set "auto-fill", with some tools to change "on-off" behaviour.
> > >
> > > Things get very confusing. When I comment out "(setq-default auto-fill-function 'do-auto-fill)", "auto-fill-mode" will still break comments even though "break-line" is "0"
> > > and one sets "(auto-fill-mode 0)".
> > >
> > >
> > >
> > > (setq-default auto-fill-function 'do-auto-fill)
> > > (defvar break-line 0)
> > >
> > > (defun break-line-ddd ()
> > > "Breaks long lines using auto-fill tool."
> > > (interactive)
> > >
> > > (pcase break-line
> > > ((or 'nil 0)
> > > (setq comment-auto-fill-only-comments nil)
> > > (auto-fill-mode 0)
> > > (message "%s %s"
> > > "Disable: Break line; " break-line)
> > > (setq break-line 1))
> > > (1
> > > (setq fill-column 72)
> > > (setq comment-auto-fill-only-comments t)
> > > (auto-fill-mode 1)
> > > (message "%s" "Enable: Break only comments")
> > > (setq break-line 2))
> > > (_
> > > (setq comment-auto-fill-only-comments nil)
> > > (auto-fill-mode 1)
> > > (message "%s" "Enable: Break all long lines")
> > > (setq break-line 0)) ))
> > >
> > > (defun break-line-set ()
> > > "Breaks long lines using auto-fill."
> > > (break-line-ddd)
> > > (global-set-key (kbd "H-b") #'break-line-ddd) )
> > >
> > > (break-line-set)
> > >
> > >
> > >
> >
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Strange behaviour of auto-fill
2021-04-23 23:23 ` michael-franzese
2021-04-23 23:36 ` Christopher Dimech
2021-04-24 0:47 ` michael-franzese
@ 2021-04-24 0:59 ` michael-franzese
2 siblings, 0 replies; 7+ messages in thread
From: michael-franzese @ 2021-04-24 0:59 UTC (permalink / raw)
To: michael-franzese; +Cc: Help Gnu Emacs
Have tried to do something but gets me
error: Unknown string-match pattern: (string-match "on-off" s)
-----
(defun break-line-order ()
(setq order "off-on")
(pcase
((string-match "off-on" s)
(setq break-line 0)
(message "%s" "break-line-order: off-on"))
((string-match "on-off" s)
(setq break-line 1)
(setq-default auto-fill-function 'do-auto-fill)
(message "%s" "break-line-order: on-off")) ))
(break-line-order)
> Sent: Saturday, April 24, 2021 at 11:23 AM
> From: michael-franzese@gmx.com
> To: "Christopher Dimech" <dimech@gmx.com>
> Cc: "Help Gnu Emacs" <help-gnu-emacs@gnu.org>
> Subject: Re: Strange behaviour of auto-fill
>
> Actually, when I call (turn-off-auto-fill) after calling
> (setq-default auto-fill-function 'do-auto-fill) does tell
> turn the mode off.
>
> > Sent: Saturday, April 24, 2021 at 11:21 AM
> > From: "Christopher Dimech" <dimech@gmx.com>
> > To: michael-franzese@gmx.com
> > Cc: "Help Gnu Emacs" <help-gnu-emacs@gnu.org>
> > Subject: Re: Strange behaviour of auto-fill
> >
> >
> > Have had another go and noticed that calling
> >
> > (turn-off-auto-fill)
> >
> > will not break lines if the following is present
> >
> > (setq-default auto-fill-function 'do-auto-fill)
> >
> > My impression would be for developers to take a closer look at the
> > code, so that it's use would be simplified. Or perhaps some good
> > examples on how to use it, as it does not look so clear to me.
> >
> > > Sent: Saturday, April 24, 2021 at 9:42 AM
> > > From: michael-franzese@gmx.com
> > > To: "Help Gnu Emacs" <help-gnu-emacs@gnu.org>
> > > Subject: Strange behaviour of auto-fill
> > >
> > > I am trying to set "auto-fill", with some tools to change "on-off" behaviour.
> > >
> > > Things get very confusing. When I comment out "(setq-default auto-fill-function 'do-auto-fill)", "auto-fill-mode" will still break comments even though "break-line" is "0"
> > > and one sets "(auto-fill-mode 0)".
> > >
> > >
> > >
> > > (setq-default auto-fill-function 'do-auto-fill)
> > > (defvar break-line 0)
> > >
> > > (defun break-line-ddd ()
> > > "Breaks long lines using auto-fill tool."
> > > (interactive)
> > >
> > > (pcase break-line
> > > ((or 'nil 0)
> > > (setq comment-auto-fill-only-comments nil)
> > > (auto-fill-mode 0)
> > > (message "%s %s"
> > > "Disable: Break line; " break-line)
> > > (setq break-line 1))
> > > (1
> > > (setq fill-column 72)
> > > (setq comment-auto-fill-only-comments t)
> > > (auto-fill-mode 1)
> > > (message "%s" "Enable: Break only comments")
> > > (setq break-line 2))
> > > (_
> > > (setq comment-auto-fill-only-comments nil)
> > > (auto-fill-mode 1)
> > > (message "%s" "Enable: Break all long lines")
> > > (setq break-line 0)) ))
> > >
> > > (defun break-line-set ()
> > > "Breaks long lines using auto-fill."
> > > (break-line-ddd)
> > > (global-set-key (kbd "H-b") #'break-line-ddd) )
> > >
> > > (break-line-set)
> > >
> > >
> > >
> >
>
>
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2021-04-24 0:59 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-04-23 21:42 Strange behaviour of auto-fill michael-franzese
2021-04-23 22:20 ` Christopher Dimech
2021-04-23 23:21 ` Christopher Dimech
2021-04-23 23:23 ` michael-franzese
2021-04-23 23:36 ` Christopher Dimech
2021-04-24 0:47 ` michael-franzese
2021-04-24 0:59 ` michael-franzese
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).