From 2f6e5e5ba6278644ee847fbdd83cccf77d2cbd24 Mon Sep 17 00:00:00 2001 From: Sebastian Miele Date: Sat, 12 Jan 2019 07:40:19 +0100 Subject: [PATCH 1/3] [Fix #955] Fix call to help-setup-xref in sp-cheat-sheet Additionally, un-invert the meaning of arg in the body of the function. --- smartparens.el | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/smartparens.el b/smartparens.el index ab9c9349..1abb222b 100644 --- a/smartparens.el +++ b/smartparens.el @@ -110,7 +110,6 @@ the previous/next entry. Examples are fontified using the `font-lock-string-face' for better orientation." (interactive "P") - (setq arg (not arg)) (let ((do-not-display '( smartparens-mode smartparens-global-mode @@ -124,10 +123,10 @@ better orientation." turn-on-show-smartparens-mode turn-off-show-smartparens-mode )) - (do-not-display-with-arg '( - sp-use-paredit-bindings - sp-use-smartparens-bindings - )) + (do-not-display-without-arg '( + sp-use-paredit-bindings + sp-use-smartparens-bindings + )) (commands (cl-loop for i in (cdr (assoc-string (file-truename (locate-library "smartparens")) load-history)) if (and (consp i) (eq (car i) 'defun) (commandp (cdr i))) collect (cdr i)))) @@ -138,11 +137,11 @@ better orientation." (erase-buffer) (help-mode) (smartparens-mode 1) - (help-setup-xref (list #'sp-cheat-sheet) + (help-setup-xref (cons #'sp-cheat-sheet (list arg)) (called-interactively-p 'interactive)) (read-only-mode -1) (--each (--remove (or (memq it do-not-display) - (and arg (memq it do-not-display-with-arg))) + (and (not arg) (memq it do-not-display-without-arg))) commands) (unless (equal (symbol-name it) "advice-compilation") (let ((start (point)) kill-from) @@ -150,7 +149,7 @@ better orientation." (insert " is ") (describe-function-1 it) (save-excursion - (when arg + (unless arg (goto-char start) (forward-paragraph 1) (forward-line 1) From d40940087b58aac8a7d121d0c5e8309d1e5caeff Mon Sep 17 00:00:00 2001 From: Sebastian Miele Date: Sat, 12 Jan 2019 08:00:30 +0100 Subject: [PATCH 2/3] Use -difference instead of --remove and memq in sp-cheat-sheet --- smartparens.el | 45 ++++++++++++++++++++++++--------------------- 1 file changed, 24 insertions(+), 21 deletions(-) diff --git a/smartparens.el b/smartparens.el index 1abb222b..5d5174a9 100644 --- a/smartparens.el +++ b/smartparens.el @@ -110,26 +110,31 @@ the previous/next entry. Examples are fontified using the `font-lock-string-face' for better orientation." (interactive "P") - (let ((do-not-display '( - smartparens-mode - smartparens-global-mode - turn-on-smartparens-mode - turn-off-smartparens-mode - sp-wrap-cancel - sp-remove-active-pair-overlay - sp-splice-sexp-killing-around ;; is aliased to `sp-raise-sexp' - show-smartparens-mode - show-smartparens-global-mode - turn-on-show-smartparens-mode - turn-off-show-smartparens-mode - )) - (do-not-display-without-arg '( - sp-use-paredit-bindings - sp-use-smartparens-bindings - )) - (commands (cl-loop for i in (cdr (assoc-string (file-truename (locate-library "smartparens")) load-history)) + (let ((commands (cl-loop for i in (cdr (assoc-string (file-truename (locate-library "smartparens")) load-history)) if (and (consp i) (eq (car i) 'defun) (commandp (cdr i))) collect (cdr i)))) + (setq commands + (-difference commands + '( + smartparens-mode + smartparens-global-mode + turn-on-smartparens-mode + turn-off-smartparens-mode + sp-wrap-cancel + sp-remove-active-pair-overlay + sp-splice-sexp-killing-around ;; is aliased to `sp-raise-sexp' + show-smartparens-mode + show-smartparens-global-mode + turn-on-show-smartparens-mode + turn-off-show-smartparens-mode + ))) + (unless arg + (setq commands + (-difference commands + '( + sp-use-paredit-bindings + sp-use-smartparens-bindings + )))) (with-current-buffer (get-buffer-create "*Smartparens cheat sheet*") (let ((standard-output (current-buffer)) (help-xref-following t)) @@ -140,9 +145,7 @@ better orientation." (help-setup-xref (cons #'sp-cheat-sheet (list arg)) (called-interactively-p 'interactive)) (read-only-mode -1) - (--each (--remove (or (memq it do-not-display) - (and (not arg) (memq it do-not-display-without-arg))) - commands) + (--each commands (unless (equal (symbol-name it) "advice-compilation") (let ((start (point)) kill-from) (insert (propertize (symbol-name it) 'face 'font-lock-function-name-face)) From 7ff3f82e07ffb326de5c84ddfed3ba051a7728d4 Mon Sep 17 00:00:00 2001 From: Sebastian Miele Date: Sun, 13 Jan 2019 03:52:18 +0100 Subject: [PATCH 3/3] Simplify call to help-setup-xref in sp-cheat-sheet --- smartparens.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/smartparens.el b/smartparens.el index 5d5174a9..16674404 100644 --- a/smartparens.el +++ b/smartparens.el @@ -142,7 +142,7 @@ better orientation." (erase-buffer) (help-mode) (smartparens-mode 1) - (help-setup-xref (cons #'sp-cheat-sheet (list arg)) + (help-setup-xref (list #'sp-cheat-sheet arg) (called-interactively-p 'interactive)) (read-only-mode -1) (--each commands