emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] A Microsoftesque detail in org


From: Titus von der Malsburg
Subject: Re: [O] A Microsoftesque detail in org
Date: Sat, 16 May 2015 10:26:00 -0700

Hi Rasmus,

just tried the patch and while I still find it weird to change the
meaning of RET, this solution doesn’t get in my way as much as the
previous solution did.

One minor cosmetic issue:

* TODO foo bar                                                 :test:

When I RET between foo and bar, the tag moves to the left.  I think it
would be nicer if it would stay where it was.

  Titus


On 2015-05-16 Sat 08:28, Rasmus wrote:
> Hi,
>
> Thanks for the comments.
>
> Nicolas Goaziou <address@hidden> writes:
>
>
>> "RET breaks headline text" may be more accurate.
>
> OK.
>
>>> +  (let* ((context (if org-return-follows-link (org-element-context)
>>> +               (org-element-at-point)))
>>> +    (type (org-element-type context)))
>>> +    (cond
>>> +     ;; At a headline
>>> +     ((and (eq type 'headline) (not (bolp)))
>>
>> You are removing an optimization here. 
>>
>> Checking if point is on a headline/inlinetask doesn't require to use
>> `org-element-at-point'/`org-element-context'. It is faster to simply
>> check for `org-outline-regexp' (or derived) at bol.
>>
>> This optimization is less important than it used to be, now that
>> properties drawers are at a fixed location. Nevertheless, it might be
>> worth keeping it in mind.
>
> I did it 'cause it's easier, I think, to read a single cond than first an
> if and then a cond.  The latter also seems easier to fix in the future.
>
>>> +      (org-show-entry)
>>> +      (let ((string ""))
>>> +   (unless (and (save-excursion
>>> +                  (beginning-of-line)
>>> +                  (looking-at org-complex-heading-regexp))
>>> +                (or (and (match-beginning 3)
>>> +                         (< (point)
>>> +                            (save-excursion
>>> +                              (goto-char (match-beginning 4))
>>> +                              (skip-chars-backward " \t")
>>> +                              (point))))
>>> +                    (and (match-beginning 5)
>>> +                         (>= (point) (match-beginning 5)))))
>>> +       ;; Point is on headline keywords, tags or cookies.  Do not break
>>> +       ;; them: add a newline after the headline instead.
>>> +     (setq string (delete-and-extract-region
>>> +                   (point) (or (match-beginning 5)
>>> +                               (line-end-position))))
>>
>> The `setq' is not necessary here. Bind it within `let' instead.
>
> You are right.
>
>>> +     (when (match-beginning 5)
>>> +       (insert (make-string (length string) ?\ ))))
>>
>>   ?\  -> ?\s
>>   
>> If you add this feature, please augment `test-org/return' from
>> "test-org.el" accordingly.
>
> Done and and attached.
>
> Anybody against pushing this?
>
> —Rasmus

Attachment: signature.asc
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]