From mboxrd@z Thu Jan 1 00:00:00 1970 From: Thierry Banel Subject: Re: [PATCH] remap orgtbl-ascii-plot to C-c # Date: Sat, 06 Sep 2014 16:35:17 +0200 Message-ID: <540B1BA5.2070800@free.fr> References: <53C2ADB0.2010404@free.fr> <87oaw9wg3s.fsf@bzg.ath.cx> <53E7F088.8010401@free.fr> <87tx4zhcvs.fsf@nicolasgoaziou.fr> <53FCE574.3010307@free.fr> <87vbpfnghj.fsf@nicolasgoaziou.fr> <53FCFF47.4060805@free.fr> <87r402oqce.fsf@nicolasgoaziou.fr> <53FE4F09.5080408@free.fr> <871ts1h5qv.fsf@nicolasgoaziou.fr> <53FF951B.4030300@free.fr> <87lhq7wrhg.fsf@nicolasgoaziou.fr> <54063C4F.30704@free.fr> <877g1kd0oa.fsf@nicolasgoaziou.fr> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------040106010000040207040508" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:33293) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XQH5K-000054-Al for emacs-orgmode@gnu.org; Sat, 06 Sep 2014 10:35:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XQH5D-0006Ca-Nd for emacs-orgmode@gnu.org; Sat, 06 Sep 2014 10:35:26 -0400 Received: from smtp1-g21.free.fr ([212.27.42.1]:21001) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XQH5D-0006CQ-F5 for emacs-orgmode@gnu.org; Sat, 06 Sep 2014 10:35:19 -0400 Received: from [IPv6:2a01:e35:2e21:def0:9c4c:268a:6ffb:52bf] (unknown [IPv6:2a01:e35:2e21:def0:9c4c:268a:6ffb:52bf]) by smtp1-g21.free.fr (Postfix) with ESMTP id 2C925940078 for ; Sat, 6 Sep 2014 16:35:17 +0200 (CEST) In-Reply-To: <877g1kd0oa.fsf@nicolasgoaziou.fr> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org This is a multi-part message in MIME format. --------------040106010000040207040508 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable Le 03/09/2014 20:22, Nicolas Goaziou a =E9crit : > > It looks good but I realized (a bit late) we cannot use "C-c p" as it i= s > 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 --------------040106010000040207040508 Content-Type: text/x-diff; name="0001-orgtbl-ascii-plot-remapped-from-C-c-p-to-C-c.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename*0="0001-orgtbl-ascii-plot-remapped-from-C-c-p-to-C-c.patch" >From 3b333fa06f706a06485a5795005b3d571cd1526b Mon Sep 17 00:00:00 2001 From: Thierry Banel 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-"] ["Delete Column" org-shiftmetaleft :active (org-at-table-p) :keys "M-S-"] ["Insert Column" org-shiftmetaright :active (org-at-table-p) :keys "M-S-"] - ["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-"] ["Move Row Down" org-metadown :active (org-at-table-p) :keys "M-"] 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 --------------040106010000040207040508--