emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Konstantin Kliakhandler <kosta@slumpy.org>
To: Kyle Meyer <kyle@kyleam.com>
Cc: emacs-orgmode@gnu.org
Subject: Re: org-do-**mote does not work properly on empty headings
Date: Wed, 2 Sep 2015 21:38:06 -0500	[thread overview]
Message-ID: <CAH+LVpm4BCUFPP1FEi6guCiL5CO4PeZcMHS2N5NjjQmFYYM6Og@mail.gmail.com> (raw)
In-Reply-To: <87egig47tv.fsf@kyleam.com>

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

Thanks Kyle,

First, I apologise for the poorly chosen subject. I indeed looks like
something in my setup - I am also unable to reproduce with emacs -Q.


Since I posted this, I looked further and found that the place where the
problem occurs for me is in the function `org-fix-position-after-promote'.
I will paste it here for your convenience:

```

> (defun org-fix-position-after-promote ()
>   "Make sure that after pro/demotion cursor position is right."
>   (let ((pos (point)))
>     (when (save-excursion
>    (beginning-of-line 1)
>    (looking-at org-todo-line-regexp)
>    (or (equal pos (match-end 1)) (equal pos (match-end 2))))
>       (cond ((eobp) (insert " "))
>    ((eolp) (insert " "))
>    ((equal (char-after) ?\ ) (forward-char 1))))))

```

Specifically, (equal pos (match-end 2)) evals to t here and to nil on a
clean system. I examined the difference between the the two setups.

In my setup, the variable `org-todo-line-regexp' is set to:
"^\\(\\*+\\)\\(?:
+\\(\\(?:C\\(?:ANCELLED\\|OMPLETE\\|REDENTIAL\\)\\|DONE\\|EVENT\\|FUTURE\\|HABIT\\|N\\(?:OTE\\|UMBER\\)\\|OBJECT\\|PROJECT\\|STARTED\\|T\\(?:EMP\\|ODO\\)\\|WAITING\\)?\\)\\)?\\(?:
+\\(.*?\\)\\)?[ ]*$"

(yes, I know - I have too many labels...)

In the clean system, the variable is set as follows:
"^\\(\\*+\\)\\(?: +\\(TODO\\|DONE\\)\\)?\\(?: +\\(.*?\\)\\)?[ ]*$"

Incidentally, the *only* difference between the two is in group 2 which
matches in my setup and does not match in the default setup. Just in case
it isn't obvious, this variable appears to get autogenerated from my
settings.
If I'm not mistaken, it looks like the group in my case matches the empty
string and then the function decides to add a space since we are at the end
of the line. The question then is, why does the empty get matched?

Well, I know why; my `org-todo-keywords' is setup as follows:

  (setq org-todo-keywords
>         '((type "TODO(t!)" "|" "DONE(d!)" "CANCELLED(c@)")
>           (type "HABIT(h!)" "|" "DONE(d!)")
>           (type "WAITING(w@/!)" "FUTURE(f!/@)" "STARTED(s@/!)" "|"
> "DONE(d!)")
>           (type "|" "NOTE(n)" "NUMBER(#)" "CREDENTIAL($)" "OBJECT(o)"
> "TEMP(e)")
>           (type "EVENT(n)")
>           (type "PROJECT(p!)" "|" "COMPLETE(m@)")
>           (type "(-)")
>         ))


Disregard that there are key collisions, and notice the last entry, which I
made to be able to easily remove the TODO tags altogether. Well, I guess
I'll have to lose it.

Thanks for the attention!
Kosta


-- 
Konstantin Kliakhandler
    http://slumpy.org
          )°) )°( (°(

On 2 September 2015 at 20:20, Kyle Meyer <kyle@kyleam.com> wrote:

> Hello,
>
> Konstantin Kliakhandler <kosta@slumpy.org> writes:
>
> > Hello,
> >
> > When I start a new heading and don't add text yet but click
> M-right/M-left,
> > new spaces are tacked to the end so that when I do begin to write,
> > sometimes there are too many spaces at the front.
>
> [...]
>
> > Steps to reproduce:
> > 1. Make a heading with some text underneath
> > 2. M-Return to create a new heading
> > 3. M-Right, M-Left would get you to the same heading level, but the
> cursor
> > would be further to the right than started with.
>
> I'm unable to reproduce this running 'emacs -Q' with either
> release_8.3.1-194-ga2d0cd9 or release_8.3.1.  The cursor remains one
> space from the last star.
>
> --
> Kyle
>

[-- Attachment #2: Type: text/html, Size: 5444 bytes --]

  reply	other threads:[~2015-09-03  2:38 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-02 23:55 org-do-**mote does not work properly on empty headings Konstantin Kliakhandler
2015-09-03  1:20 ` Kyle Meyer
2015-09-03  2:38   ` Konstantin Kliakhandler [this message]
2015-09-03  3:22     ` Kyle Meyer
2015-09-03  3:24       ` Konstantin Kliakhandler

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAH+LVpm4BCUFPP1FEi6guCiL5CO4PeZcMHS2N5NjjQmFYYM6Og@mail.gmail.com \
    --to=kosta@slumpy.org \
    --cc=emacs-orgmode@gnu.org \
    --cc=kyle@kyleam.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).