emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* error message at line break
@ 2013-09-09 14:17 henry atting
  2013-09-09 15:56 ` Nicolas Goaziou
  0 siblings, 1 reply; 13+ messages in thread
From: henry atting @ 2013-09-09 14:17 UTC (permalink / raw)
  To: emacs-orgmode

When writing at every automatic break at the end of a line I get this
error message:

org-comment-line-break-function: Wrong type argument: char-or-string-p,
nil

It doesn't hurt much though it's a bit annoying. 

Org-mode version 8.1.1 (release_8.1.1-7-gaecdf5-git)


Greetings,

henry

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: error message at line break
  2013-09-09 14:17 error message at line break henry atting
@ 2013-09-09 15:56 ` Nicolas Goaziou
  2013-09-09 16:35   ` henry atting
  0 siblings, 1 reply; 13+ messages in thread
From: Nicolas Goaziou @ 2013-09-09 15:56 UTC (permalink / raw)
  To: henry atting; +Cc: emacs-orgmode

Hello,

henry atting <snd@online.de> writes:

> When writing at every automatic break at the end of a line I get this
> error message:
>
> org-comment-line-break-function: Wrong type argument: char-or-string-p,
> nil
>
> It doesn't hurt much though it's a bit annoying. 
>
> Org-mode version 8.1.1 (release_8.1.1-7-gaecdf5-git)

I cannot reproduce the problem. Could you check your installation?


Regards,

-- 
Nicolas Goaziou

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: error message at line break
  2013-09-09 15:56 ` Nicolas Goaziou
@ 2013-09-09 16:35   ` henry atting
  2013-09-11 13:15     ` henry atting
  0 siblings, 1 reply; 13+ messages in thread
From: henry atting @ 2013-09-09 16:35 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: emacs-orgmode, henry atting

Nicolas Goaziou <n.goaziou@gmail.com> writes:

> Hello,
>
> henry atting <snd@online.de> writes:
>
>> When writing at every automatic break at the end of a line I get this
>> error message:
>>
>> org-comment-line-break-function: Wrong type argument: char-or-string-p,
>> nil
>>
>> It doesn't hurt much though it's a bit annoying. 
>>
>> Org-mode version 8.1.1 (release_8.1.1-7-gaecdf5-git)
>
> I cannot reproduce the problem. Could you check your installation?
>
Ah, I see, it has something to do with org-tree-slide. I start
tree-slide as default with a hook and disable it when I work on an org
file.
As this problem is very special I will not explain it further (but if
someone is interested I will do so)

> Regards,

Greetings,
 
henry

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: error message at line break
  2013-09-09 16:35   ` henry atting
@ 2013-09-11 13:15     ` henry atting
  2013-09-11 13:19       ` Nicolas Goaziou
  0 siblings, 1 reply; 13+ messages in thread
From: henry atting @ 2013-09-11 13:15 UTC (permalink / raw)
  To: emacs-orgmode

henry atting <snd@online.de> writes:

> Nicolas Goaziou <n.goaziou@gmail.com> writes:
>
>> Hello,
>>
>> henry atting <snd@online.de> writes:
>>
>>> When writing at every automatic break at the end of a line I get this
>>> error message:
>>>
>>> org-comment-line-break-function: Wrong type argument: char-or-string-p,
>>> nil
>>>
>>> It doesn't hurt much though it's a bit annoying. 
>>>
>>> Org-mode version 8.1.1 (release_8.1.1-7-gaecdf5-git)
>>
>> I cannot reproduce the problem. Could you check your installation?
>>
> Ah, I see, it has something to do with org-tree-slide. I start
> tree-slide as default with a hook and disable it when I work on an org
> file.
> As this problem is very special I will not explain it further (but if
> someone is interested I will do so)
>

I'm sorry my mistake. 
This has nothing to do with tree-slide. It happens with each org file
without header when you do not indent the first two lines at least
one space.

Regards,
henry

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: error message at line break
  2013-09-11 13:15     ` henry atting
@ 2013-09-11 13:19       ` Nicolas Goaziou
  2013-09-11 14:40         ` henry atting
  0 siblings, 1 reply; 13+ messages in thread
From: Nicolas Goaziou @ 2013-09-11 13:19 UTC (permalink / raw)
  To: henry atting; +Cc: emacs-orgmode

Hello,

henry atting <snd@online.de> writes:

> It happens with each org file without header when you do not indent
> the first two lines at least one space.

Could you provide an ECM?


Regards,

-- 
Nicolas Goaziou

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: error message at line break
  2013-09-11 13:19       ` Nicolas Goaziou
@ 2013-09-11 14:40         ` henry atting
  2013-09-11 15:50           ` Nicolas Goaziou
  0 siblings, 1 reply; 13+ messages in thread
From: henry atting @ 2013-09-11 14:40 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: emacs-orgmode, henry atting

Nicolas Goaziou <n.goaziou@gmail.com> writes:

> Hello,
>
> henry atting <snd@online.de> writes:
>
>> It happens with each org file without header when you do not indent
>> the first two lines at least one space.
>
> Could you provide an ECM?
>
Okay, say I have an org file with two lines in it (fill-column is set to
70). Here you go:

--8<---------------cut here---------------start------------->8---
Jemand mußte Josef K. verleumdet haben, denn ohne daß er etwas Boeses
getan haette, wurde er eines Morgens verhaftet. Die Koechin der Frau
--8<---------------cut here---------------end--------------->8---

Then you go on with the text, which is:

Grubach, seiner Zimmervermieterin, die ihm jeden Tag gegen acht Uhr frueh
das Fruehstueck brachte,...

At each automatic line skip I get the mentioned error message. But if
you indent these two lines one space everything works fine.

>
> Regards,

Regards,
henry

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: error message at line break
  2013-09-11 14:40         ` henry atting
@ 2013-09-11 15:50           ` Nicolas Goaziou
  2013-09-11 16:07             ` henry atting
  0 siblings, 1 reply; 13+ messages in thread
From: Nicolas Goaziou @ 2013-09-11 15:50 UTC (permalink / raw)
  To: henry atting; +Cc: emacs-orgmode

Hello,

henry atting <snd@online.de> writes:

> Okay, say I have an org file with two lines in it (fill-column is set to
> 70). Here you go:
>
>
> Jemand mußte Josef K. verleumdet haben, denn ohne daß er etwas Boeses
> getan haette, wurde er eines Morgens verhaftet. Die Koechin der Frau
>
>
> Then you go on with the text, which is:
>
> Grubach, seiner Zimmervermieterin, die ihm jeden Tag gegen acht Uhr frueh
> das Fruehstueck brachte,...
>
> At each automatic line skip I get the mentioned error message. But if
> you indent these two lines one space everything works fine.

Strange, I still cannot reproduce it.


Regards,

-- 
Nicolas Goaziou

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: error message at line break
  2013-09-11 15:50           ` Nicolas Goaziou
@ 2013-09-11 16:07             ` henry atting
  2013-09-17 14:24               ` henry atting
  0 siblings, 1 reply; 13+ messages in thread
From: henry atting @ 2013-09-11 16:07 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: emacs-orgmode, henry atting

Nicolas Goaziou <n.goaziou@gmail.com> writes:

> Hello,
>
> henry atting <snd@online.de> writes:
>
>> Okay, say I have an org file with two lines in it (fill-column is set to
>> 70). Here you go:
>>
>>
>> Jemand mußte Josef K. verleumdet haben, denn ohne daß er etwas Boeses
>> getan haette, wurde er eines Morgens verhaftet. Die Koechin der Frau
>>
>>
>> Then you go on with the text, which is:
>>
>> Grubach, seiner Zimmervermieterin, die ihm jeden Tag gegen acht Uhr frueh
>> das Fruehstueck brachte,...
>>
>> At each automatic line skip I get the mentioned error message. But if
>> you indent these two lines one space everything works fine.
>
> Strange, I still cannot reproduce it.
>
Strange, in deed. I can reproduce it even this way:

1. Start emacs with `emacs -Q'
2. Add my org directory to the load path 
3. Load org-mode
4. Then type the above quoted beginning of Kafka's Prozess

> Regards,

Greetings
henry

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: error message at line break
  2013-09-11 16:07             ` henry atting
@ 2013-09-17 14:24               ` henry atting
  2020-05-02 16:58                 ` [O] " Étienne Deparis
  0 siblings, 1 reply; 13+ messages in thread
From: henry atting @ 2013-09-17 14:24 UTC (permalink / raw)
  To: emacs-orgmode

henry atting <snd@online.de> writes:

> Nicolas Goaziou <n.goaziou@gmail.com> writes:
>
>> Hello,
>>
>> henry atting <snd@online.de> writes:
>>
>>> Okay, say I have an org file with two lines in it (fill-column is set to
>>> 70). Here you go:
>>>
>>>
>>> Jemand mußte Josef K. verleumdet haben, denn ohne daß er etwas Boeses
>>> getan haette, wurde er eines Morgens verhaftet. Die Koechin der Frau
>>>
>>>
>>> Then you go on with the text, which is:
>>>
>>> Grubach, seiner Zimmervermieterin, die ihm jeden Tag gegen acht Uhr frueh
>>> das Fruehstueck brachte,...
>>>
>>> At each automatic line skip I get the mentioned error message. But if
>>> you indent these two lines one space everything works fine.
>>
>> Strange, I still cannot reproduce it.
>>
> Strange, in deed. I can reproduce it even this way:
>
> 1. Start emacs with `emacs -Q'
> 2. Add my org directory to the load path 
> 3. Load org-mode
> 4. Then type the above quoted beginning of Kafka's Prozess
>

Finally... the culprit was:

(setq-default auto-fill-function 'do-auto-fill) 

A very old setting in my ~/.emacs. Now that I start auto-fill with the
appropriate hook everythings works fine.

henry

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [O] error message at line break
  2013-09-17 14:24               ` henry atting
@ 2020-05-02 16:58                 ` Étienne Deparis
  2020-05-02 17:33                   ` Nicolas Goaziou
  2020-05-03  1:18                   ` [O] " Tim Cross
  0 siblings, 2 replies; 13+ messages in thread
From: Étienne Deparis @ 2020-05-02 16:58 UTC (permalink / raw)
  To: emacs-orgmode

Hello,

I allow myself to revive an old thread, as I encounter today the exact
same problem: Emacs crash in org mode at line ending with the following
backtrace:

  Debugger entered--Lisp error: (wrong-type-argument char-or-string-p nil)
  insert-before-markers-and-inherit(nil)
  org-comment-line-break-function(t)
  default-indent-new-line(t)
  do-auto-fill()
  internal-auto-fill()
  self-insert-command(1)
  org-self-insert-command(1)
  funcall-interactively(org-self-insert-command 1)
  call-interactively(org-self-insert-command nil nil)
  command-execute(org-self-insert-command)

I confirm that I've the same variable set in my Emacs config file:

  (setq-default auto-fill-function 'do-auto-fill)

Which I take from the Emacs Wiki AutoFill page¹, with the explanation
of: « If you would like to enable auto fill for all major modes, you can
add this single line to your configuration ».

¹ https://www.emacswiki.org/emacs/AutoFillMode

To fix this, I simply replace the last line of
`org-comment-line-break-function' (in ./lisp/org.el, line 19723) from:

  (insert-before-markers-and-inherit fill-prefix)

To

  (when fill-prefix
    (insert-before-markers-and-inherit fill-prefix))

But I must admit I don't know all the implications of such a change. In
my case, it does the job perfectly well, but maybe I miss something?

I run make test and every thing goes fine too.

I would like to suggest to fix the method
`org-comment-line-break-function', in order to support user change of
the variable auto-fill-function, as it seems to be a common thing. What
do you think?

Have a good week-end,

Étienne

>henry atting <address@hidden> writes:
>
>> Nicolas Goaziou <address@hidden> writes:
>>
>>> Hello,
>>>
>>> henry atting <address@hidden> writes:
>>>
>>>> Okay, say I have an org file with two lines in it (fill-column is set to
>>>> 70). Here you go:
>>>>
>>>>
>>>> Jemand mußte Josef K. verleumdet haben, denn ohne daß er etwas Boeses
>>>> getan haette, wurde er eines Morgens verhaftet. Die Koechin der Frau
>>>>
>>>>
>>>> Then you go on with the text, which is:
>>>>
>>>> Grubach, seiner Zimmervermieterin, die ihm jeden Tag gegen acht Uhr frueh
>>>> das Fruehstueck brachte,...
>>>>
>>>> At each automatic line skip I get the mentioned error message. But if
>>>> you indent these two lines one space everything works fine.
>>>
>>> Strange, I still cannot reproduce it.
>>>
>> Strange, in deed. I can reproduce it even this way:
>>
>> 1. Start emacs with `emacs -Q'
>> 2. Add my org directory to the load path
>> 3. Load org-mode
>> 4. Then type the above quoted beginning of Kafka's Prozess
>>
>
>Finally... the culprit was:
>
>(setq-default auto-fill-function 'do-auto-fill)
>
>A very old setting in my ~/.emacs. Now that I start auto-fill with the
>appropriate hook everythings works fine.
>
>henry


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: error message at line break
  2020-05-02 16:58                 ` [O] " Étienne Deparis
@ 2020-05-02 17:33                   ` Nicolas Goaziou
  2020-05-03 15:47                     ` Étienne Deparis
  2020-05-03  1:18                   ` [O] " Tim Cross
  1 sibling, 1 reply; 13+ messages in thread
From: Nicolas Goaziou @ 2020-05-02 17:33 UTC (permalink / raw)
  To: Étienne Deparis; +Cc: emacs-orgmode

Hello,

Étienne Deparis <etienne@depar.is> writes:

>   Debugger entered--Lisp error: (wrong-type-argument char-or-string-p nil)
>   insert-before-markers-and-inherit(nil)
>   org-comment-line-break-function(t)

[...]

> I confirm that I've the same variable set in my Emacs config file:
>
>   (setq-default auto-fill-function 'do-auto-fill)
>
> Which I take from the Emacs Wiki AutoFill page¹, with the explanation
> of: « If you would like to enable auto fill for all major modes, you can
> add this single line to your configuration ».
>
> ¹ https://www.emacswiki.org/emacs/AutoFillMode

This is a very bad (outdated ?) advice! With this, you force
`do-auto-fill' function in every major mode, even if that function
doesn't have a clue about what the major mode is about. Also this
prevents the major mode from setting its own filling. Do you have any
reason to do this?

A correct way to activate auto fill in all text-based modes (including
Org), is, for example,

  (add-hook 'text-mode-hook (lambda () (auto-fill-mode 1)))

See (info "(emacs)Auto Fill") for more information.

> To fix this, I simply replace the last line of
> `org-comment-line-break-function' (in ./lisp/org.el, line 19723) from:
>
>   (insert-before-markers-and-inherit fill-prefix)
>
> To
>
>   (when fill-prefix
>     (insert-before-markers-and-inherit fill-prefix))

Well, the fix is cheap, sure, but, OTOH, the error is to be expected,
since you force Org to use a function which is not adequate.

I'm not sure we should paper over this kind of misuse of
`auto-fill-function'.

WDYT?

Regards,

-- 
Nicolas Goaziou


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [O] error message at line break
  2020-05-02 16:58                 ` [O] " Étienne Deparis
  2020-05-02 17:33                   ` Nicolas Goaziou
@ 2020-05-03  1:18                   ` Tim Cross
  1 sibling, 0 replies; 13+ messages in thread
From: Tim Cross @ 2020-05-03  1:18 UTC (permalink / raw)
  To: emacs-orgmode


Étienne Deparis <etienne@depar.is> writes:

>
> I confirm that I've the same variable set in my Emacs config file:
>
>   (setq-default auto-fill-function 'do-auto-fill)
>
> Which I take from the Emacs Wiki AutoFill page¹, with the explanation
> of: « If you would like to enable auto fill for all major modes, you can
> add this single line to your configuration ».
>
> ¹ https://www.emacswiki.org/emacs/AutoFillMode
>

That is a weird way to turn on auto-fill mode and I would not be
confident it is setting up the mode correctly. See the Emacs manual for
the official way to do this using mode hooks.

I don't think you want to turn on auto-fill mode in ALL modes. Some
modes, you really don't want Emacs to modify buffer contents by filling.
Typically, you only want this when your dealing with text (so text-mode
hook is a popular choice for adding auto-fill-mode).

I would also be wary of emacswiki advice. While there is some good
advice there, there is some which is not very good and lots which is
outdated/obsolete. This is the downside of wikis. Always try to verify
the advice using the manual corresponding to your Emacs version.

-- 
Tim Cross


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: error message at line break
  2020-05-02 17:33                   ` Nicolas Goaziou
@ 2020-05-03 15:47                     ` Étienne Deparis
  0 siblings, 0 replies; 13+ messages in thread
From: Étienne Deparis @ 2020-05-03 15:47 UTC (permalink / raw)
  To: emacs-orgmode

Hello,

sam. 02 mai 2020 à 19:33, mail@nicolasgoaziou.fr a écrit :

> [...]
>
>> I confirm that I've the same variable set in my Emacs config file:
>>
>>   (setq-default auto-fill-function 'do-auto-fill)
>>
>> Which I take from the Emacs Wiki AutoFill page¹, with the explanation
>> of: « If you would like to enable auto fill for all major modes, you can
>> add this single line to your configuration ».
>>
>> ¹ https://www.emacswiki.org/emacs/AutoFillMode
>
> This is a very bad (outdated ?) advice! With this, you force
> `do-auto-fill' function in every major mode, even if that function
> doesn't have a clue about what the major mode is about. Also this
> prevents the major mode from setting its own filling. Do you have any
> reason to do this?

I must admit I have absolutely no reason to do so. I don't even remember
when this line appear in my config file. At the time, I think I wished
to have auto-fill-mode in all buffer and blindly copy-paste this code
without thinking about it.

>
> A correct way to activate auto fill in all text-based modes (including
> Org), is, for example,
>
>   (add-hook 'text-mode-hook (lambda () (auto-fill-mode 1)))

Yes, I agree you, with my today's Emacs knowledge it makes more
sense. I'll switch to that, or maybe completely remove it and see, mode
per mode, when I really need it.

>
> See (info "(emacs)Auto Fill") for more information.
>
>> To fix this, I simply replace the last line of
>> `org-comment-line-break-function' (in ./lisp/org.el, line 19723) from:
>>
>>   (insert-before-markers-and-inherit fill-prefix)
>>
>> To
>>
>>   (when fill-prefix
>>     (insert-before-markers-and-inherit fill-prefix))
>
> Well, the fix is cheap, sure, but, OTOH, the error is to be expected,
> since you force Org to use a function which is not adequate.
>
> I'm not sure we should paper over this kind of misuse of
> `auto-fill-function'.

With your explanations, I agree this fix proposal doesn't make sense,
and I understand and I agree the error expectation

Thank you Nicolas and Tim for your clarification. In the next day I'll
see to amend the EmacsWiki to note that this tip is outdated or
dangerous.


Enjoy your evening,

Étienne


>
> WDYT?
>
> Regards,


--
Étienne Deparis

https://etienne.depar.is/
xmpp: etienne@depar.is


^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2020-05-03 15:47 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-09-09 14:17 error message at line break henry atting
2013-09-09 15:56 ` Nicolas Goaziou
2013-09-09 16:35   ` henry atting
2013-09-11 13:15     ` henry atting
2013-09-11 13:19       ` Nicolas Goaziou
2013-09-11 14:40         ` henry atting
2013-09-11 15:50           ` Nicolas Goaziou
2013-09-11 16:07             ` henry atting
2013-09-17 14:24               ` henry atting
2020-05-02 16:58                 ` [O] " Étienne Deparis
2020-05-02 17:33                   ` Nicolas Goaziou
2020-05-03 15:47                     ` Étienne Deparis
2020-05-03  1:18                   ` [O] " Tim Cross

Code repositories for project(s) associated with this public inbox

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

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