* Re: master 8ee21db4af: Add new function `read-string-from-buffer'. [not found] ` <20220424131606.1E4FEC009A8@vcs2.savannah.gnu.org> @ 2022-04-24 14:03 ` Sean Whitton 2022-04-24 14:07 ` Lars Ingebrigtsen 2022-04-29 9:44 ` Jean Louis 0 siblings, 2 replies; 7+ messages in thread From: Sean Whitton @ 2022-04-24 14:03 UTC (permalink / raw) To: Lars Ingebrigtsen, emacs-devel Hello, On Sun 24 Apr 2022 at 09:16am -04, Lars Ingebrigtsen wrote: > + > +If the user aborts (with `C-c C-d'), ABORT-CALLBACK (if any) is > +called with no parameters. I think C-c C-k would be more consistent with other modes? -- Sean Whitton ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: master 8ee21db4af: Add new function `read-string-from-buffer'. 2022-04-24 14:03 ` master 8ee21db4af: Add new function `read-string-from-buffer' Sean Whitton @ 2022-04-24 14:07 ` Lars Ingebrigtsen 2022-04-29 9:44 ` Jean Louis 1 sibling, 0 replies; 7+ messages in thread From: Lars Ingebrigtsen @ 2022-04-24 14:07 UTC (permalink / raw) To: Sean Whitton; +Cc: emacs-devel Sean Whitton <spwhitton@spwhitton.name> writes: >> +If the user aborts (with `C-c C-d'), ABORT-CALLBACK (if any) is >> +called with no parameters. > > I think C-c C-k would be more consistent with other modes? Yup; now altered. -- (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: master 8ee21db4af: Add new function `read-string-from-buffer'. 2022-04-24 14:03 ` master 8ee21db4af: Add new function `read-string-from-buffer' Sean Whitton 2022-04-24 14:07 ` Lars Ingebrigtsen @ 2022-04-29 9:44 ` Jean Louis 2022-04-29 12:20 ` Stefan Monnier 1 sibling, 1 reply; 7+ messages in thread From: Jean Louis @ 2022-04-29 9:44 UTC (permalink / raw) To: Sean Whitton; +Cc: Lars Ingebrigtsen, emacs-devel I am using similar function all the time. (defun read-from-buffer (&optional value buffer-name mode title keymap place highlight-list minor-modes) I suggest you implement some of these features: - I like to designate offen the buffer-name, it becomes more descriptive - Some text is in different modes, some strings are in html-mode, some are in markdown-mode, some in asciidoc mode, some are SQL mode, and so on; - I may need to pass keymap to function - I pass some minor-modes when necessary PLACE is something related to database, like database, column, ID, when I edit database objects, it is not related and not necessary to this general function -- Jean Take action in Free Software Foundation campaigns: https://www.fsf.org/campaigns In support of Richard M. Stallman https://stallmansupport.org/ ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: master 8ee21db4af: Add new function `read-string-from-buffer'. 2022-04-29 9:44 ` Jean Louis @ 2022-04-29 12:20 ` Stefan Monnier 2022-04-29 13:18 ` Jean Louis 0 siblings, 1 reply; 7+ messages in thread From: Stefan Monnier @ 2022-04-29 12:20 UTC (permalink / raw) To: Sean Whitton; +Cc: Lars Ingebrigtsen, emacs-devel Jean Louis [2022-04-29 12:44:41] wrote: > (defun read-from-buffer (&optional value buffer-name mode title keymap place > highlight-list minor-modes) I'd collapse those "mode title keymap place highlight-list minor-modes" into a singe `setup-function` argument. And FWIW, `read-from-buffer` sounds like a good name for a "low-level" function that parallels `read-from-minibuffer` but using a normal window rather than a miniwindow, whereas `read-string-from-buffer` sounds like a replacement for `read-string` (and hence wouldn't take/need a `setup-function` argument). Stefan ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: master 8ee21db4af: Add new function `read-string-from-buffer'. 2022-04-29 12:20 ` Stefan Monnier @ 2022-04-29 13:18 ` Jean Louis 2022-04-29 13:52 ` Stefan Monnier 0 siblings, 1 reply; 7+ messages in thread From: Jean Louis @ 2022-04-29 13:18 UTC (permalink / raw) To: Stefan Monnier; +Cc: Lars Ingebrigtsen, emacs-devel, Sean Whitton * Stefan Monnier <monnier@iro.umontreal.ca> [2022-04-29 15:21]: > Jean Louis [2022-04-29 12:44:41] wrote: > > (defun read-from-buffer (&optional value buffer-name mode title keymap place > > highlight-list minor-modes) > > I'd collapse those "mode title keymap place highlight-list minor-modes" > into a singe `setup-function` argument. Is there example of that to help me understand it? Do you mean `setup-function` should be a list or hash, or similar data type which is then parsed by function? -- Jean Take action in Free Software Foundation campaigns: https://www.fsf.org/campaigns In support of Richard M. Stallman https://stallmansupport.org/ ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: master 8ee21db4af: Add new function `read-string-from-buffer'. 2022-04-29 13:18 ` Jean Louis @ 2022-04-29 13:52 ` Stefan Monnier 2022-05-18 5:17 ` Jean Louis 0 siblings, 1 reply; 7+ messages in thread From: Stefan Monnier @ 2022-04-29 13:52 UTC (permalink / raw) To: Sean Whitton; +Cc: Lars Ingebrigtsen, emacs-devel Jean Louis [2022-04-29 16:18:48] wrote: > * Stefan Monnier <monnier@iro.umontreal.ca> [2022-04-29 15:21]: >> Jean Louis [2022-04-29 12:44:41] wrote: >> > (defun read-from-buffer (&optional value buffer-name mode title keymap place >> > highlight-list minor-modes) >> >> I'd collapse those "mode title keymap place highlight-list minor-modes" >> into a singe `setup-function` argument. > > Is there example of that to help me understand it? > > Do you mean `setup-function` should be a list or hash, or similar data > type which is then parsed by function? No, I mean a formal argument called `setup-function` which `read-from-buffer` would call (probably with 0 arguments) in the buffer. So instead of: (read-from-buffer "My prompt: " "*The Buffer*" #'foo-mode nil foo-map nil nil (list #'bar-minor-mode)) you'd write: (read-from-buffer "My prompt: " "*The Buffer*" (lambda () (foo-mode) (use-local-map foo-map) (bar-minor-mode 1))) -- Stefan ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: master 8ee21db4af: Add new function `read-string-from-buffer'. 2022-04-29 13:52 ` Stefan Monnier @ 2022-05-18 5:17 ` Jean Louis 0 siblings, 0 replies; 7+ messages in thread From: Jean Louis @ 2022-05-18 5:17 UTC (permalink / raw) To: Stefan Monnier; +Cc: Sean Whitton, Lars Ingebrigtsen, emacs-devel * Stefan Monnier <monnier@iro.umontreal.ca> [2022-04-29 16:54]: > Jean Louis [2022-04-29 16:18:48] wrote: > > * Stefan Monnier <monnier@iro.umontreal.ca> [2022-04-29 15:21]: > >> Jean Louis [2022-04-29 12:44:41] wrote: > >> > (defun read-from-buffer (&optional value buffer-name mode title keymap place > >> > highlight-list minor-modes) > >> > >> I'd collapse those "mode title keymap place highlight-list minor-modes" > >> into a singe `setup-function` argument. > > > > Is there example of that to help me understand it? > > > > Do you mean `setup-function` should be a list or hash, or similar data > > type which is then parsed by function? > > No, I mean a formal argument called `setup-function` which > `read-from-buffer` would call (probably with 0 arguments) in the buffer. > > So instead of: > > (read-from-buffer "My prompt: " "*The Buffer*" > #'foo-mode nil foo-map nil nil (list #'bar-minor-mode)) > > you'd write: > > (read-from-buffer "My prompt: " "*The Buffer*" > (lambda () > (foo-mode) > (use-local-map foo-map) > (bar-minor-mode 1))) > I got that, thank you. That is generally good idea for some functions that require more arguments. -- Jean Take action in Free Software Foundation campaigns: https://www.fsf.org/campaigns In support of Richard M. Stallman https://stallmansupport.org/ ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2022-05-18 5:17 UTC | newest] Thread overview: 7+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- [not found] <165080616575.16300.17375829044466066664@vcs2.savannah.gnu.org> [not found] ` <20220424131606.1E4FEC009A8@vcs2.savannah.gnu.org> 2022-04-24 14:03 ` master 8ee21db4af: Add new function `read-string-from-buffer' Sean Whitton 2022-04-24 14:07 ` Lars Ingebrigtsen 2022-04-29 9:44 ` Jean Louis 2022-04-29 12:20 ` Stefan Monnier 2022-04-29 13:18 ` Jean Louis 2022-04-29 13:52 ` Stefan Monnier 2022-05-18 5:17 ` Jean Louis
Code repositories for project(s) associated with this public inbox https://git.savannah.gnu.org/cgit/emacs.git This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).