[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: What is better way to automatically generate set of functions?
From: |
Jean Louis |
Subject: |
Re: What is better way to automatically generate set of functions? |
Date: |
Sun, 16 May 2021 01:17:25 +0300 |
User-agent: |
Mutt/2.0.6 (2021-03-06) |
* Stefan Monnier via Users list for the GNU Emacs text editor
<help-gnu-emacs@gnu.org> [2021-05-16 00:49]:
> > `,(defalias function-name (lambda () (message "Hello")))))
>
> "`," == ""
That too, yes. It was left from trying out to work with `defun'
For now, this here works, but is not elegant.
(defun hyperscope-generate-the-add-function-by-hyperdocument-type (type id)
(let* ((type (downcase (string-replace " " "-" type)))
(function-name (intern (format "hyperscope-add-new-%s-hyperdocument"
type))))
(eval (list
'defun function-name ()
(format "Add new `%s' hyperdocument to Hyperscope." type)
'(interactive)
`(let* ((parent (hyperscope-select-set))
(prompt ,(format "New `%s' hyperdocument name: " type))
(name (read-from-minibuffer prompt)))
(hlink-add-generic name "" ,id parent nil))))))
--
Jean
Take action in Free Software Foundation campaigns:
https://www.fsf.org/campaigns
Sign an open letter in support of Richard M. Stallman
https://stallmansupport.org/
https://rms-support-letter.github.io/