From e58ba090575203746b2b36b1a0e2ac0b1435441f Mon Sep 17 00:00:00 2001 From: Kyle Meyer Date: Sat, 12 Dec 2015 01:00:35 -0500 Subject: occur: Don't insert nil values in regexp-history --- lisp/init-editing.el | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'lisp') diff --git a/lisp/init-editing.el b/lisp/init-editing.el index 19c20db..2dac01d 100644 --- a/lisp/init-editing.el +++ b/lisp/init-editing.el @@ -144,12 +144,11 @@ touches." (defun km/occur () "Call `occur' with active region or symbol at point." (interactive) - (push (if (use-region-p) - (buffer-substring-no-properties - (region-beginning) - (region-end)) - (thing-at-point 'symbol)) - regexp-history) + (--when-let (if (use-region-p) + (buffer-substring-no-properties + (region-beginning) (region-end)) + (thing-at-point 'symbol)) + (push it regexp-history)) (call-interactively 'occur)) (global-set-key (kbd "C-x \\") 'align-regexp) -- cgit v1.2.3