emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* org-edit-src-exit randomizes / mixes up code in source-buffer on exit
@ 2021-06-22 10:39 mcg
  2021-06-22 13:33 ` Sébastien Miquel
  2021-06-23  9:15 ` Calendar vs. org-agenda exit tomas
  0 siblings, 2 replies; 14+ messages in thread
From: mcg @ 2021-06-22 10:39 UTC (permalink / raw)
  To: emacs-orgmode

Hello,

org-edit-src-exit suddenly completely destroys my code after coming back 
from vacation. No known recent changes in configuration. Very strange 
error!

EXAMPLE: here a simple code before editing

#+BEGIN_SRC R

mtcars

sum(mtcars$mpg, na.rm = TRUE)

mean(mtcars$disp)

#+END_SRC

I enter to edit (org-edit-special), change the order of two lines and 
add a number:

Result I should get in source buffer after exiting:

#+BEGIN_SRC R

mtcars

mean(mtcars$disp)

123456789

sum(mtcars$mpg, na.rm = TRUE)

#+END_SRC

What I get in source buffer on org-edit-src-exit: (no joke!)

#+BEGIN_SRC R
rmtcars
s
ean(m
sums$di(p)mt123456789

cars$mpg, na.rm = TRUE)

mean

#+END_SRC


Came back from vacation and suddenly this happens. Only updates to 
server, elpa / melpa has not been updated the last three weeks. Emacs 
reinstallation did not help, launching without

Emacs 26.1 build 2 (2021-01-31) modified by debian

org version 9.4.6



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

* Re: org-edit-src-exit randomizes / mixes up code in source-buffer on exit
  2021-06-22 10:39 org-edit-src-exit randomizes / mixes up code in source-buffer on exit mcg
@ 2021-06-22 13:33 ` Sébastien Miquel
  2021-06-22 14:57   ` mcg
  2021-06-23  9:15 ` Calendar vs. org-agenda exit tomas
  1 sibling, 1 reply; 14+ messages in thread
From: Sébastien Miquel @ 2021-06-22 13:33 UTC (permalink / raw)
  To: mcg, emacs-orgmode

Hi,

This has been reported before.

There's a patch that fixes this here : 
https://lists.gnu.org/archive/html/emacs-orgmode/2021-06/msg00007.html

To fix this bug, you can can either apply this patch, downgrade org, or 
update emacs to 27.

Could anyone with commit access have a look and apply this patch to 
master ?

Regards,

-- 
Sébastien Miquel



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

* Re: org-edit-src-exit randomizes / mixes up code in source-buffer on exit
  2021-06-22 13:33 ` Sébastien Miquel
@ 2021-06-22 14:57   ` mcg
  0 siblings, 0 replies; 14+ messages in thread
From: mcg @ 2021-06-22 14:57 UTC (permalink / raw)
  To: emacs-orgmode

Hello,

thank you very much! Update to 27 solved the problem.

All the best,

Michael


Am 22.06.2021 um 15:33 schrieb Sébastien Miquel:
> Hi,
>
> This has been reported before.
>
> There's a patch that fixes this here : 
> https://lists.gnu.org/archive/html/emacs-orgmode/2021-06/msg00007.html
>
> To fix this bug, you can can either apply this patch, downgrade org, 
> or update emacs to 27.
>
> Could anyone with commit access have a look and apply this patch to 
> master ?
>
> Regards,
>


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

* Calendar vs. org-agenda exit
  2021-06-22 10:39 org-edit-src-exit randomizes / mixes up code in source-buffer on exit mcg
  2021-06-22 13:33 ` Sébastien Miquel
@ 2021-06-23  9:15 ` tomas
  2021-06-23 15:16   ` Marco Wahl
  1 sibling, 1 reply; 14+ messages in thread
From: tomas @ 2021-06-23  9:15 UTC (permalink / raw)
  To: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 928 bytes --]

Hi,

is org mode rebinding keys in the calendar?

I ask, because I've been using traditional calendar+diary; now,
when I try to insert an entry (i-d in calendar), I get

  "Wrong type argument: commandp, org-agenda-diary-entry"

The following experiment points in Org's general direction:

  - emacs -Q
  - M-x calendar
  - with point on some date, i-d
  - diary buffer is open, with a new line primed with date
  - M-x load-library <RET> "org"
  - again, in calendar, i-d
  - the above error results.

I'm not sure yet whether I fat-fingered something, so I'd like
some hints in investigating before declaring this to be a bug.

My emacs is a home build, fairly recent:

  GNU Emacs 28.0.50 (build 1, x86_64-pc-linux-gnu,
      GTK+ Version 2.24.32, cairo version 1.16.0)
      of 2021-06-15

Org is:

  Org mode version 9.4.4 (release_9.4.4 @
      /usr/local/share/emacs/28.0.50/lisp/org/)

Thanks for any hints, cheers
 - t

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

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

* Re: Calendar vs. org-agenda exit
  2021-06-23  9:15 ` Calendar vs. org-agenda exit tomas
@ 2021-06-23 15:16   ` Marco Wahl
  2021-06-23 15:28     ` tomas
  0 siblings, 1 reply; 14+ messages in thread
From: Marco Wahl @ 2021-06-23 15:16 UTC (permalink / raw)
  To: tomas; +Cc: emacs-orgmode

Hi.

> is org mode rebinding keys in the calendar?

Yes.  "c" calls the Org agenda.

"i" in the calendar calls org-agenda-diary-entry when
org-agenda-diary-file has been configured.  (See function
org--setup-calendar-bindings.)

> I ask, because I've been using traditional calendar+diary; now,
> when I try to insert an entry (i-d in calendar), I get
>
>   "Wrong type argument: commandp, org-agenda-diary-entry"

> The following experiment points in Org's general direction:
>
>   - emacs -Q
>   - M-x calendar
>   - with point on some date, i-d
>   - diary buffer is open, with a new line primed with date
>   - M-x load-library <RET> "org"
>   - again, in calendar, i-d
>   - the above error results.
>
> I'm not sure yet whether I fat-fingered something, so I'd like
> some hints in investigating before declaring this to be a bug.

Thanks for providing a detailed path to the error.  But I can't
reproduce this error; I get

- diary buffer is open, with a new line primed with date

instead of the error.

Since you start with -Q and command org-agenda-diary-entry is a command
in org-agenda this looks suspicious AFAICT.

Does the

- M-x load-library <RET> "org"

mix in some weird Org version and/or setting?  And btw why load Org a
second time?


Best regards,
-- 
Marco


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

* Re: Calendar vs. org-agenda exit
  2021-06-23 15:16   ` Marco Wahl
@ 2021-06-23 15:28     ` tomas
  2021-06-23 16:16       ` [SOLVED] (kinda) " tomas
  0 siblings, 1 reply; 14+ messages in thread
From: tomas @ 2021-06-23 15:28 UTC (permalink / raw)
  To: Marco Wahl; +Cc: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 1759 bytes --]

On Wed, Jun 23, 2021 at 05:16:50PM +0200, Marco Wahl wrote:
> Hi.
> 
> > is org mode rebinding keys in the calendar?
> 
> Yes.  "c" calls the Org agenda.
> 
> "i" in the calendar calls org-agenda-diary-entry when
> org-agenda-diary-file has been configured.  (See function
> org--setup-calendar-bindings.)

Thanks! This must be it, I'll have a look and report back.

> > I ask, because I've been using traditional calendar+diary; now,
> > when I try to insert an entry (i-d in calendar), I get
> >
> >   "Wrong type argument: commandp, org-agenda-diary-entry"
> 
> > The following experiment points in Org's general direction:
> >
> >   - emacs -Q
> >   - M-x calendar
> >   - with point on some date, i-d
> >   - diary buffer is open, with a new line primed with date
> >   - M-x load-library <RET> "org"
> >   - again, in calendar, i-d
> >   - the above error results.
> >
> > I'm not sure yet whether I fat-fingered something, so I'd like
> > some hints in investigating before declaring this to be a bug.
> 
> Thanks for providing a detailed path to the error.  But I can't
> reproduce this error; I get
> 
> - diary buffer is open, with a new line primed with date
> 
> instead of the error.

I must have mis-communicated. The above (i.e. diary buffer opens with
no error) happens after the -Q. Note that it is the non-org diary.

> Since you start with -Q and command org-agenda-diary-entry is a command
> in org-agenda this looks suspicious AFAICT.
> 
> Does the
> 
> - M-x load-library <RET> "org"
> 
> mix in some weird Org version and/or setting?  And btw why load Org a
> second time?

No, it is the first load of org. I'll look into org-agenda diary file,
as you suggest above.

Cheers
 - t

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

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

* [SOLVED] (kinda) Calendar vs. org-agenda exit
  2021-06-23 15:28     ` tomas
@ 2021-06-23 16:16       ` tomas
  2021-06-24 10:13         ` Stephen Berman
  0 siblings, 1 reply; 14+ messages in thread
From: tomas @ 2021-06-23 16:16 UTC (permalink / raw)
  To: Marco Wahl; +Cc: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 523 bytes --]

On Wed, Jun 23, 2021 at 05:28:36PM +0200, tomas@tuxteam.de wrote:

[calendar insert-diary-entry doing funny things]

OK, I solved it by setting `org-calendar-insert-diary-entry-key' to
[106], which is a ?j. It was set to ?i, which hijacked calendar's
original key map.

Now I still don't know whether it's intended that Org hijacks that
key in calendar, whether I did something stupid, but at least I have
my toys back. Just remember to not push ?j.

Anyway, you set me on the right track, so thanks for that!

Cheers
 - t

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

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

* Re: [SOLVED] (kinda) Calendar vs. org-agenda exit
  2021-06-23 16:16       ` [SOLVED] (kinda) " tomas
@ 2021-06-24 10:13         ` Stephen Berman
  2021-06-24 12:09           ` tomas
  0 siblings, 1 reply; 14+ messages in thread
From: Stephen Berman @ 2021-06-24 10:13 UTC (permalink / raw)
  To: tomas; +Cc: Marco Wahl, emacs-orgmode

On Wed, 23 Jun 2021 18:16:52 +0200 tomas@tuxteam.de wrote:

> On Wed, Jun 23, 2021 at 05:28:36PM +0200, tomas@tuxteam.de wrote:
>
> [calendar insert-diary-entry doing funny things]
>
> OK, I solved it by setting `org-calendar-insert-diary-entry-key' to
> [106], which is a ?j. It was set to ?i, which hijacked calendar's
> original key map.
>
> Now I still don't know whether it's intended that Org hijacks that
> key in calendar, whether I did something stupid, but at least I have
> my toys back. Just remember to not push ?j.
>
> Anyway, you set me on the right track, so thanks for that!

See also bug#48199 (also CC'd at
https://lists.gnu.org/archive/html/emacs-orgmode/2021-05/msg00582.html).
I continue to use the patch I posted there and have had no problems with
it (but I don't use org-mode much).

Steve Berman


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

* Re: [SOLVED] (kinda) Calendar vs. org-agenda exit
  2021-06-24 10:13         ` Stephen Berman
@ 2021-06-24 12:09           ` tomas
  2021-06-24 12:44             ` Stephen Berman
  0 siblings, 1 reply; 14+ messages in thread
From: tomas @ 2021-06-24 12:09 UTC (permalink / raw)
  To: Stephen Berman; +Cc: Marco Wahl, emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 1195 bytes --]

On Thu, Jun 24, 2021 at 12:13:40PM +0200, Stephen Berman wrote:
> On Wed, 23 Jun 2021 18:16:52 +0200 tomas@tuxteam.de wrote:
> 
> > On Wed, Jun 23, 2021 at 05:28:36PM +0200, tomas@tuxteam.de wrote:
> >
> > [calendar insert-diary-entry doing funny things]
> >
> > OK, I solved it by setting `org-calendar-insert-diary-entry-key' to
> > [106], which is a ?j. It was set to ?i, which hijacked calendar's
> > original key map.
> >
> > Now I still don't know whether it's intended that Org hijacks that
> > key in calendar, whether I did something stupid, but at least I have
> > my toys back. Just remember to not push ?j.
> >
> > Anyway, you set me on the right track, so thanks for that!
> 
> See also bug#48199 (also CC'd at
> https://lists.gnu.org/archive/html/emacs-orgmode/2021-05/msg00582.html).
> I continue to use the patch I posted there and have had no problems with
> it (but I don't use org-mode much).

Oh, I see, thanks. For me, it's a bit confusing that this bug receives
so little attention. Hijacking other modes's keymaps isn't... friendly,
after all. I can't imagine that it is happening by intention.

Cheers & thanks for the background.

-- tomás

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

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

* Re: [SOLVED] (kinda) Calendar vs. org-agenda exit
  2021-06-24 12:09           ` tomas
@ 2021-06-24 12:44             ` Stephen Berman
  2021-06-24 15:04               ` Nicolas Goaziou
  2021-06-24 20:54               ` Tim Cross
  0 siblings, 2 replies; 14+ messages in thread
From: Stephen Berman @ 2021-06-24 12:44 UTC (permalink / raw)
  To: tomas; +Cc: Marco Wahl, emacs-orgmode

On Thu, 24 Jun 2021 14:09:46 +0200 tomas@tuxteam.de wrote:

> On Thu, Jun 24, 2021 at 12:13:40PM +0200, Stephen Berman wrote:
>> On Wed, 23 Jun 2021 18:16:52 +0200 tomas@tuxteam.de wrote:
>>
>> > On Wed, Jun 23, 2021 at 05:28:36PM +0200, tomas@tuxteam.de wrote:
>> >
>> > [calendar insert-diary-entry doing funny things]
>> >
>> > OK, I solved it by setting `org-calendar-insert-diary-entry-key' to
>> > [106], which is a ?j. It was set to ?i, which hijacked calendar's
>> > original key map.
>> >
>> > Now I still don't know whether it's intended that Org hijacks that
>> > key in calendar, whether I did something stupid, but at least I have
>> > my toys back. Just remember to not push ?j.
>> >
>> > Anyway, you set me on the right track, so thanks for that!
>>
>> See also bug#48199 (also CC'd at
>> https://lists.gnu.org/archive/html/emacs-orgmode/2021-05/msg00582.html).
>> I continue to use the patch I posted there and have had no problems with
>> it (but I don't use org-mode much).
>
> Oh, I see, thanks. For me, it's a bit confusing that this bug receives
> so little attention. Hijacking other modes's keymaps isn't... friendly,
> after all. I can't imagine that it is happening by intention.

Yeah, the next time Org is merged to the Emacs master branch, forcing me
to first stash and then reapply my patch locally, I'll ask if anyone
objects to the patch being committed to master.  Maybe that will get
someone's attention (and if not, I may just go ahead and commit it -- if
it then still gets no one's attention, it must be ok ;-).

Steve Berman


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

* Re: [SOLVED] (kinda) Calendar vs. org-agenda exit
  2021-06-24 12:44             ` Stephen Berman
@ 2021-06-24 15:04               ` Nicolas Goaziou
  2021-06-24 17:28                 ` tomas
  2021-06-24 20:54               ` Tim Cross
  1 sibling, 1 reply; 14+ messages in thread
From: Nicolas Goaziou @ 2021-06-24 15:04 UTC (permalink / raw)
  To: Stephen Berman; +Cc: Marco Wahl, tomas, emacs-orgmode

Hello,

Stephen Berman <stephen.berman@gmx.net> writes:

> Yeah, the next time Org is merged to the Emacs master branch, forcing me
> to first stash and then reapply my patch locally, I'll ask if anyone
> objects to the patch being committed to master.

Sure, go ahead.

Regards,
-- 
Nicolas Goaziou


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

* Re: [SOLVED] (kinda) Calendar vs. org-agenda exit
  2021-06-24 15:04               ` Nicolas Goaziou
@ 2021-06-24 17:28                 ` tomas
  0 siblings, 0 replies; 14+ messages in thread
From: tomas @ 2021-06-24 17:28 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: Marco Wahl, Stephen Berman, emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 411 bytes --]

On Thu, Jun 24, 2021 at 05:04:02PM +0200, Nicolas Goaziou wrote:
> Hello,
> 
> Stephen Berman <stephen.berman@gmx.net> writes:
> 
> > Yeah, the next time Org is merged to the Emacs master branch, forcing me
> > to first stash and then reapply my patch locally, I'll ask if anyone
> > objects to the patch being committed to master.
> 
> Sure, go ahead.

Warm thanks, you both!

:)

Cheers
 - t

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

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

* Re: [SOLVED] (kinda) Calendar vs. org-agenda exit
  2021-06-24 12:44             ` Stephen Berman
  2021-06-24 15:04               ` Nicolas Goaziou
@ 2021-06-24 20:54               ` Tim Cross
  2021-06-24 21:07                 ` tomas
  1 sibling, 1 reply; 14+ messages in thread
From: Tim Cross @ 2021-06-24 20:54 UTC (permalink / raw)
  To: emacs-orgmode


Stephen Berman <stephen.berman@gmx.net> writes:

> On Thu, 24 Jun 2021 14:09:46 +0200 tomas@tuxteam.de wrote:
>
>> On Thu, Jun 24, 2021 at 12:13:40PM +0200, Stephen Berman wrote:
>>> On Wed, 23 Jun 2021 18:16:52 +0200 tomas@tuxteam.de wrote:
>>>
>>> > On Wed, Jun 23, 2021 at 05:28:36PM +0200, tomas@tuxteam.de wrote:
>>> >
>>> > [calendar insert-diary-entry doing funny things]
>>> >
>>> > OK, I solved it by setting `org-calendar-insert-diary-entry-key' to
>>> > [106], which is a ?j. It was set to ?i, which hijacked calendar's
>>> > original key map.
>>> >
>>> > Now I still don't know whether it's intended that Org hijacks that
>>> > key in calendar, whether I did something stupid, but at least I have
>>> > my toys back. Just remember to not push ?j.
>>> >
>>> > Anyway, you set me on the right track, so thanks for that!
>>>
>>> See also bug#48199 (also CC'd at
>>> https://lists.gnu.org/archive/html/emacs-orgmode/2021-05/msg00582.html).
>>> I continue to use the patch I posted there and have had no problems with
>>> it (but I don't use org-mode much).
>>
>> Oh, I see, thanks. For me, it's a bit confusing that this bug receives
>> so little attention. Hijacking other modes's keymaps isn't... friendly,
>> after all. I can't imagine that it is happening by intention.
>
> Yeah, the next time Org is merged to the Emacs master branch, forcing me
> to first stash and then reapply my patch locally, I'll ask if anyone
> objects to the patch being committed to master.  Maybe that will get
> someone's attention (and if not, I may just go ahead and commit it -- if
> it then still gets no one's attention, it must be ok ;-).
>

My view is that if org-mode is stealing the calendar bindings by default
i.e. user has not enabled some specific option/configuration to do this,
then this is a bug. Org should not interfere with the key bindings of
any mode unless asked to. Some people still like to use traditional
Emacs diary rather than org agenda for scheduling meetings/appointments,
but like to use (load) org for other things (like document authoring and
TODO lists). Org should only override the calendar bindings if
requested.

If your patch fixes this, I vote to apply it to master.


-- 
Tim Cross


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

* Re: [SOLVED] (kinda) Calendar vs. org-agenda exit
  2021-06-24 20:54               ` Tim Cross
@ 2021-06-24 21:07                 ` tomas
  0 siblings, 0 replies; 14+ messages in thread
From: tomas @ 2021-06-24 21:07 UTC (permalink / raw)
  To: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 321 bytes --]

On Fri, Jun 25, 2021 at 06:54:25AM +1000, Tim Cross wrote:

[...]
> My view is that if org-mode is stealing the calendar bindings by default
> i.e. user has not enabled some specific option/configuration to do this,
> then this is a bug [...]

AFAIU, Stephen just gave his green light to Stephen's patch :-)

Cheers
 - t

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

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

end of thread, other threads:[~2021-06-24 21:08 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-22 10:39 org-edit-src-exit randomizes / mixes up code in source-buffer on exit mcg
2021-06-22 13:33 ` Sébastien Miquel
2021-06-22 14:57   ` mcg
2021-06-23  9:15 ` Calendar vs. org-agenda exit tomas
2021-06-23 15:16   ` Marco Wahl
2021-06-23 15:28     ` tomas
2021-06-23 16:16       ` [SOLVED] (kinda) " tomas
2021-06-24 10:13         ` Stephen Berman
2021-06-24 12:09           ` tomas
2021-06-24 12:44             ` Stephen Berman
2021-06-24 15:04               ` Nicolas Goaziou
2021-06-24 17:28                 ` tomas
2021-06-24 20:54               ` Tim Cross
2021-06-24 21:07                 ` tomas

Code repositories for project(s) associated with this 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).