* org-do-**mote does not work properly on empty headings
@ 2015-09-02 23:55 Konstantin Kliakhandler
2015-09-03 1:20 ` Kyle Meyer
0 siblings, 1 reply; 5+ messages in thread
From: Konstantin Kliakhandler @ 2015-09-02 23:55 UTC (permalink / raw)
To: emacs-orgmode
[-- Attachment #1: Type: text/plain, Size: 910 bytes --]
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.
I tracked this down to org-do-demote/promote, since calling org-promote and
org-demote does not appear to suffer from this. I will investigate further
and report.
Versions:
Org-mode version 8.3.1 (8.3.1-95-g1dbb25-elpa @
/Users/kosta/.emacs.d/elpa/org-20150831/)
GNU Emacs 24.5.1 (x86_64-apple-darwin14.3.0, Carbon Version 157 AppKit
1347.57) of 2015-06-01 on Singularity-2.local
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.
--
Konstantin Kliakhandler
http://slumpy.org
)°) )°( (°(
[-- Attachment #2: Type: text/html, Size: 1244 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: org-do-**mote does not work properly on empty headings
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
0 siblings, 1 reply; 5+ messages in thread
From: Kyle Meyer @ 2015-09-03 1:20 UTC (permalink / raw)
To: Konstantin Kliakhandler; +Cc: emacs-orgmode
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
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: org-do-**mote does not work properly on empty headings
2015-09-03 1:20 ` Kyle Meyer
@ 2015-09-03 2:38 ` Konstantin Kliakhandler
2015-09-03 3:22 ` Kyle Meyer
0 siblings, 1 reply; 5+ messages in thread
From: Konstantin Kliakhandler @ 2015-09-03 2:38 UTC (permalink / raw)
To: Kyle Meyer; +Cc: emacs-orgmode
[-- 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 --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: org-do-**mote does not work properly on empty headings
2015-09-03 2:38 ` Konstantin Kliakhandler
@ 2015-09-03 3:22 ` Kyle Meyer
2015-09-03 3:24 ` Konstantin Kliakhandler
0 siblings, 1 reply; 5+ messages in thread
From: Kyle Meyer @ 2015-09-03 3:22 UTC (permalink / raw)
To: Konstantin Kliakhandler; +Cc: emacs-orgmode
Konstantin Kliakhandler <kosta@slumpy.org> writes:
> (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.
One way to remove the TODO state is to give a numeric prefix higher than
the number of states you have. You have a lot of states, but something
like 'C-99 C-c C-t' should work and is only a little harder to type than
'C-c C-t -'.
--
Kyle
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: org-do-**mote does not work properly on empty headings
2015-09-03 3:22 ` Kyle Meyer
@ 2015-09-03 3:24 ` Konstantin Kliakhandler
0 siblings, 0 replies; 5+ messages in thread
From: Konstantin Kliakhandler @ 2015-09-03 3:24 UTC (permalink / raw)
To: Kyle Meyer; +Cc: emacs-orgmode
[-- Attachment #1: Type: text/plain, Size: 1113 bytes --]
Good to know, thanks!
--
Konstantin Kliakhandler
http://slumpy.org
)°) )°( (°(
On 2 September 2015 at 22:22, Kyle Meyer <kyle@kyleam.com> wrote:
> Konstantin Kliakhandler <kosta@slumpy.org> writes:
>
> > (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.
>
> One way to remove the TODO state is to give a numeric prefix higher than
> the number of states you have. You have a lot of states, but something
> like 'C-99 C-c C-t' should work and is only a little harder to type than
> 'C-c C-t -'.
>
> --
> Kyle
>
[-- Attachment #2: Type: text/html, Size: 1992 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2015-09-03 3:24 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2015-09-03 3:22 ` Kyle Meyer
2015-09-03 3:24 ` Konstantin Kliakhandler
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).