all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Calling 'org-babel-mark-block' with 'M-x cmd' and 'M-: (cmd)'
@ 2013-02-03 19:10 Thorsten Jolitz
  2013-02-03 19:43 ` Nick Dokos
  0 siblings, 1 reply; 9+ messages in thread
From: Thorsten Jolitz @ 2013-02-03 19:10 UTC (permalink / raw)
  To: emacs-orgmode


Hi List, 

just wondering (and curious) if this is a bug or (in some way) expected
behaviour:

Say point is at the beginning of the first line of an Org-mode source
block:

,------------------------------------------------
| #+begin_src plantuml :file er-class-diagram.png
| scale 600 width ...           # point at beg-of-line
`------------------------------------------------

Now, when I call interactive command org-babel-mark-block' either with
'M-x org-babel-mark-block' or 'C-c C-v C-M-h', the body of the source
block is (visibly) marked as expected (transient-mark-mode is on). 

But with the point at the same position, evaluating with  'M-:' 

,--------------------------------------
| Eval: (org-babel-mark-block)
`--------------------------------------

returns the position of point without (visibly) marking the source-block
body. 

-- 
cheers,
Thorsten

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

* Re: Calling 'org-babel-mark-block' with 'M-x cmd' and 'M-: (cmd)'
  2013-02-03 19:10 Calling 'org-babel-mark-block' with 'M-x cmd' and 'M-: (cmd)' Thorsten Jolitz
@ 2013-02-03 19:43 ` Nick Dokos
  2013-02-03 20:01   ` Thorsten Jolitz
  0 siblings, 1 reply; 9+ messages in thread
From: Nick Dokos @ 2013-02-03 19:43 UTC (permalink / raw)
  To: Thorsten Jolitz; +Cc: emacs-orgmode

Thorsten Jolitz <tjolitz@googlemail.com> wrote:

> 
> Hi List, 
> 
> just wondering (and curious) if this is a bug or (in some way) expected
> behaviour:
> 
> Say point is at the beginning of the first line of an Org-mode source
> block:
> 
> ,------------------------------------------------
> | #+begin_src plantuml :file er-class-diagram.png
> | scale 600 width ...           # point at beg-of-line
> `------------------------------------------------
> 
> Now, when I call interactive command org-babel-mark-block' either with
> 'M-x org-babel-mark-block' or 'C-c C-v C-M-h', the body of the source
> block is (visibly) marked as expected (transient-mark-mode is on). 
> 
> But with the point at the same position, evaluating with  'M-:' 
> 
> ,--------------------------------------
> | Eval: (org-babel-mark-block)
> `--------------------------------------
> 
> returns the position of point without (visibly) marking the source-block
> body. 
> 

The function is called differently in the two cases:


* backtrace with ESC ESC : (org-babel-mark-block)

  org-babel-mark-block()
  eval((org-babel-mark-block) nil)
  eval-expression((org-babel-mark-block) nil)
  call-interactively(eval-expression nil nil)


* backtrace with M-x org-babel-mark-block

  org-babel-mark-block()
  call-interactively(org-babel-mark-block record nil)
  command-execute(org-babel-mark-block record)
  execute-extended-command(nil "org-babel-mark-block")
  call-interactively(execute-extended-command nil nil)


I don't know if that accounts for the difference - my guess is that
it probably does, but I don't know how.

Nick

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

* Re: Calling 'org-babel-mark-block' with 'M-x cmd' and 'M-: (cmd)'
  2013-02-03 19:43 ` Nick Dokos
@ 2013-02-03 20:01   ` Thorsten Jolitz
  2013-02-11 14:43     ` Bastien
  0 siblings, 1 reply; 9+ messages in thread
From: Thorsten Jolitz @ 2013-02-03 20:01 UTC (permalink / raw)
  To: emacs-orgmode

Nick Dokos <nicholas.dokos@hp.com> writes:

> The function is called differently in the two cases:
>
>
> * backtrace with ESC ESC : (org-babel-mark-block)
>
>   org-babel-mark-block()
>   eval((org-babel-mark-block) nil)
>   eval-expression((org-babel-mark-block) nil)
>   call-interactively(eval-expression nil nil)
>
>
> * backtrace with M-x org-babel-mark-block
>
>   org-babel-mark-block()
>   call-interactively(org-babel-mark-block record nil)
>   command-execute(org-babel-mark-block record)
>   execute-extended-command(nil "org-babel-mark-block")
>   call-interactively(execute-extended-command nil nil)
>
>
> I don't know if that accounts for the difference - my guess is that
> it probably does, but I don't know how.


Interesting, I have to check what happens when I use this function in a
program. Kind of strange, though, is that a bug in
'org-babel-mark-block' - or in Emacs itself?

-- 
cheers,
Thorsten

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

* Re: Calling 'org-babel-mark-block' with 'M-x cmd' and 'M-: (cmd)'
  2013-02-03 20:01   ` Thorsten Jolitz
@ 2013-02-11 14:43     ` Bastien
  2013-02-12 16:55       ` Thorsten Jolitz
  0 siblings, 1 reply; 9+ messages in thread
From: Bastien @ 2013-02-11 14:43 UTC (permalink / raw)
  To: Thorsten Jolitz; +Cc: emacs-orgmode

Hi Thorsten,

Thorsten Jolitz <tjolitz@googlemail.com> writes:

> Interesting, I have to check what happens when I use this function in a
> program. Kind of strange, though, is that a bug in
> 'org-babel-mark-block' - or in Emacs itself?

I think it may have been a temporary bug in Emacs.

Can you reproduce it with a recent Emacs?

Also, M-h is bound to `org-mark-element', which will mark a block
(the whole block, not just its content).  You might find it useful
too!

Best,

-- 
 Bastien

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

* Re: Calling 'org-babel-mark-block' with 'M-x cmd' and 'M-: (cmd)'
  2013-02-11 14:43     ` Bastien
@ 2013-02-12 16:55       ` Thorsten Jolitz
  2013-02-12 21:32         ` Bastien
  0 siblings, 1 reply; 9+ messages in thread
From: Thorsten Jolitz @ 2013-02-12 16:55 UTC (permalink / raw)
  To: emacs-orgmode

Bastien <bzg@altern.org> writes:

Hi Bastien,

> Can you reproduce it with a recent Emacs?

My Emacs is fairly recent: 

,--------------------------------------------------------------------------------
| GNU Emacs 24.2.1 (x86_64-unknown-linux-gnu, GTK+ Version 3.6.4)
|  of 2013-01-20 on eric
| 
| Org-mode version 7.9.3e (7.9.3e-921-g4d5c79 @ /home/tj/gitclone/org-mode/lisp/)
`--------------------------------------------------------------------------------

> Also, M-h is bound to `org-mark-element', which will mark a block
> (the whole block, not just its content).  You might find it useful
> too!

Thats very useful, indeed. 

But the same thing happens when calling 'org-babel-mark-block' or
'org-mark-element' with 'M-: (cmd)': cursor jumps to beginning of the
block/element, nothing is highlighted (transient mark mode), and doing
'M-w' does not put anything into the kill-ring. With 'M-x cmd',
highlighting and copying works. 

Thats not really a problem for me - just a bit strange. 

-- 
cheers,
Thorsten

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

* Re: Calling 'org-babel-mark-block' with 'M-x cmd' and 'M-: (cmd)'
  2013-02-12 16:55       ` Thorsten Jolitz
@ 2013-02-12 21:32         ` Bastien
  0 siblings, 0 replies; 9+ messages in thread
From: Bastien @ 2013-02-12 21:32 UTC (permalink / raw)
  To: Thorsten Jolitz; +Cc: emacs-orgmode

Hi Thorsten,

Thorsten Jolitz <tjolitz@gmail.com> writes:

> Thats not really a problem for me - just a bit strange. 

So maybe this is by design.

Similarily M-: (org-mark-element) RET does not highlight the
region, while M-x org-mark-element RET does.

Perhaps you can ask on emacs-devel for confirming this (or
maybe someone who knows better will chime in this thread!)

-- 
 Bastien

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

* Calling 'org-babel-mark-block' with 'M-x cmd' and 'M-: (cmd)'
@ 2013-02-15 13:55 Thorsten Jolitz
  2013-02-15 15:21 ` Xue Fuqiao
  0 siblings, 1 reply; 9+ messages in thread
From: Thorsten Jolitz @ 2013-02-15 13:55 UTC (permalink / raw)
  To: emacs-devel


Hi List, 

this was posted and discussed on the Org-mode mailing list, but without
any real conclusion if it is a Bug in Emacs - or something else. So it
was suggested to repost it here. 

Say point is behind the closing parenthesis of the sexp in this Org-mode source
block:

,-------------------------------------
| #+begin_src emacs-lisp
| (+ 3 4)          # point behind sexp
| #+end_src
`-------------------------------------

Now, when I call

,-----------------------------
| M-x org-babel-mark-block RET
`-----------------------------

or

,-------------------------
| M-x org-mark-element RET
`-------------------------

the body of the source block (or the whole source-block) is (visibly)
marked as expected (transient-mark-mode is on), and 'M-w' puts the
active region into the kill-ring. 

But with the point at the same position, doing

,-----------------------------
| M-: (org-babel-mark-block) RET
`-----------------------------

or

,-------------------------
| M-: (org-mark-element) RET
`-------------------------

moves point to the beginning of source-block (body) and returns the
position of point without (visibly) marking the source-block body.
There is no region activated, 'M-w' puts nothing in the kill-ring. 

-- 
cheers,
Thorsten





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

* Re: Calling 'org-babel-mark-block' with 'M-x cmd' and 'M-: (cmd)'
  2013-02-15 13:55 Thorsten Jolitz
@ 2013-02-15 15:21 ` Xue Fuqiao
  2013-02-15 16:53   ` Thorsten Jolitz
  0 siblings, 1 reply; 9+ messages in thread
From: Xue Fuqiao @ 2013-02-15 15:21 UTC (permalink / raw)
  To: Thorsten Jolitz; +Cc: emacs-devel

On Fri, 15 Feb 2013 14:55:01 +0100
Thorsten Jolitz <tjolitz@gmail.com> wrote:

> this was posted and discussed on the Org-mode mailing list, but without
> any real conclusion if it is a Bug in Emacs - or something else. So it
> was suggested to repost it here. 
> Say point is behind the closing parenthesis of the sexp in this Org-mode source
> block:
> ,-------------------------------------
> | #+begin_src emacs-lisp
> | (+ 3 4)          # point behind sexp
> | #+end_src
> `-------------------------------------
> Now, when I call
> ,-----------------------------
> | M-x org-babel-mark-block RET
> `-----------------------------
> or
> ,-------------------------
> | M-x org-mark-element RET
> `-------------------------
> the body of the source block (or the whole source-block) is (visibly)
> marked as expected (transient-mark-mode is on), and 'M-w' puts the
> active region into the kill-ring. 
> But with the point at the same position, doing
> ,-----------------------------
> | M-: (org-babel-mark-block) RET
> `-----------------------------
> or
> ,-------------------------
> | M-: (org-mark-element) RET
> `-------------------------
> moves point to the beginning of source-block (body) and returns the
> position of point without (visibly) marking the source-block body.
> There is no region activated, 'M-w' puts nothing in the kill-ring. 

You probably should not use this function in Lisp programs;
it is usually a mistake for a Lisp function to use any subroutine
that uses or sets the mark.


> cheers,
> Thorsten

-- 
Best regards, Xue Fuqiao.
http://www.emacswiki.org/emacs/XueFuqiao



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

* Re: Calling 'org-babel-mark-block' with 'M-x cmd' and 'M-: (cmd)'
  2013-02-15 15:21 ` Xue Fuqiao
@ 2013-02-15 16:53   ` Thorsten Jolitz
  0 siblings, 0 replies; 9+ messages in thread
From: Thorsten Jolitz @ 2013-02-15 16:53 UTC (permalink / raw)
  To: emacs-devel

Xue Fuqiao <xfq.free@gmail.com> writes:

>> ,-----------------------------
>> | M-: (org-babel-mark-block) RET
>> `-----------------------------
>> or
>> ,-------------------------
>> | M-: (org-mark-element) RET
>> `-------------------------

> You probably should not use this function in Lisp programs;
> it is usually a mistake for a Lisp function to use any subroutine
> that uses or sets the mark.

OK, I see, thanks. 

-- 
cheers,
Thorsten




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

end of thread, other threads:[~2013-02-15 16:53 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-02-03 19:10 Calling 'org-babel-mark-block' with 'M-x cmd' and 'M-: (cmd)' Thorsten Jolitz
2013-02-03 19:43 ` Nick Dokos
2013-02-03 20:01   ` Thorsten Jolitz
2013-02-11 14:43     ` Bastien
2013-02-12 16:55       ` Thorsten Jolitz
2013-02-12 21:32         ` Bastien
  -- strict thread matches above, loose matches on Subject: below --
2013-02-15 13:55 Thorsten Jolitz
2013-02-15 15:21 ` Xue Fuqiao
2013-02-15 16:53   ` Thorsten Jolitz

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.