emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [bug] orgstruct++-mode breaks backward-sentence
@ 2015-03-24 18:53 Rasmus
  2015-03-24 18:59 ` Rasmus
  0 siblings, 1 reply; 11+ messages in thread
From: Rasmus @ 2015-03-24 18:53 UTC (permalink / raw)
  To: emacs-orgmode

Hi,

Consider the following test file in text-mode where "|" is the cursor.

   1.  Foo bar
       baz|

Before turning on orgstruct++-mode backward-sentence will correctly go to
"|Foo".  When turning on orgstruct-mode, backward-sentence will also work
correctly.  So somehow orgstruct++ does something that ruins
backward-sentence.  Note that (sentence-end) does not seem to be affected
by orgstruct++-mode.

I'm not really sure how to debug this further.

Thanks,
Rasmus

-- 
Spil noget med Slayer!

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

* Re: [bug] orgstruct++-mode breaks backward-sentence
  2015-03-24 18:53 [bug] orgstruct++-mode breaks backward-sentence Rasmus
@ 2015-03-24 18:59 ` Rasmus
  2015-03-24 20:55   ` Nicolas Goaziou
  0 siblings, 1 reply; 11+ messages in thread
From: Rasmus @ 2015-03-24 18:59 UTC (permalink / raw)
  To: emacs-orgmode

Rasmus <rasmus@gmx.us> writes:

> Hi,
>
> Consider the following test file in text-mode where "|" is the cursor.
>
>    1.  Foo bar
>        baz|
>
> Before turning on orgstruct++-mode backward-sentence will correctly go to
> "|Foo".  When turning on orgstruct-mode, backward-sentence will also work
> correctly.  So somehow orgstruct++ does something that ruins
> backward-sentence.  Note that (sentence-end) does not seem to be affected
> by orgstruct++-mode.

This is actually not particular to orgstruct++-mode.  It also happens in
org-mode.  With orgstruct-mode fill-paragraph does not work on lists.
Maybe you can't have both?

Thanks,
Rasmus

-- 
In theory, practice and theory are the same. In practice they are not

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

* Re: [bug] orgstruct++-mode breaks backward-sentence
  2015-03-24 18:59 ` Rasmus
@ 2015-03-24 20:55   ` Nicolas Goaziou
  2015-03-24 22:01     ` Rasmus
  0 siblings, 1 reply; 11+ messages in thread
From: Nicolas Goaziou @ 2015-03-24 20:55 UTC (permalink / raw)
  To: Rasmus; +Cc: emacs-orgmode

Hello,

Rasmus <rasmus@gmx.us> writes:

> Rasmus <rasmus@gmx.us> writes:
>
>> Hi,
>>
>> Consider the following test file in text-mode where "|" is the cursor.
>>
>>    1.  Foo bar
>>        baz|
>>
>> Before turning on orgstruct++-mode backward-sentence will correctly go to
>> "|Foo".  When turning on orgstruct-mode, backward-sentence will also work
>> correctly.  So somehow orgstruct++ does something that ruins
>> backward-sentence.  Note that (sentence-end) does not seem to be affected
>> by orgstruct++-mode.
>
> This is actually not particular to orgstruct++-mode.  It also happens in
> org-mode.  With orgstruct-mode fill-paragraph does not work on lists.
> Maybe you can't have both?

I'm confused. Your first message talks about `backward-sentence' and the
second one about `fill-paragraph'. Could you explain what the bug is?

Regards,

-- 
Nicolas Goaziou

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

* Re: [bug] orgstruct++-mode breaks backward-sentence
  2015-03-24 20:55   ` Nicolas Goaziou
@ 2015-03-24 22:01     ` Rasmus
  2015-03-29 12:15       ` Nicolas Goaziou
  0 siblings, 1 reply; 11+ messages in thread
From: Rasmus @ 2015-03-24 22:01 UTC (permalink / raw)
  To: emacs-orgmode

Hi,

Nicolas Goaziou <mail@nicolasgoaziou.fr> writes:

>>> Consider the following test file in text-mode where "|" is the cursor.
>>>
>>>    1.  Foo bar
>>>        baz|
>>>
>>> Before turning on orgstruct++-mode backward-sentence will correctly go to
>>> "|Foo".  When turning on orgstruct-mode, backward-sentence will also work
>>> correctly.  So somehow orgstruct++ does something that ruins
>>> backward-sentence.  Note that (sentence-end) does not seem to be affected
>>> by orgstruct++-mode.
>>
>> This is actually not particular to orgstruct++-mode.  It also happens in
>> org-mode.  With orgstruct-mode fill-paragraph does not work on lists.
>> Maybe you can't have both?
>
> I'm confused. Your first message talks about `backward-sentence' and the
> second one about `fill-paragraph'. Could you explain what the bug is?

Forget about fill-paragraph.  Try this with test-org as nil and non-nil:

(let ((test-org nil))
  (switch-to-buffer "test.org")
  (if test-org (org-mode) (text-mode))
  (erase-buffer)
  (insert "1. foo bar\n   baz")
  (backward-sentence))

When the buffer is in org-mode backward sentence behaves differently from
when it's in text-mode.  I think text-mode behaves correctly.

[The aside was that this does not happen in orgstruct-mode, but in
 orgstruct-mode fill-paragraph does not work.]

Thanks,
Rasmus

-- 
And I faced endless streams of vendor-approved Ikea furniture. . .

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

* Re: [bug] orgstruct++-mode breaks backward-sentence
  2015-03-24 22:01     ` Rasmus
@ 2015-03-29 12:15       ` Nicolas Goaziou
  2015-05-22 15:52         ` Rasmus
  0 siblings, 1 reply; 11+ messages in thread
From: Nicolas Goaziou @ 2015-03-29 12:15 UTC (permalink / raw)
  To: Rasmus; +Cc: emacs-orgmode

Rasmus <rasmus@gmx.us> writes:

> Forget about fill-paragraph.  Try this with test-org as nil and non-nil:
>
> (let ((test-org nil))
>   (switch-to-buffer "test.org")
>   (if test-org (org-mode) (text-mode))
>   (erase-buffer)
>   (insert "1. foo bar\n   baz")
>   (backward-sentence))
>
> When the buffer is in org-mode backward sentence behaves differently from
> when it's in text-mode.  I think text-mode behaves correctly.

This should be fixed in 98ec17e204689f415200a2930fc148bf6a4dfe49. Thank
you.

Regards,

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

* Re: [bug] orgstruct++-mode breaks backward-sentence
  2015-03-29 12:15       ` Nicolas Goaziou
@ 2015-05-22 15:52         ` Rasmus
  2015-05-23 19:35           ` Nicolas Goaziou
  0 siblings, 1 reply; 11+ messages in thread
From: Rasmus @ 2015-05-22 15:52 UTC (permalink / raw)
  To: emacs-orgmode

Hi,

Sorry for bringing this thread up again.

Nicolas Goaziou <mail@nicolasgoaziou.fr> writes:

> Rasmus <rasmus@gmx.us> writes:
>
>> Forget about fill-paragraph.  Try this with test-org as nil and non-nil:
>>
>> (let ((test-org nil))
>>   (switch-to-buffer "test.org")
>>   (if test-org (org-mode) (text-mode))
>>   (erase-buffer)
>>   (insert "1. foo bar\n   baz")
>>   (backward-sentence))
>>
>> When the buffer is in org-mode backward sentence behaves differently from
>> when it's in text-mode.  I think text-mode behaves correctly.
>
> This should be fixed in 98ec17e204689f415200a2930fc148bf6a4dfe49. Thank
> you.

Actually when calling just backward-sentence this still seems broken.

(mapcar (lambda (mode)
	  (with-temp-buffer
	    (text-mode)
	    (funcall mode)
	    (insert"- foo
  bar")
	    (backward-sentence)
	    (point)))
	'(text-mode org-mode turn-on-orgstruct++))
=> (1 9 9)

It only works if I explicitly call org-backward-sentence, not
backward-sentence.  In orgstruct-mode this seems unfortunate.

—Rasmus

-- 
Spil noget med Slayer!

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

* Re: [bug] orgstruct++-mode breaks backward-sentence
  2015-05-22 15:52         ` Rasmus
@ 2015-05-23 19:35           ` Nicolas Goaziou
  2015-05-23 19:53             ` Rasmus
  2015-05-24 10:37             ` Rasmus
  0 siblings, 2 replies; 11+ messages in thread
From: Nicolas Goaziou @ 2015-05-23 19:35 UTC (permalink / raw)
  To: Rasmus; +Cc: emacs-orgmode

Rasmus <rasmus@gmx.us> writes:

> Actually when calling just backward-sentence this still seems broken.
>
> (mapcar (lambda (mode)
> 	  (with-temp-buffer
> 	    (text-mode)
> 	    (funcall mode)
> 	    (insert"- foo
>   bar")
> 	    (backward-sentence)
> 	    (point)))
> 	'(text-mode org-mode turn-on-orgstruct++))
> => (1 9 9)
>
> It only works if I explicitly call org-backward-sentence, not
> backward-sentence.  In orgstruct-mode this seems unfortunate.

I think the best we can do is to hijack M-a/M-e when `orgstruct-mode' is
used. `orgtbl-mode' already does it actually.

WDYT?


Regards,

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

* Re: [bug] orgstruct++-mode breaks backward-sentence
  2015-05-23 19:35           ` Nicolas Goaziou
@ 2015-05-23 19:53             ` Rasmus
  2015-05-23 20:03               ` Nicolas Goaziou
  2015-05-24 10:37             ` Rasmus
  1 sibling, 1 reply; 11+ messages in thread
From: Rasmus @ 2015-05-23 19:53 UTC (permalink / raw)
  To: emacs-orgmode

Nicolas Goaziou <mail@nicolasgoaziou.fr> writes:

> I think the best we can do is to hijack M-a/M-e when `orgstruct-mode' is
> used. `orgtbl-mode' already does it actually.
>
> WDYT?

It wouldn't solve my particular issue, as I use (a package that uses)
backward-sentence for asserting whether to capitalize a word.  I could
maintain my own copy of the package, though.

I guess we could, and maybe should, remap the function in orgstruct modes.

Rasmus

-- 
To err is human. To screw up 10⁶ times per second, you need a computer

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

* Re: [bug] orgstruct++-mode breaks backward-sentence
  2015-05-23 19:53             ` Rasmus
@ 2015-05-23 20:03               ` Nicolas Goaziou
  2015-05-23 20:05                 ` Rasmus
  0 siblings, 1 reply; 11+ messages in thread
From: Nicolas Goaziou @ 2015-05-23 20:03 UTC (permalink / raw)
  To: Rasmus; +Cc: emacs-orgmode

Rasmus <rasmus@gmx.us> writes:

> It wouldn't solve my particular issue, as I use (a package that uses)
> backward-sentence for asserting whether to capitalize a word.  I could
> maintain my own copy of the package, though.

You can use `advice-add' in this case.

Regards,

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

* Re: [bug] orgstruct++-mode breaks backward-sentence
  2015-05-23 20:03               ` Nicolas Goaziou
@ 2015-05-23 20:05                 ` Rasmus
  0 siblings, 0 replies; 11+ messages in thread
From: Rasmus @ 2015-05-23 20:05 UTC (permalink / raw)
  To: emacs-orgmode

Nicolas Goaziou <mail@nicolasgoaziou.fr> writes:

> You can use `advice-add' in this case.

Or just add-function.

*I* can solve it one way or the other.  But that does not
necessarily mean that it's not a bug.  And that was the question.

—Rasmus

-- 
. . . It begins of course with The Internet.  A Net of Peers

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

* Re: [bug] orgstruct++-mode breaks backward-sentence
  2015-05-23 19:35           ` Nicolas Goaziou
  2015-05-23 19:53             ` Rasmus
@ 2015-05-24 10:37             ` Rasmus
  1 sibling, 0 replies; 11+ messages in thread
From: Rasmus @ 2015-05-24 10:37 UTC (permalink / raw)
  To: emacs-orgmode

Nicolas Goaziou <mail@nicolasgoaziou.fr> writes:

> I think the best we can do is to hijack M-a/M-e when `orgstruct-mode' is
> used. `orgtbl-mode' already does it actually.

I tried to do this, but somehow I cannot get the magic that builds
orgstruct-mode-map to recognize org-{forward,backward}-sentence.  I think
it has to do with the Meta.  Other Meta bindings use ?\e and the numeric
value that is picked up for \M-a is pretty large...  Sometimes I managed
to get org-backward-sentence in the orgstruct-mode-map, but it just wans't
picked up.

Any hints would be appreciated.

Rasmus

My test:

(progn
  (add-to-list 'load-path "~/src/code/org-mode/lisp")
  (require 'org)
  (require 'cl)
  (mapcar (lambda (mode)
            (with-temp-buffer
              (insert "* test
  - aaa baa
    zaa")
              (text-mode)
              (funcall mode)
              (call-interactively (or (local-key-binding "\M-a")
                                      (global-key-binding "\M-a")))
              (cons (point) (or (local-key-binding "\M-a")
                                (global-key-binding "\M-a")))))
          '(text-mode turn-on-orgstruct++ org-mode)))



-- 
Bang bang

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

end of thread, other threads:[~2015-05-24 10:38 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-24 18:53 [bug] orgstruct++-mode breaks backward-sentence Rasmus
2015-03-24 18:59 ` Rasmus
2015-03-24 20:55   ` Nicolas Goaziou
2015-03-24 22:01     ` Rasmus
2015-03-29 12:15       ` Nicolas Goaziou
2015-05-22 15:52         ` Rasmus
2015-05-23 19:35           ` Nicolas Goaziou
2015-05-23 19:53             ` Rasmus
2015-05-23 20:03               ` Nicolas Goaziou
2015-05-23 20:05                 ` Rasmus
2015-05-24 10:37             ` Rasmus

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