Re: [O] org-end-of-line and in table interaction

2018-09-29 Thread Robert Pluim
Nicolas Goaziou  writes:

> Robert Pluim  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



Re: [O] org-end-of-line and in table interaction

2018-09-28 Thread Nicolas Goaziou
Robert Pluim  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? 



Re: [O] org-end-of-line and in table interaction

2018-09-28 Thread Robert Pluim
Nicolas Goaziou  writes:

> Robert Pluim  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



Re: [O] org-end-of-line and in table interaction

2018-09-28 Thread Nicolas Goaziou
Robert Pluim  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?



Re: [O] org-end-of-line and in table interaction

2018-09-28 Thread Robert Pluim
Nicolas Goaziou  writes:

> Hello,
>
> Robert Pluim  writes:
>
>> I have
>>
>> (add-hook 'org-tab-first-hook 'org-end-of-line)
>>
>> This causes  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



Re: [O] org-end-of-line and in table interaction

2018-09-28 Thread Nicolas Goaziou
Hello,

Robert Pluim  writes:

> I have
>
> (add-hook 'org-tab-first-hook 'org-end-of-line)
>
> This causes  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



[O] org-end-of-line and in table interaction

2018-09-28 Thread Robert Pluim
Hi,

I have

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

This causes  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 ( 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 ( 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)