emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* org-end-of-line and <TAB> in table interaction
@ 2018-09-28  9:29 Robert Pluim
  2018-09-28 10:30 ` Nicolas Goaziou
  0 siblings, 1 reply; 7+ messages in thread
From: Robert Pluim @ 2018-09-28  9:29 UTC (permalink / raw)
  To: emacs-orgmode

Hi,

I have

(add-hook 'org-tab-first-hook 'org-end-of-line)

This causes <TAB> inside a table to always create another row, rather
than moving to the next field. The patch below fixes this for me,
although Iʼm not sure itʼs the right solution.

diff --git a/org.el b/org.el
index 45be987..f22e9a1 100644
--- a/org.el
+++ b/org.el
@@ -23608,6 +23608,7 @@ (defun org-end-of-line (&optional n)
 		   (`(,_ . ,C-e) C-e) (_ org-special-ctrl-a/e)))
 	deactivate-mark)
     ;; First move to a visible line.
+    (when (not (org-at-table-p))
     (if (bound-and-true-p visual-line-mode)
 	(beginning-of-visual-line n)
       (move-beginning-of-line n))
@@ -23651,7 +23652,7 @@ (defun org-end-of-line (&optional n)
 	(when (/= bol (line-beginning-position))
 	  (goto-char bol)
 	  (end-of-line))))
-     (t (end-of-line)))))
+     (t (end-of-line))))))
 
 (define-key org-mode-map "\C-a" 'org-beginning-of-line)
 (define-key org-mode-map "\C-e" 'org-end-of-line)

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

* Re: org-end-of-line and <TAB> in table interaction
  2018-09-28  9:29 org-end-of-line and <TAB> in table interaction Robert Pluim
@ 2018-09-28 10:30 ` Nicolas Goaziou
  2018-09-28 12:01   ` Robert Pluim
  0 siblings, 1 reply; 7+ messages in thread
From: Nicolas Goaziou @ 2018-09-28 10:30 UTC (permalink / raw)
  To: emacs-orgmode

Hello,

Robert Pluim <rpluim@gmail.com> writes:

> I have
>
> (add-hook 'org-tab-first-hook 'org-end-of-line)
>
> This causes <TAB> inside a table to always create another row, rather
> than moving to the next field. The patch below fixes this for me,
> although Iʼm not sure itʼs the right solution.

Why would you want to patch Org source instead of fixing the function
you attach to the hook?

Regards,

-- 
Nicolas Goaziou

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

* Re: org-end-of-line and <TAB> in table interaction
  2018-09-28 10:30 ` Nicolas Goaziou
@ 2018-09-28 12:01   ` Robert Pluim
  2018-09-28 12:21     ` Nicolas Goaziou
  0 siblings, 1 reply; 7+ messages in thread
From: Robert Pluim @ 2018-09-28 12:01 UTC (permalink / raw)
  To: emacs-orgmode

Nicolas Goaziou <mail@nicolasgoaziou.fr> writes:

> Hello,
>
> Robert Pluim <rpluim@gmail.com> writes:
>
>> I have
>>
>> (add-hook 'org-tab-first-hook 'org-end-of-line)
>>
>> This causes <TAB> inside a table to always create another row, rather
>> than moving to the next field. The patch below fixes this for me,
>> although Iʼm not sure itʼs the right solution.
>
> Why would you want to patch Org source instead of fixing the function
> you attach to the hook?

Yes, I could wrap org-end-of-line in a (when (not (org-at-table-p))),
but that would fix it only for me. I was under the impression that
'org-end-of-line' is intended to do something only when in a heading,
since it does:

	       (looking-at org-complex-heading-regexp)))

hence my patch to make it not do anything in tables.

Robert

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

* Re: org-end-of-line and <TAB> in table interaction
  2018-09-28 12:01   ` Robert Pluim
@ 2018-09-28 12:21     ` Nicolas Goaziou
  2018-09-28 12:48       ` Robert Pluim
  0 siblings, 1 reply; 7+ messages in thread
From: Nicolas Goaziou @ 2018-09-28 12:21 UTC (permalink / raw)
  To: emacs-orgmode

Robert Pluim <rpluim@gmail.com> writes:

> I was under the impression that 'org-end-of-line' is intended to do
> something only when in a heading, since it does:
>
> 	       (looking-at org-complex-heading-regexp)))
>
> hence my patch to make it not do anything in tables.

It is meant to do something special on a heading and call `end-of-line'
everywhere else. Are you saying that `org-end-of-line' doesn't call
`end-of-line', as it should?

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

* Re: org-end-of-line and <TAB> in table interaction
  2018-09-28 12:21     ` Nicolas Goaziou
@ 2018-09-28 12:48       ` Robert Pluim
  2018-09-28 15:34         ` Nicolas Goaziou
  0 siblings, 1 reply; 7+ messages in thread
From: Robert Pluim @ 2018-09-28 12:48 UTC (permalink / raw)
  To: emacs-orgmode

Nicolas Goaziou <mail@nicolasgoaziou.fr> writes:

> Robert Pluim <rpluim@gmail.com> writes:
>
>> I was under the impression that 'org-end-of-line' is intended to do
>> something only when in a heading, since it does:
>>
>> 	       (looking-at org-complex-heading-regexp)))
>>
>> hence my patch to make it not do anything in tables.
>
> It is meant to do something special on a heading and call `end-of-line'
> everywhere else. Are you saying that `org-end-of-line' doesn't call
> `end-of-line', as it should?

It does call 'end-of-line'. If thatʼs the intended semantics, itʼs not
entirely clear from the docstring (and I will adjust my code).

Robert

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

* Re: org-end-of-line and <TAB> in table interaction
  2018-09-28 12:48       ` Robert Pluim
@ 2018-09-28 15:34         ` Nicolas Goaziou
  2018-09-29 12:29           ` Robert Pluim
  0 siblings, 1 reply; 7+ messages in thread
From: Nicolas Goaziou @ 2018-09-28 15:34 UTC (permalink / raw)
  To: emacs-orgmode

Robert Pluim <rpluim@gmail.com> writes:

> It does call 'end-of-line'. If thatʼs the intended semantics, itʼs not
> entirely clear from the docstring (and I will adjust my code).

The first sentence is:

  Go to the end of line, but before ellipsis, if any.

If you think that's ambiguous, would you want to suggest a different
wording? Or do you think we should add a more explicit reference to
`end-of-line' function somewhere in the docstring? 

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

* Re: org-end-of-line and <TAB> in table interaction
  2018-09-28 15:34         ` Nicolas Goaziou
@ 2018-09-29 12:29           ` Robert Pluim
  0 siblings, 0 replies; 7+ messages in thread
From: Robert Pluim @ 2018-09-29 12:29 UTC (permalink / raw)
  To: emacs-orgmode

Nicolas Goaziou <mail@nicolasgoaziou.fr> writes:

> Robert Pluim <rpluim@gmail.com> writes:
>
>> It does call 'end-of-line'. If thatʼs the intended semantics, itʼs not
>> entirely clear from the docstring (and I will adjust my code).
>
> The first sentence is:
>
>   Go to the end of line, but before ellipsis, if any.
>
> If you think that's ambiguous, would you want to suggest a different
> wording? Or do you think we should add a more explicit reference to
> `end-of-line' function somewhere in the docstring? 

I thought it was for headlines only because the next paragraph talks
about headlines, but that was entirely my misreading.

Robert

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

end of thread, other threads:[~2018-09-29 12:29 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-09-28  9:29 org-end-of-line and <TAB> in table interaction Robert Pluim
2018-09-28 10:30 ` Nicolas Goaziou
2018-09-28 12:01   ` Robert Pluim
2018-09-28 12:21     ` Nicolas Goaziou
2018-09-28 12:48       ` Robert Pluim
2018-09-28 15:34         ` Nicolas Goaziou
2018-09-29 12:29           ` Robert Pluim

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