* org-fill-paragraph leaves point at end of table
@ 2013-02-25 3:04 Eric Abrahamsen
2013-02-25 9:10 ` Nicolas Goaziou
0 siblings, 1 reply; 4+ messages in thread
From: Eric Abrahamsen @ 2013-02-25 3:04 UTC (permalink / raw
To: emacs-orgmode
Calling `org-fill-paragraph' inside a table leaves point at the end of
the table, for reasons that are totally unclear to me.
I've tested this with up-to-date org and emacs -Q, so I'm hoping it's
reproducible. I edebugged org-fill-paragraph, and it appears to do the
right thing, going from the save-excursion to the cond to the org-table
cond statement, and there calling `org-table-align'. That works
correctly, but stepping forward you come to the end of the enclosing
`save-excursion', and emerging from `save-excursion' puts point at the
end of the table -- precisely what it's not supposed to do!
I made a minimum sexp to reproduce the relevant bits of
org-fill-paragraph:
#+BEGIN_SRC emacs-lisp
(save-excursion
(let ((element (org-element-at-point)))
(case (org-element-type element)
(table-row (org-table-align) t))))
#+END_SRC
Putting point in a table and eval'ing that also leaves point at the end
of the table. I tried using (call-interactively 'org-table-align) and it
did the same thing.
I'm baffled, particularly as it doesn't do this for any other element
type. Any clever ideas? M-q after a bit of typing is already stuck in my
fingers, and this bit of strangeness doesn't set the mark, so editing
long tables is a pain...
Thanks!
E
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: org-fill-paragraph leaves point at end of table
2013-02-25 3:04 org-fill-paragraph leaves point at end of table Eric Abrahamsen
@ 2013-02-25 9:10 ` Nicolas Goaziou
2013-02-25 9:21 ` Carsten Dominik
0 siblings, 1 reply; 4+ messages in thread
From: Nicolas Goaziou @ 2013-02-25 9:10 UTC (permalink / raw
To: Eric Abrahamsen; +Cc: emacs-orgmode
Hello,
Eric Abrahamsen <eric@ericabrahamsen.net> writes:
> Calling `org-fill-paragraph' inside a table leaves point at the end of
> the table, for reasons that are totally unclear to me.
>
> I've tested this with up-to-date org and emacs -Q, so I'm hoping it's
> reproducible. I edebugged org-fill-paragraph, and it appears to do the
> right thing, going from the save-excursion to the cond to the org-table
> cond statement, and there calling `org-table-align'. That works
> correctly, but stepping forward you come to the end of the enclosing
> `save-excursion', and emerging from `save-excursion' puts point at the
> end of the table -- precisely what it's not supposed to do!
>
> I made a minimum sexp to reproduce the relevant bits of
> org-fill-paragraph:
>
> #+BEGIN_SRC emacs-lisp
> (save-excursion
> (let ((element (org-element-at-point)))
> (case (org-element-type element)
> (table-row (org-table-align) t))))
> #+END_SRC
>
> Putting point in a table and eval'ing that also leaves point at the end
> of the table. I tried using (call-interactively 'org-table-align) and it
> did the same thing.
>
> I'm baffled, particularly as it doesn't do this for any other element
> type. Any clever ideas? M-q after a bit of typing is already stuck in my
> fingers, and this bit of strangeness doesn't set the mark, so editing
> long tables is a pain...
`org-table-align' inserts a whole new table and removes completely the
previous one. This confuses `save-excursion' which doesn't recognize any
familiar location anymore.
I've pushed a fix for it. All filling tests pass, but if you notice
anything suspicious, please signal it.
Thank you for the report.
Regards,
--
Nicolas Goaziou
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: org-fill-paragraph leaves point at end of table
2013-02-25 9:10 ` Nicolas Goaziou
@ 2013-02-25 9:21 ` Carsten Dominik
2013-02-25 10:12 ` Eric Abrahamsen
0 siblings, 1 reply; 4+ messages in thread
From: Carsten Dominik @ 2013-02-25 9:21 UTC (permalink / raw
To: Nicolas Goaziou; +Cc: Eric Abrahamsen, emacs-orgmode
On 25 feb. 2013, at 10:10, Nicolas Goaziou <n.goaziou@gmail.com> wrote:
> Hello,
>
> Eric Abrahamsen <eric@ericabrahamsen.net> writes:
>
>> Calling `org-fill-paragraph' inside a table leaves point at the end of
>> the table, for reasons that are totally unclear to me.
>>
>> I've tested this with up-to-date org and emacs -Q, so I'm hoping it's
>> reproducible. I edebugged org-fill-paragraph, and it appears to do the
>> right thing, going from the save-excursion to the cond to the org-table
>> cond statement, and there calling `org-table-align'. That works
>> correctly, but stepping forward you come to the end of the enclosing
>> `save-excursion', and emerging from `save-excursion' puts point at the
>> end of the table -- precisely what it's not supposed to do!
>>
>> I made a minimum sexp to reproduce the relevant bits of
>> org-fill-paragraph:
>>
>> #+BEGIN_SRC emacs-lisp
>> (save-excursion
>> (let ((element (org-element-at-point)))
>> (case (org-element-type element)
>> (table-row (org-table-align) t))))
>> #+END_SRC
>>
>> Putting point in a table and eval'ing that also leaves point at the end
>> of the table. I tried using (call-interactively 'org-table-align) and it
>> did the same thing.
>>
>> I'm baffled, particularly as it doesn't do this for any other element
>> type. Any clever ideas? M-q after a bit of typing is already stuck in my
>> fingers, and this bit of strangeness doesn't set the mark, so editing
>> long tables is a pain...
>
> `org-table-align' inserts a whole new table and removes completely the
> previous one. This confuses `save-excursion' which doesn't recognize any
> familiar location anymore.
>
> I've pushed a fix for it. All filling tests pass, but if you notice
> anything suspicious, please signal it.
I do not expect problems, because you now fall back onto org-table-align without any save-excursion around it, AFAICS. org-table-align remembers line number and table row number and restores them, so this should work.
- Carsten
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: org-fill-paragraph leaves point at end of table
2013-02-25 9:21 ` Carsten Dominik
@ 2013-02-25 10:12 ` Eric Abrahamsen
0 siblings, 0 replies; 4+ messages in thread
From: Eric Abrahamsen @ 2013-02-25 10:12 UTC (permalink / raw
To: emacs-orgmode
Carsten Dominik <carsten.dominik@gmail.com> writes:
> On 25 feb. 2013, at 10:10, Nicolas Goaziou <n.goaziou@gmail.com> wrote:
>
>> Hello,
>>
>> Eric Abrahamsen <eric@ericabrahamsen.net> writes:
>>
>>> Calling `org-fill-paragraph' inside a table leaves point at the end of
>>> the table, for reasons that are totally unclear to me.
>>>
>>> I've tested this with up-to-date org and emacs -Q, so I'm hoping it's
>>> reproducible. I edebugged org-fill-paragraph, and it appears to do the
>>> right thing, going from the save-excursion to the cond to the org-table
>>> cond statement, and there calling `org-table-align'. That works
>>> correctly, but stepping forward you come to the end of the enclosing
>>> `save-excursion', and emerging from `save-excursion' puts point at the
>>> end of the table -- precisely what it's not supposed to do!
>>>
>>> I made a minimum sexp to reproduce the relevant bits of
>>> org-fill-paragraph:
>>>
>>> #+BEGIN_SRC emacs-lisp
>>> (save-excursion
>>> (let ((element (org-element-at-point)))
>>> (case (org-element-type element)
>>> (table-row (org-table-align) t))))
>>> #+END_SRC
>>>
>>> Putting point in a table and eval'ing that also leaves point at the end
>>> of the table. I tried using (call-interactively 'org-table-align) and it
>>> did the same thing.
>>>
>>> I'm baffled, particularly as it doesn't do this for any other element
>>> type. Any clever ideas? M-q after a bit of typing is already stuck in my
>>> fingers, and this bit of strangeness doesn't set the mark, so editing
>>> long tables is a pain...
>>
>> `org-table-align' inserts a whole new table and removes completely the
>> previous one. This confuses `save-excursion' which doesn't recognize any
>> familiar location anymore.
>>
>> I've pushed a fix for it. All filling tests pass, but if you notice
>> anything suspicious, please signal it.
>
> I do not expect problems, because you now fall back onto
> org-table-align without any save-excursion around it, AFAICS.
> org-table-align remembers line number and table row number and
> restores them, so this should work.
And sure enough, it does!
Sorry for all the table-related stuff. I'm in one of those moments where
you throw caution to the wind and entrust a time-sensitive company
project to areas of git-master Orgmode you've never used before. Likely
very stupid, but it's too late to turn back now.
Thanks!
E
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2013-02-25 10:07 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-02-25 3:04 org-fill-paragraph leaves point at end of table Eric Abrahamsen
2013-02-25 9:10 ` Nicolas Goaziou
2013-02-25 9:21 ` Carsten Dominik
2013-02-25 10:12 ` Eric Abrahamsen
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.