aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEli Zaretskii2016-01-16 09:40:12 +0200
committerEli Zaretskii2016-01-16 09:40:12 +0200
commit05df6662ef229fdbaa2b6f4430f39f95eaa7a65a (patch)
tree015c20da70330b4b1c156b74a42e92ec3b360542
parentbb0cd3193912032ae11a27016271d4587f876f98 (diff)
downloademacs-05df6662ef229fdbaa2b6f4430f39f95eaa7a65a.tar.gz
emacs-05df6662ef229fdbaa2b6f4430f39f95eaa7a65a.zip
Fix interactive specs in some hideif.el commands
* lisp/progmodes/hideif.el (hif-evaluate-macro) (hide-ifdef-undef, show-ifdef-block): Don't use '(interactive "r")' in commands that should only act on the region if it's active.
-rw-r--r--lisp/progmodes/hideif.el23
1 files changed, 17 insertions, 6 deletions
diff --git a/lisp/progmodes/hideif.el b/lisp/progmodes/hideif.el
index cc7d1c368c5..a75a322b335 100644
--- a/lisp/progmodes/hideif.el
+++ b/lisp/progmodes/hideif.el
@@ -1581,11 +1581,14 @@ Refer to `hide-ifdef-expand-reinclusion-protection' for more details."
1581 result)) 1581 result))
1582 1582
1583(defun hif-evaluate-macro (rstart rend) 1583(defun hif-evaluate-macro (rstart rend)
1584 "Evaluate the macro expansion result for a region. 1584 "Evaluate the macro expansion result for the active region.
1585If no region active, find the current #ifdefs and evaluate the result. 1585If no region active, find the current #ifdefs and evaluate the result.
1586Currently it supports only math calculations, strings or argumented macros can 1586Currently it supports only math calculations, strings or argumented macros can
1587not be expanded." 1587not be expanded."
1588 (interactive "r") 1588 (interactive
1589 (if (use-region-p)
1590 (list (region-beginning) (region-end))
1591 '(nil nil)))
1589 (let ((case-fold-search nil)) 1592 (let ((case-fold-search nil))
1590 (save-excursion 1593 (save-excursion
1591 (unless mark-active 1594 (unless mark-active
@@ -1844,9 +1847,13 @@ This allows #ifdef VAR to be hidden."
1844 1847
1845(defun hide-ifdef-undef (start end) 1848(defun hide-ifdef-undef (start end)
1846 "Undefine a VAR so that #ifdef VAR would not be included." 1849 "Undefine a VAR so that #ifdef VAR would not be included."
1847 (interactive "r") 1850 (interactive
1851 (if (use-region-p)
1852 (list (region-beginning) (region-end))
1853 '(nil nil)))
1848 (let* ((symstr 1854 (let* ((symstr
1849 (or (and mark-active 1855 (or (and (number-or-marker-p start)
1856 (number-or-marker-p end)
1850 (buffer-substring-no-properties start end)) 1857 (buffer-substring-no-properties start end))
1851 (read-string "Undefine what? " (current-word)))) 1858 (read-string "Undefine what? " (current-word))))
1852 (sym (and symstr 1859 (sym (and symstr
@@ -1931,8 +1938,12 @@ With optional prefix argument ARG, also hide the #ifdefs themselves."
1931 1938
1932(defun show-ifdef-block (&optional start end) 1939(defun show-ifdef-block (&optional start end)
1933 "Show the ifdef block (true or false part) enclosing or before the cursor." 1940 "Show the ifdef block (true or false part) enclosing or before the cursor."
1934 (interactive "r") 1941 (interactive
1935 (if mark-active 1942 (if (use-region-p)
1943 (list (region-beginning) (region-end))
1944 '(nil nil)))
1945 (if (and (number-or-marker-p start)
1946 (number-or-marker-p end))
1936 (progn 1947 (progn
1937 (dolist (o (overlays-in start end)) 1948 (dolist (o (overlays-in start end))
1938 (if (overlay-get o 'hide-ifdef) 1949 (if (overlay-get o 'hide-ifdef)