Browse Source

Display quotes in key-bindings as straight quotes

* lisp/org-agenda.el (org-agenda-show-the-flagging-note):
* lisp/org-footnote.el (org-footnote-goto-definition):
* lisp/org-table.el (org-table-edit-formulas): Fix straight quotes
  rendered as curvy quotes in echoes messages (in emacs 25.1).
* lisp/org-table.el (org-table-align): Fix straight quotes rendered as
  curvy quotes in help echo (in emacs 25.1).

* lisp/org-protocol.el (org-protocol-create-for-org):
* lisp/org-table.el (org-table-sum): Minor reformatting.

The below thread discusses why these changes were needed especially when
using emacs 25.1 or newer emacsen (that added support for rendering
back-quotes and straight quotes as left/right curvy quotes by default):
http://thread.gmane.org/gmane.emacs.orgmode/105594

Fix the quote style displayed when key-bindings are shown in
the echo via (message .. (substitute-command-keys ..)).

So below will render that single quote as curly.

(message "C-c '")

The fix (Reference:
https://lists.gnu.org/archive/html/bug-gnu-emacs/2015-10/msg00234.html)
is to print that quote verbatim using the "%s" modifier:

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

Also an help-echo text property value was fixed in `org-table-align'.
`substitute-command-keys' should not be used in that.  Instead \\[COMMAND]
should be used directly in the string.
Kaushal Modi 4 years ago
parent
commit
ebacca39b4
4 changed files with 14 additions and 17 deletions
  1. 3 2
      lisp/org-agenda.el
  2. 3 4
      lisp/org-footnote.el
  3. 1 1
      lisp/org-protocol.el
  4. 7 10
      lisp/org-table.el

+ 3 - 2
lisp/org-agenda.el

@@ -10083,8 +10083,9 @@ tag and (if present) the flagging note."
 	(replace-match "\n" t t))
       (goto-char (point-min))
       (select-window win)
-      (message (substitute-command-keys "Flagging note pushed to kill ring.  \
-Press \\[org-agenda-show-the-flagging-note] again to remove tag and note")))))
+      (message "%s" (substitute-command-keys "Flagging note pushed to \
+kill ring.  Press \\[org-agenda-show-the-flagging-note] again to remove \
+tag and note")))))
 
 (defun org-agenda-remove-flag (marker)
   "Remove the FLAGGED tag and any flagging note in the entry."

+ 3 - 4
lisp/org-footnote.el

@@ -391,10 +391,9 @@ value if point was successfully moved."
     (goto-char (match-end 0))
     (org-show-context 'link-search)
     (when (derived-mode-p 'org-mode)
-      (message
-       (substitute-command-keys
-	"Edit definition and go back with `\\[org-mark-ring-goto]' or, if \
-unique, with `\\[org-ctrl-c-ctrl-c]'.")))
+      (message "%s" (substitute-command-keys
+		     "Edit definition and go back with \
+`\\[org-mark-ring-goto]' or, if unique, with `\\[org-ctrl-c-ctrl-c]'.")))
     t))
 
 (defun org-footnote-goto-previous-reference (label)

+ 1 - 1
lisp/org-protocol.el

@@ -580,7 +580,7 @@ delegates most of the work to `org-protocol-create'."
   (require 'org-publish)
   (let ((all (or (org-publish-get-project-from-filename buffer-file-name))))
     (if all (org-protocol-create (cdr all))
-      (message "Not in an org-project.  Did mean %s?"
+      (message "Not in an org-project.  Did you mean `%s'?"
                (substitute-command-keys"\\[org-protocol-create]")))))
 
 (defun org-protocol-create (&optional project-plist)

+ 7 - 10
lisp/org-table.el

@@ -795,9 +795,8 @@ When nil, simply write \"#ERROR\" in corrupted fields.")
                    (org-add-props x nil
                      'help-echo
                      (concat
-                      (substitute-command-keys
-                       "Clipped table field, use \\[org-table-edit-field] to \
-edit.  Full value is:\n")
+		      "Clipped table field, use `\\[org-table-edit-field]' to \
+edit.  Full value is:\n"
                       (substring-no-properties x)))
                    (let ((l (length x))
                          (f1 (min fmax
@@ -2136,11 +2135,10 @@ If NLAST is a number, only the NLAST fields will actually be summed."
 			   s diff)
 		     (format "%.0f:%02.0f:%02.0f" h m s))))
 	(kill-new sres)
-	(if (org-called-interactively-p 'interactive)
-	    (message "%s"
-		     (substitute-command-keys
-		      (format "Sum of %d items: %-20s     (\\[yank] will insert result into buffer)"
-			      (length numbers) sres))))
+	(when (org-called-interactively-p 'interactive)
+	    (message "%s" (substitute-command-keys
+			   (format "Sum of %d items: %-20s     \
+\(\\[yank] will insert result into buffer)" (length numbers) sres))))
 	sres))))
 
 (defun org-table-get-number-for-summing (s)
@@ -3597,8 +3595,7 @@ Parameters get priority."
       (when (eq org-table-use-standard-references t)
 	(org-table-fedit-toggle-ref-type))
       (org-goto-line startline)
-      (message
-       (substitute-command-keys "\\<org-mode-map>\
+      (message "%s" (substitute-command-keys "\\<org-mode-map>\
 Edit formulas, finish with `\\[org-ctrl-c-ctrl-c]' or `\\[org-edit-special]'.  \
 See menu for more commands.")))))