From mboxrd@z Thu Jan 1 00:00:00 1970 From: Kaushal Modi Subject: Re: [PATCH] Fix the single quote printed in the message printed by org-table-edit-formulas Date: Thu, 10 Mar 2016 10:33:34 -0500 Message-ID: References: <87twkelm5u.fsf@nicolasgoaziou.fr> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=001a11c1bb24f436b0052db38b1f Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:36824) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ae2bT-0002Ja-GX for emacs-orgmode@gnu.org; Thu, 10 Mar 2016 10:34:24 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ae2bO-0005Ow-Ny for emacs-orgmode@gnu.org; Thu, 10 Mar 2016 10:34:19 -0500 Received: from mail-ob0-x232.google.com ([2607:f8b0:4003:c01::232]:34772) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ae2bO-0005OJ-H6 for emacs-orgmode@gnu.org; Thu, 10 Mar 2016 10:34:14 -0500 Received: by mail-ob0-x232.google.com with SMTP id ts10so84295726obc.1 for ; Thu, 10 Mar 2016 07:34:14 -0800 (PST) In-Reply-To: <87twkelm5u.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: Kaushal Modi , emacs-org list , Paul Eggert --001a11c1bb24f436b0052db38b1f Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable > > Shouldn't this be handled by `substitute-command-keys' already? The fix > looks like a hack. I don't think this has anything to do with substitute-command-keys. That function simply returns a string. So the below 2 forms display the exact same thing: "C-c =E2=80=99" (note th= e curved right quote) by default in emacs 25.0.92: (with-temp-buffer (org-mode) (message (substitute-command-keys "\\[org-edit-special]"))) (message "C-c '") So the way to get the straight quotes printed as they are without getting converted to curved quotes is by using (message "%s" STRING) Reference: https://lists.gnu.org/archive/html/bug-gnu-emacs/2015-10/msg00234.html @Paul: Please correct me if that's wrong. Now both of the below forms echo "C-c '" (with straight quote): (with-temp-buffer (org-mode) (message "%s" (substitute-command-keys "\\[org-edit-special]"))) (message "%s" "C-c '") Shouldn't ` and ' also be dropped around \\[command]? It looks like this convention is used at many other places in org (and many mores places in emacs elisp source): org-gnus.el:287: "Like `\\[gnus]' but doesn't check for new news." org-id.el:105: a link to it, using `\\[org-insert-link]' first. org-footnote.el:536: "Edit definition and go back with `\\[org-mark-ring-goto]' or, if \ org-footnote.el:537:unique, with `\\[org-ctrl-c-ctrl-c]'."))) org-footnote.el:903: "\\`\\[fn:\\(.*?\\)\\]" new stored nil nil 1))) org-lint.el:450: (and h (org-string-match-p "\\`\\[.*\\]\\'" h))) org-colview.el:524: (if (string-match "\\`\\[[ xX-]\\]\\'" org-src.el:737: (progn (string-match (if inline "\\`\\[fn:.*?:" "\\`.*?\\]") c) ox-beamer.el:210: ((string-match "\\`\\[<.*>\\]\\'" argument) argument) ox-beamer.el:213: ((string-match "\\`\\[\\(.*\\)\\]\\'" argument) ox-beamer.el:216: (option (if (string-match "\\`\\[.*\\]\\'" argument) argument ox-beamer.el:426: ((string-match "\\`\\[.*\\]\\'" action ) ox-beamer.el:567: ((string-match "\\`\\[.*\\]\\'" action) ox-beamer.el:613: (if (string-match "\\`\\[.*\\]\\'" overlay) 'defaction org-clock.el:104:`\\[org-clock-out]', or until the clock is started in a different item. ox-latex.el:2274: (if (not (string-match "\\`\\[\\(.*\\)\\]\\'" opt)) op= t org-table.el:3596:Edit formulas, finish with `\\[org-ctrl-c-ctrl-c]' or `\\[org-edit-special]'. \ org-agenda.el:1302:`\\[universal-argument] \\[org-agenda-log-mode]' in org-agenda.el:1989:\\`\\[org-agenda-filter-by-tag] RET'. org-agenda.el:4697:Press `\\[org-agenda-manipulate-query-add]', \ org-agenda.el:4698:`\\[org-agenda-manipulate-query-subtract]' to add/sub word, \ org-agenda.el:4699:`\\[org-agenda-manipulate-query-add-re]', \ org-agenda.el:4700:`\\[org-agenda-manipulate-query-subtract-re]' to add/sub regexp, \ org-agenda.el:4701:`\\[universal-argument] \\[org-agenda-redo]' to edit\n")= ) org-agenda.el:4897: "Press `\\[universal-argument] \\[org-agenda-redo]' \ org-agenda.el:7320:So this is just a shortcut for \\`\\[org-agenda]', available org.el:868:`\\[org-todo]' and `\\[org-priority]' \ org.el:870:`\\[universal-argument] \\[universal-argument] \\[org-todo]' \ org.el:872:`\\[org-ctrl-c-minus]' to cycle item bullet types, org.el:1670:When nil, `\\[org-ctrl-c-ctrl-c]' needs to be used \ org.el:1673:`\\[org-toggle-latex-fragment]' to be removed." org.el:2431:`\\[universal-argument] \\[universal-argument] \\[universal-argument] \ org.el:2614:with a prefix argument, i.e. `\\[universal-argument] \\[org-todo]' \ org.el:2616:`\\[universal-argument] t' in an agenda buffer. org.el:3093:`\\[org-time-stamp]' or `\\[org-time-stamp-inactive], org.el:3823:commands `org-search-view' (`\\[org-agenda] s') \ As this was a cosmetic thing, I decided to keep that unchanged. Personally I also prefer to not have any quotes around the key-bindings. The patch I submitted merely makes the displayed key-binding less confusing; we have a straight-quote key on the keyboard, not a curved quote key :) --001a11c1bb24f436b0052db38b1f Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Shouldn't this be handled by `substit= ute-command-keys' already? The fix
looks like a hack.

I don't think this has anything to do with substitute-command-k= eys.=C2=A0That function simply returns a string.

So the below 2 forms display the exact same thing: "= ;C-c =E2=80=99" (note the curved right quote) by default in emacs 25.0= .92:

(with-temp-buffer
=C2=A0 (org-mode)
=C2=A0 (message (substitute-c= ommand-keys "\\[org-edit-special]")))

(m= essage "C-c '")

So the way to ge= t the straight quotes printed as they are without getting converted to curv= ed quotes is by using

(message "%s" STRI= NG)

@Paul: Pleas= e correct me if that's wrong.

Now both of the = below forms echo "C-c '" (with straight quote):
(with-temp-buffer
=C2=A0 (org-mode)
= =C2=A0 (message "%s" (substitute-command-keys "\\[org-edit-s= pecial]")))

(message "%s" "C-c= '")


Shouldn't ` and ' also be dropped around \\[command]?

It looks like this convention is used at many other = places in org (and many mores places in emacs elisp source):

=
org-gnus.el:287: =C2=A0"Like `\\[gnus]' but doesn't= check for new news."
org-id.el:105: =C2=A0 =C2=A0 =C2=A0a l= ink to it, using `\\[org-insert-link]' first.
org-footnote.el= :536: "Edit definiti= on and go back with `\\[org-mark-ring-goto]' or, if \
org-foo= tnote.el:537:unique, with `\\[org-ctrl-c-ctrl-c]'.")))
o= rg-footnote.el:903: &q= uot;\\`\\[fn:\\(.*?\\)\\]" new stored nil nil 1)))
org-lint.= el:450: =C2=A0(and h (or= g-string-match-p "\\`\\[.*\\]\\'" h)))
org-colview.= el:524: =C2=A0(if (string-match "\\`\\[[ xX-]\\]\\'"
org-src.el:737: =C2=A0= =C2=A0 =C2=A0 (progn (string-match (if inline "\\`\\[fn:.*?:" &q= uot;\\`.*?\\]") c)
ox-beamer.el:210: =C2=A0((string-match "\\`\\[<.*>\= \]\\'" argument) argument)
ox-beamer.el:213: =C2=A0((string-match "\\`\\[= \\(.*\\)\\]\\'" argument)
ox-beamer.el:216: =C2=A0 =C2= =A0 =C2=A0(option (if (string-match "\\`\\[.*\\]\\'" argument= ) argument
ox-beamer.el:426: =C2=A0 =C2=A0 =C2=A0 ((string-match "\\`\\[.*\\]\\'= " action )
ox-beamer.el:567: =C2=A0 =C2=A0 ((string-match "\\`\\[.*\\]\\'&q= uot; action)
ox-beamer.el:613: (if (string-match "\\`\\[.*\\]\\'" overlay= ) 'defaction
org-clock.el:104:`\\[org-clock-out]', or unt= il the clock is started in a different item.
ox-latex.el:2274: =C2=A0 =C2=A0(if (not (st= ring-match "\\`\\[\\(.*\\)\\]\\'" opt)) opt
org-tab= le.el:3596:Edit formulas, finish with `\\[org-ctrl-c-ctrl-c]' or `\\[or= g-edit-special]'. =C2=A0\
org-agenda.el:1302:`\\[universal-ar= gument] \\[org-agenda-log-mode]' in
org-agenda.el:1989:\\<= org-agenda-mode-map>`\\[org-agenda-filter-by-tag] RET'.
or= g-agenda.el:4697:Press `\\[org-agenda-manipulate-query-add]', \
org-agenda.el:4698:`\\[org-agenda-manipulate-query-subtract]' to add= /sub word, \
org-agenda.el:4699:`\\[org-agenda-manipulate-query-a= dd-re]', \
org-agenda.el:4700:`\\[org-agenda-manipulate-query= -subtract-re]' to add/sub regexp, \
org-agenda.el:4701:`\\[un= iversal-argument] \\[org-agenda-redo]' to edit\n"))
org-= agenda.el:4897: =C2=A0 = "Press `\\[universal-argument] \\[org-agenda-redo]' \
or= g-agenda.el:7320:So this is just a shortcut for \\<global-map>`\\[org= -agenda]', available
org.el:868:`\\[org-todo]' and `\\[or= g-priority]' \
org.el:870:`\\[universal-argument] \\[universa= l-argument] \\[org-todo]' \
org.el:872:`\\[org-ctrl-c-minus]&= #39; to cycle item bullet types,
org.el:1670:When nil, `\\[org-ct= rl-c-ctrl-c]' needs to be used \
org.el:1673:`\\[org-toggle-l= atex-fragment]' to be removed."
org.el:2431:`\\[universa= l-argument] \\[universal-argument] \\[universal-argument] \
org.e= l:2614:with a prefix argument, =C2=A0i.e. `\\[universal-argument] \\[org-to= do]' \
org.el:2616:`\\[universal-argument] t' in an agend= a buffer.
org.el:3093:`\\[org-time-stamp]' or `\\[org-time-st= amp-inactive],
org.el:3823:commands `org-search-view' (`\\[or= g-agenda] s') \

As this was a cosmetic thing, = I decided to keep that unchanged. Personally I also prefer to not have any = quotes around the key-bindings. The patch I submitted merely makes the disp= layed key-binding less confusing; we have a straight-quote key on the keybo= ard, not a curved quote key :)
--001a11c1bb24f436b0052db38b1f--