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.
This commit is contained in:
parent
bb0cd31939
commit
05df6662ef
1 changed files with 17 additions and 6 deletions
|
@ -1581,11 +1581,14 @@ Refer to `hide-ifdef-expand-reinclusion-protection' for more details."
|
||||||
result))
|
result))
|
||||||
|
|
||||||
(defun hif-evaluate-macro (rstart rend)
|
(defun hif-evaluate-macro (rstart rend)
|
||||||
"Evaluate the macro expansion result for a region.
|
"Evaluate the macro expansion result for the active region.
|
||||||
If no region active, find the current #ifdefs and evaluate the result.
|
If no region active, find the current #ifdefs and evaluate the result.
|
||||||
Currently it supports only math calculations, strings or argumented macros can
|
Currently it supports only math calculations, strings or argumented macros can
|
||||||
not be expanded."
|
not be expanded."
|
||||||
(interactive "r")
|
(interactive
|
||||||
|
(if (use-region-p)
|
||||||
|
(list (region-beginning) (region-end))
|
||||||
|
'(nil nil)))
|
||||||
(let ((case-fold-search nil))
|
(let ((case-fold-search nil))
|
||||||
(save-excursion
|
(save-excursion
|
||||||
(unless mark-active
|
(unless mark-active
|
||||||
|
@ -1844,9 +1847,13 @@ This allows #ifdef VAR to be hidden."
|
||||||
|
|
||||||
(defun hide-ifdef-undef (start end)
|
(defun hide-ifdef-undef (start end)
|
||||||
"Undefine a VAR so that #ifdef VAR would not be included."
|
"Undefine a VAR so that #ifdef VAR would not be included."
|
||||||
(interactive "r")
|
(interactive
|
||||||
|
(if (use-region-p)
|
||||||
|
(list (region-beginning) (region-end))
|
||||||
|
'(nil nil)))
|
||||||
(let* ((symstr
|
(let* ((symstr
|
||||||
(or (and mark-active
|
(or (and (number-or-marker-p start)
|
||||||
|
(number-or-marker-p end)
|
||||||
(buffer-substring-no-properties start end))
|
(buffer-substring-no-properties start end))
|
||||||
(read-string "Undefine what? " (current-word))))
|
(read-string "Undefine what? " (current-word))))
|
||||||
(sym (and symstr
|
(sym (and symstr
|
||||||
|
@ -1931,8 +1938,12 @@ With optional prefix argument ARG, also hide the #ifdefs themselves."
|
||||||
|
|
||||||
(defun show-ifdef-block (&optional start end)
|
(defun show-ifdef-block (&optional start end)
|
||||||
"Show the ifdef block (true or false part) enclosing or before the cursor."
|
"Show the ifdef block (true or false part) enclosing or before the cursor."
|
||||||
(interactive "r")
|
(interactive
|
||||||
(if mark-active
|
(if (use-region-p)
|
||||||
|
(list (region-beginning) (region-end))
|
||||||
|
'(nil nil)))
|
||||||
|
(if (and (number-or-marker-p start)
|
||||||
|
(number-or-marker-p end))
|
||||||
(progn
|
(progn
|
||||||
(dolist (o (overlays-in start end))
|
(dolist (o (overlays-in start end))
|
||||||
(if (overlay-get o 'hide-ifdef)
|
(if (overlay-get o 'hide-ifdef)
|
||||||
|
|
Loading…
Add table
Reference in a new issue