From: Thierry Banel <tbanelwebmin@free.fr>
To: emacs-orgmode@gnu.org
Subject: Re: [PATCH] remap orgtbl-ascii-plot to C-c #
Date: Sat, 06 Sep 2014 16:35:17 +0200 [thread overview]
Message-ID: <540B1BA5.2070800@free.fr> (raw)
In-Reply-To: <877g1kd0oa.fsf@nicolasgoaziou.fr>
[-- Attachment #1: Type: text/plain, Size: 860 bytes --]
Le 03/09/2014 20:22, Nicolas Goaziou a écrit :
>
> It looks good but I realized (a bit late) we cannot use "C-c p" as it is
> reserved to users, as any "C-c LETTER" combination.
>
>
Here is a patch to change the key-binding of `orgtbl-ascii-plot'
from C-c p to C-c #
(The little grid symbol # seems appropriate for a plot).
(But of course another key combination is still possible).
C-c # is already mapped to `org-update-statistics-cookies'.
It makes sense only on a header with a cookie like this:
* Header [12/45]
Therefore I made this key-binding context-sensitive.
The current behavior remains unchanged.
(Many other Org key bindings are context-sensitive:
C-c C-x L `org-shiftmetaleft'
C-c down `org-shiftdown'
C-c C-x M-w `org-copy-special'
C-c * `org-ctrl-c-star'
and so on).
Have fun
Thierry
[-- Attachment #2: 0001-orgtbl-ascii-plot-remapped-from-C-c-p-to-C-c.patch --]
[-- Type: text/x-diff, Size: 3727 bytes --]
From 3b333fa06f706a06485a5795005b3d571cd1526b Mon Sep 17 00:00:00 2001
From: Thierry Banel <tbanelwebmin@free.fr>
Date: Sat, 6 Sep 2014 15:59:18 +0200
Subject: [PATCH] orgtbl-ascii-plot remapped from C-c p to C-c #
* org-table.el (orgtbl-setup): change key-binding
from C-c p to C-c #
* org.el (orgtbl-ascii-plot): declare `orgtbl-ascii-plot'
(org-update-statistics-cookies-or-plot): a new dispatcher
function
(org-mode-map): remap C-c # from `org-update-statistics-cookies'
to `org-update-statistics-cookies-or-plot',
remove old C-c p key-binding
---
lisp/org-table.el | 2 +-
lisp/org.el | 14 ++++++++++++--
2 files changed, 13 insertions(+), 3 deletions(-)
diff --git a/lisp/org-table.el b/lisp/org-table.el
index 547f933..4695745 100644
--- a/lisp/org-table.el
+++ b/lisp/org-table.el
@@ -4327,7 +4327,7 @@ to execute outside of tables."
["Move Column Right" org-metaright :active (org-at-table-p) :keys "M-<right>"]
["Delete Column" org-shiftmetaleft :active (org-at-table-p) :keys "M-S-<left>"]
["Insert Column" org-shiftmetaright :active (org-at-table-p) :keys "M-S-<right>"]
- ["Ascii plot" orgtbl-ascii-plot :active (org-at-table-p) :keys "C-c p"])
+ ["Ascii plot" orgtbl-ascii-plot :active (org-at-table-p) :keys "C-c #"])
("Row"
["Move Row Up" org-metaup :active (org-at-table-p) :keys "M-<up>"]
["Move Row Down" org-metadown :active (org-at-table-p) :keys "M-<down>"]
diff --git a/lisp/org.el b/lisp/org.el
index 649808c..e6a13ef 100755
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -163,6 +163,7 @@ Stars are put in group 1 and the trimmed body in group 2.")
(declare-function org-table-paste-rectangle "org-table" ())
(declare-function org-table-maybe-eval-formula "org-table" ())
(declare-function org-table-maybe-recalculate-line "org-table" ())
+(declare-function orgtbl-ascii-plot "org-table" (&optional ask))
(declare-function org-element-at-point "org-element" ())
(declare-function org-element-cache-reset "org-element" (&optional all))
@@ -12842,6 +12843,16 @@ This should be called with the cursor in a line with a statistics cookie."
(goto-char pos)
(move-marker pos nil)))))
+(defun org-update-statistics-cookies-or-plot (arg)
+ "Update statistic cookie or plot.
+Calls `orgtbl-ascii-plot' or `org-update-statistics-cookies',
+depending on context.
+See the individual commands for more information."
+ (interactive "P")
+ (if (org-at-table-p)
+ (orgtbl-ascii-plot arg)
+ (org-update-statistics-cookies arg)))
+
(defvar org-entry-property-inherited-from) ;; defined below
(defun org-update-parent-todo-statistics ()
"Update any statistics cookie in the parent of the current headline.
@@ -19464,7 +19475,7 @@ boundaries."
(org-defkey org-mode-map "\C-c^" 'org-sort)
(org-defkey org-mode-map "\C-c\C-c" 'org-ctrl-c-ctrl-c)
(org-defkey org-mode-map "\C-c\C-k" 'org-kill-note-or-show-branches)
-(org-defkey org-mode-map "\C-c#" 'org-update-statistics-cookies)
+(org-defkey org-mode-map "\C-c#" 'org-update-statistics-cookies-or-plot)
(org-defkey org-mode-map [remap open-line] 'org-open-line)
(org-defkey org-mode-map [remap comment-dwim] 'org-comment-dwim)
(org-defkey org-mode-map [remap forward-paragraph] 'org-forward-paragraph)
@@ -19477,7 +19488,6 @@ boundaries."
(org-defkey org-mode-map "\C-c=" 'org-table-eval-formula)
(org-defkey org-mode-map "\C-c'" 'org-edit-special)
(org-defkey org-mode-map "\C-c`" 'org-table-edit-field)
-(org-defkey org-mode-map "\C-cp" 'orgtbl-ascii-plot)
(org-defkey org-mode-map "\C-c|" 'org-table-create-or-convert-from-region)
(org-defkey org-mode-map [(control ?#)] 'org-table-rotate-recalc-marks)
(org-defkey org-mode-map "\C-c~" 'org-table-create-with-table.el)
--
1.9.1
next prev parent reply other threads:[~2014-09-06 14:35 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-13 16:02 make orgtbl-ascii-plot easier to install Thierry Banel
2014-07-28 14:40 ` Bastien
2014-08-10 22:22 ` Thierry Banel
2014-08-26 8:29 ` Nicolas Goaziou
2014-08-26 19:52 ` Thierry Banel
2014-08-26 20:27 ` Nicolas Goaziou
2014-08-26 21:42 ` Thierry Banel
2014-08-26 22:09 ` Nicolas Goaziou
2014-08-26 22:21 ` Thierry Banel
2014-08-27 21:35 ` Thierry Banel
2014-08-27 23:28 ` Nicolas Goaziou
2014-08-28 20:46 ` Thierry Banel
2014-08-29 9:54 ` Nicolas Goaziou
2014-08-29 17:20 ` Thierry Banel
2014-09-02 21:53 ` [PATCH] " Thierry Banel
2014-09-03 18:22 ` Nicolas Goaziou
2014-09-03 20:10 ` A key-binding for plotting Thierry Banel
2014-09-06 14:35 ` Thierry Banel [this message]
2014-09-08 16:30 ` [PATCH] remap orgtbl-ascii-plot to C-c # Nicolas Goaziou
2014-09-13 17:06 ` key-binding for all plotting styles Thierry Banel
2014-10-07 14:15 ` Nicolas Goaziou
2014-10-07 21:40 ` Thierry Banel
2014-10-11 17:46 ` [PATCH] " Thierry Banel
2014-10-12 9:28 ` Nicolas Goaziou
2014-10-12 10:00 ` Thierry Banel
2014-10-12 14:05 ` Thierry Banel
2014-10-13 16:24 ` Nicolas Goaziou
2014-10-13 21:16 ` Thierry Banel
2014-10-14 20:48 ` Thierry Banel
2014-10-14 21:08 ` Nicolas Goaziou
2014-10-14 21:26 ` Thierry Banel
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=540B1BA5.2070800@free.fr \
--to=tbanelwebmin@free.fr \
--cc=emacs-orgmode@gnu.org \
/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).