summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKyle Meyer <kyle@kyleam.com>2015-12-12 01:00:35 -0500
committerKyle Meyer <kyle@kyleam.com>2015-12-12 01:00:35 -0500
commite58ba090575203746b2b36b1a0e2ac0b1435441f (patch)
treef0fd9009fe3166d876c28afebea7b9069a8c3cf8
parent9c7b4e3ba6133d61e5de6649808daa3c14de41ec (diff)
downloademacs.d-e58ba090575203746b2b36b1a0e2ac0b1435441f.tar.gz
occur: Don't insert nil values in regexp-history
-rw-r--r--lisp/init-editing.el11
1 files changed, 5 insertions, 6 deletions
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)