From: Emanuel Berg <incal@dataswamp.org>
To: emacs-devel@gnu.org
Subject: Re: how to speed up Lisp devel time
Date: Sat, 10 Aug 2024 09:22:26 +0200 [thread overview]
Message-ID: <87wmkozvt9.fsf@dataswamp.org> (raw)
In-Reply-To: CAP_d_8XjBa=Y6aj2wB87tdHXjL6D1iA_-h+LskGdodjq6ce1kg@mail.gmail.com
Yuri Khan wrote:
> I do not necessarily want them on the same line.
> Depending on how often or rarely I use that command, I might
> want labels reminding me what each argument is for.
You got: same line, with labels.
;;; -*- lexical-binding: t -*-
;;
;; this file:
;; https://dataswamp.org/~incal/emacs-init/iihf.el
(require 'cl-lib)
;; [
;; end :d 73 :r 0< :pa mxd od
;; step :d end/10 :r 0< :r 2-10 c
;; i :d 0 :r 0<=
;; ]
(defun input-args (&optional num-str)
(interactive)
(let* (( end-def 73)
(step-def (max 10 (min 2 (/ end-def 10))))
( i-def 0)
(def (list end-def step-def i-def))
(def-str (format "%s %s %s" (nth 0 def) (nth 1 def) (nth 2 def)))
(str (or num-str
(read-string (format "1-3 numbers [RET %s]: " def-str)
nil nil def-str)))
(spl (split-string str " "))
(res (cl-mapcar (lambda (a) (string-to-number a)) spl))
(all `(,@res ,@(cl-subseq def (length res))))
(end (nth 0 all))
(step (nth 1 all))
( i (nth 2 all)))
(unless (and (< 0 end)
(< 0 step)
(<= 0 i))
(error "DNC"))
(let ((min 2)
(max 10))
(setq step (cond ( (< step min) min )
( (< max step) max )
( step )))
(list end step i))))
;; (input-args) RET ; 73 10 0
;; (input-args) 73 100 RET ; 73 10 0
;; (input-args) 73 1 RET ; 73 2 0
;; (input-args) 55 RET ; 55 10 0
;; (input-args "1 2 3") ; 1 2 3
;; (input-args "1 2") ; 1 2 0
;; (input-args "1") ; 1 10 0
;; (input-args "-1") ; DNC
;; (input-args "1 -1") ; DNC
;; (input-args "1 1 0") ; 1 2 0
;; (input-args "1 1 -1") ; DNC
(provide 'iihf)
> Do a query-replace. Then invoke it again and press M-p.
> The last search string and replacement string are recalled
> to the prompt at the same time, separated with an intangible
> arrow label.
Yes, I see. I am good at → it :)
>> That is, of course, possible. What information would you
>> like outputted, and how, for three integers with default
>> values and some tests to validate?
>
> If defaults are reasonable and I rarely need to stray from
> them (alternatively, if the last used value gets saved in
> history and automatically reused), I would like not to enter
> them at all, and not even a RET to acknowledge the default.
> When I do need to change them, I'd see that option at the
> transient screen, type the corresponding key and type the
> new value, and press RET. At that point, validation can be
> performed, as long as C-g returns me to the transient with
> the value reverted to its previous valid value (rather than
> canceling the whole command).
>
> Have you used Magit? Do a diff or log, see all the options
> they offer.
I'm not familiar with transient and Magit, but default values
and validation are all solved above.
But do tell exactly what interface you like, after you try it.
--
underground experts united
https://dataswamp.org/~incal
next prev parent reply other threads:[~2024-08-10 7:22 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-09 7:16 how to speed up Lisp devel time Emanuel Berg
2024-08-09 7:24 ` Eli Zaretskii
2024-08-09 7:39 ` Emanuel Berg
2024-08-09 10:43 ` Eli Zaretskii
2024-08-09 11:18 ` Emanuel Berg
2024-08-09 12:02 ` Eli Zaretskii
2024-08-09 13:54 ` Emanuel Berg
2024-08-09 14:58 ` Eli Zaretskii
2024-08-09 16:03 ` Emanuel Berg
2024-08-09 16:16 ` Emanuel Berg
2024-08-09 17:54 ` Eli Zaretskii
2024-08-09 18:56 ` Christopher Dimech
2024-08-09 21:57 ` Emanuel Berg
2024-08-09 21:47 ` Emanuel Berg
2024-08-09 17:27 ` Yuri Khan
2024-08-09 21:21 ` Emanuel Berg
2024-08-10 2:14 ` Emanuel Berg
2024-08-10 6:01 ` Yuri Khan
2024-08-10 6:08 ` Emanuel Berg
2024-08-10 6:44 ` Yuri Khan
2024-08-10 7:22 ` Emanuel Berg [this message]
2024-08-10 7:51 ` Emanuel Berg
2024-08-10 4:32 ` Emanuel Berg
2024-08-10 5:58 ` Eli Zaretskii
2024-08-09 14:59 ` Eduardo Ochs
2024-08-09 16:19 ` Emanuel Berg
2024-08-09 18:00 ` Eli Zaretskii
2024-08-09 18:54 ` Christopher Dimech
2024-08-09 22:17 ` Emanuel Berg
2024-08-09 22:00 ` Emanuel Berg
2024-08-09 8:24 ` Emanuel Berg
2024-08-09 10:36 ` Christopher Dimech
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87wmkozvt9.fsf@dataswamp.org \
--to=incal@dataswamp.org \
--cc=emacs-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.