Skip to content

Commit 6263d32

Browse files
fbergrotheshrh
authored andcommitted
Specify interactive arguments in the interactive form
This makes the commands repeatable.
1 parent 7471762 commit 6263d32

File tree

1 file changed

+26
-48
lines changed

1 file changed

+26
-48
lines changed

meow-command.el

Lines changed: 26 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1123,11 +1123,10 @@ with UNIVERSAL ARGUMENT, search both side."
11231123
(forward-char 1)
11241124
(point))))))
11251125

1126-
(defun meow-find (n &optional prompt expand)
1126+
(defun meow-find (n ch &optional expand)
11271127
"Find the next N char read from minibuffer."
1128-
(interactive "p")
1128+
(interactive "p\ncFind:")
11291129
(let* ((case-fold-search nil)
1130-
(ch (read-char (or prompt (message "Find(%d):" n))))
11311130
(ch-str (if (eq ch 13) "\n" (char-to-string ch)))
11321131
(beg (point))
11331132
end)
@@ -1143,15 +1142,14 @@ with UNIVERSAL ARGUMENT, search both side."
11431142
(meow--maybe-highlight-num-positions
11441143
'(meow--find-continue-backward . meow--find-continue-forward)))))
11451144

1146-
(defun meow-find-expand (n)
1147-
(interactive "p")
1148-
(meow-find n (message "Expand find(%d):" n) t))
1145+
(defun meow-find-expand (n ch)
1146+
(interactive "p\ncExpand find:")
1147+
(meow-find n ch t))
11491148

1150-
(defun meow-till (n &optional prompt expand)
1149+
(defun meow-till (n ch &optional expand)
11511150
"Forward till the next N char read from minibuffer."
1152-
(interactive "p")
1151+
(interactive "p\ncTill:")
11531152
(let* ((case-fold-search nil)
1154-
(ch (read-char (message (or prompt "Till(%d):") n)))
11551153
(ch-str (if (eq ch 13) "\n" (char-to-string ch)))
11561154
(beg (point))
11571155
(fix-pos (if (< n 0) 1 -1))
@@ -1169,9 +1167,9 @@ with UNIVERSAL ARGUMENT, search both side."
11691167
(meow--maybe-highlight-num-positions
11701168
'(meow--till-continue-backward . meow--till-continue-forward)))))
11711169

1172-
(defun meow-till-expand (n)
1173-
(interactive "p")
1174-
(meow-till n (message "Expand till(%d):" n) t))
1170+
(defun meow-till-expand (n ch)
1171+
(interactive "p\ncExpand till:")
1172+
(meow-till n ch t))
11751173

11761174
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
11771175
;;; VISIT and SEARCH
@@ -1288,41 +1286,25 @@ To search backward, use \\[negative-argument]."
12881286
(alist-get cmd meow-thing-selection-directions)
12891287
'forward))
12901288

1291-
(defun meow--parse-or-prompt-for-thing (prompt inner thing)
1292-
(if thing
1293-
(meow--parse-range-of-thing thing inner)
1294-
(let ((ch (meow-thing-prompt prompt)))
1295-
(if inner
1296-
(meow--parse-inner-of-thing-char ch)
1297-
(meow--parse-bounds-of-thing-char ch)))))
1298-
1299-
(defun meow-beginning-of-thing (&optional thing)
1300-
"Select to the beginning of THING represented by CH.
1301-
If THING is not supplied, prompt for selection.
1302-
1303-
Prefix argument is not allowed for this command."
1304-
(interactive)
1289+
(defun meow-beginning-of-thing (thing)
1290+
"Select to the beginning of THING."
1291+
(interactive (list (meow-thing-prompt "Beginning of: ")))
13051292
(save-window-excursion
13061293
(let ((back (equal 'backward (meow--thing-get-direction 'beginning)))
1307-
(bounds (meow--parse-or-prompt-for-thing
1308-
"Beginning of: " t thing)))
1294+
(bounds (meow--parse-inner-of-thing-char thing)))
13091295
(when bounds
13101296
(thread-first
13111297
(meow--make-selection '(select . transient)
13121298
(if back (point) (car bounds))
13131299
(if back (car bounds) (point)))
13141300
(meow--select))))))
13151301

1316-
(defun meow-end-of-thing (&optional thing)
1317-
"Select to the end of THING represented by CH.
1318-
If THING is not supplied, then prompt for selection
1319-
1320-
Prefix argument is not allowed for this command."
1321-
(interactive)
1302+
(defun meow-end-of-thing (thing)
1303+
"Select to the end of THING."
1304+
(interactive (list (meow-thing-prompt "End of: ")))
13221305
(save-window-excursion
13231306
(let ((back (equal 'backward (meow--thing-get-direction 'end)))
1324-
(bounds (meow--parse-or-prompt-for-thing
1325-
"End of: " t thing)))
1307+
(bounds (meow--parse-inner-of-thing-char thing)))
13261308
(when bounds
13271309
(thread-first
13281310
(meow--make-selection '(select . transient)
@@ -1338,24 +1320,20 @@ Prefix argument is not allowed for this command."
13381320
(if back (car bounds) (cdr bounds)))
13391321
(meow--select))))
13401322

1341-
(defun meow-inner-of-thing (&optional thing)
1342-
"Select inner (excluding delimeters) of THING. If THING is not
1343-
supplied then prompt for selection."
1344-
(interactive)
1323+
(defun meow-inner-of-thing (thing)
1324+
"Select inner (excluding delimeters) of THING."
1325+
(interactive (list (meow-thing-prompt "Inner of: ")))
13451326
(save-window-excursion
13461327
(let ((back (equal 'backward (meow--thing-get-direction 'inner)))
1347-
(bounds (meow--parse-or-prompt-for-thing
1348-
"Inner of: " t thing)))
1328+
(bounds (meow--parse-inner-of-thing-char thing)))
13491329
(meow--select-range back bounds))))
13501330

1351-
(defun meow-bounds-of-thing (&optional thing)
1352-
"Select bounds (including delimiters) of THING. If THING is not
1353-
supplied then prompt for selection."
1354-
(interactive)
1331+
(defun meow-bounds-of-thing (thing)
1332+
"Select bounds (including delimiters) of THING."
1333+
(interactive (list (meow-thing-prompt "Bounds of: ")))
13551334
(save-window-excursion
13561335
(let ((back (equal 'backward (meow--thing-get-direction 'bounds)))
1357-
(bounds (meow--parse-or-prompt-for-thing
1358-
"Bounds of: " nil thing)))
1336+
(bounds (meow--parse-bounds-of-thing-char thing)))
13591337
(meow--select-range back bounds))))
13601338

13611339
(defun meow-indent ()

0 commit comments

Comments
 (0)