helpful

a fork of Wilfred's helpful
git clone https://git.trogloxene.org/helpful.git
Log | Files | Refs | README

commit 9f1d08c3d4292f778b14838da35701714ea0e231
parent d155add4af76df4b342250dec7ced57f58400465
Author: Wilfred Hughes <me@wilfred.me.uk>
Date:   Fri, 15 Mar 2019 09:54:45 +0000

Don't interpret command references inside doublequoted strings

Helps with #197

Diffstat:
Mhelpful.el | 10++++++++++
Mtest/helpful-unit-test.el | 10++++++++++
2 files changed, 20 insertions(+), 0 deletions(-)

diff --git a/helpful.el b/helpful.el @@ -964,6 +964,16 @@ unescaping too." (while (not (eobp)) (cond ((looking-at + (rx "\"")) + (looking-at + ;; Text of the form "foo" + (rx "\"")) + ;; Don't do anything with literal strings. + ;; Step over opening doublequote. + (forward-char 1) + ;; Move past closing doublequote. + (search-forward "\"")) + ((looking-at ;; Text of the form \=X (rx "\\=")) ;; Remove the escaping, then step over the escaped char. diff --git a/test/helpful-unit-test.el b/test/helpful-unit-test.el @@ -65,6 +65,16 @@ (should (not (s-contains-p "\\=" formatted-docstring))))) +(ert-deftest helpful--docstring-strings () + "Double-quoted strings should be treated literally." + (let* ((formatted-docstring + (helpful--format-docstring + "hello \"\\[foo]\" world"))) + ;; This test will fail in a local Emacs instance that has modified + ;; minibuffer keybindings. + (should + (string-equal formatted-docstring "hello \"\\[foo]\" world")))) + (ert-deftest helpful--docstring-keymap () "Handle keymap references in docstrings." (let* ((formatted-docstring