emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [PATCH] Change C-' behaviour on #+TBLFM: line
@ 2010-11-19  8:49 Torsten Wagner
  2010-11-20 11:34 ` Carsten Dominik
  2010-11-20 20:18 ` Michael Brand
  0 siblings, 2 replies; 3+ messages in thread
From: Torsten Wagner @ 2010-11-19  8:49 UTC (permalink / raw)
  To: emacs-orgmode

Hi,

Short description:

I recently started to use tables in org-mode. Having the pointer inside
the the table and pressing C-c' I can enter the formula buffer.
However, placing the pointer on the #+TBLFM: line C-c' results in "Find
file or URL:".

If even more people believe this is confusing, I would suggest to switch
the behaviour. C-c' on a #+TBLFM: line should open up the formular buffer.

Longer Explanation:

For small changes of the formula I often edit the #+TBLFM: line
directly. If things went more complex or get messed, I press C-c' to
enter the formula buffer. However, at this time my pointer is located at
the #+TBLFM: line.

The associated call function for C-c' is:

org-edit-special

This function calls

org-table-edit-formulas

in case the point is located inside the table and

ffap aka find-file-at-point

in all other cases (omitting the cases for source code and include lines
here for simplicity)

Thus pressing C-c' at #+TBLFM ends up with the request for a file or a URL.

In my opinion org-edit-special needs another case to look out for
#+TBLFM or resp. combine this with the case to call
`org-table-edit-formulas'.

Please find below a patch for that.

-------patch--------begin--------

diff --git a/lisp/org.el b/lisp/org.el
index 023e019..a7e4d33 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -17259,7 +17259,9 @@ When in an #+include line, visit the include
file.  Otherwise call
    ((org-edit-fixed-width-region))
    ((org-at-table.el-p)
     (org-edit-src-code))
-   ((org-at-table-p)
+   ((or (org-at-table-p) (save-excursion
+      (beginning-of-line 1)
+      (looking-at "[ \t]*#\\+TBLFM")))
     (call-interactively 'org-table-edit-formulas))
    (t (call-interactively 'ffap))))

-------patch--------end---------

This is my very first public org-mode patch and my very first hack in
vital org-mode elisp code. Thus, don't laugh or blame to much.... :)

Best regards
Torsten

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

* Re: [PATCH] Change C-' behaviour on #+TBLFM: line
  2010-11-19  8:49 [PATCH] Change C-' behaviour on #+TBLFM: line Torsten Wagner
@ 2010-11-20 11:34 ` Carsten Dominik
  2010-11-20 20:18 ` Michael Brand
  1 sibling, 0 replies; 3+ messages in thread
From: Carsten Dominik @ 2010-11-20 11:34 UTC (permalink / raw)
  To: Torsten Wagner; +Cc: emacs-orgmode

Hi Torsten,

applied with minor changes.  Thanks!

- Carsten

On Nov 19, 2010, at 9:49 AM, Torsten Wagner wrote:

> Hi,
>
> Short description:
>
> I recently started to use tables in org-mode. Having the pointer  
> inside
> the the table and pressing C-c' I can enter the formula buffer.
> However, placing the pointer on the #+TBLFM: line C-c' results in  
> "Find
> file or URL:".
>
> If even more people believe this is confusing, I would suggest to  
> switch
> the behaviour. C-c' on a #+TBLFM: line should open up the formular  
> buffer.
>
> Longer Explanation:
>
> For small changes of the formula I often edit the #+TBLFM: line
> directly. If things went more complex or get messed, I press C-c' to
> enter the formula buffer. However, at this time my pointer is  
> located at
> the #+TBLFM: line.
>
> The associated call function for C-c' is:
>
> org-edit-special
>
> This function calls
>
> org-table-edit-formulas
>
> in case the point is located inside the table and
>
> ffap aka find-file-at-point
>
> in all other cases (omitting the cases for source code and include  
> lines
> here for simplicity)
>
> Thus pressing C-c' at #+TBLFM ends up with the request for a file or  
> a URL.
>
> In my opinion org-edit-special needs another case to look out for
> #+TBLFM or resp. combine this with the case to call
> `org-table-edit-formulas'.
>
> Please find below a patch for that.
>
> -------patch--------begin--------
>
> diff --git a/lisp/org.el b/lisp/org.el
> index 023e019..a7e4d33 100644
> --- a/lisp/org.el
> +++ b/lisp/org.el
> @@ -17259,7 +17259,9 @@ When in an #+include line, visit the include
> file.  Otherwise call
>    ((org-edit-fixed-width-region))
>    ((org-at-table.el-p)
>     (org-edit-src-code))
> -   ((org-at-table-p)
> +   ((or (org-at-table-p) (save-excursion
> +      (beginning-of-line 1)
> +      (looking-at "[ \t]*#\\+TBLFM")))
>     (call-interactively 'org-table-edit-formulas))
>    (t (call-interactively 'ffap))))
>
> -------patch--------end---------
>
> This is my very first public org-mode patch and my very first hack in
> vital org-mode elisp code. Thus, don't laugh or blame to much.... :)
>
> Best regards
> Torsten
>
> _______________________________________________
> Emacs-orgmode mailing list
> Please use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode

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

* Re: [PATCH] Change C-' behaviour on #+TBLFM: line
  2010-11-19  8:49 [PATCH] Change C-' behaviour on #+TBLFM: line Torsten Wagner
  2010-11-20 11:34 ` Carsten Dominik
@ 2010-11-20 20:18 ` Michael Brand
  1 sibling, 0 replies; 3+ messages in thread
From: Michael Brand @ 2010-11-20 20:18 UTC (permalink / raw)
  To: Torsten Wagner; +Cc: emacs-orgmode

Hi Torsten

On Fri, Nov 19, 2010 at 09:49, Torsten Wagner <torsten.wagner@gmail.com> wrote:
> If even more people believe this is confusing, I would suggest to switch
> the behaviour. C-c' on a #+TBLFM: line should open up the formular buffer.

Yes, thank you for this change, just a few days ago I also stumbled
exactly upon this detail.

Michael

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

end of thread, other threads:[~2010-11-20 20:18 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-11-19  8:49 [PATCH] Change C-' behaviour on #+TBLFM: line Torsten Wagner
2010-11-20 11:34 ` Carsten Dominik
2010-11-20 20:18 ` Michael Brand

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