summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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)