unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Reading from a buffer
@ 2020-07-01 19:12 Greg Hill
  2020-07-01 19:19 ` Eli Zaretskii
                   ` (3 more replies)
  0 siblings, 4 replies; 10+ messages in thread
From: Greg Hill @ 2020-07-01 19:12 UTC (permalink / raw)
  To: help-gnu-emacs

I've pretty well mastered the process of *writing to* a buffer using
*insert* and *format*, but I haven't been able to find any equally easy way
to read that same information back. I've hacked together a workaround using
*copy-to-register*, *get-register* and *read-from-string*, but surely there
must be a more straightforward approach than that. I've searched and
searched through all the documentation and have come up with nothing for
doing a simple formatted read from buffer. Any suggestions?


^ permalink raw reply	[flat|nested] 10+ messages in thread
* Re: Reading from a buffer
@ 2020-07-01 20:19 Greg Hill
  2020-07-01 21:10 ` Stefan Monnier
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Greg Hill @ 2020-07-01 20:19 UTC (permalink / raw)
  To: help-gnu-emacs

The function 'buffer-substring-no-properties' is certainly a step in the
right direction, thank you. I've now got it down to:
(setq count (car (read-from-string (buffer-substring-no-properties (mark)
(point)))))
But I'm nothing short of astonished that there is not yet anything in
standard Emacs Lisp that is comparable to a formatted read-from-buffer
statement in a more conventional programming language like Fortran or C.
I'm imagining something akin to '(insert (format...' but working in the
opposite direction, something like '(unformat (read...'.  Perhaps I'll just
create my own library of intuitive and easy-to-use buffer I/O functions
since I expect to be doing quite a bit of this sort of thing in the future.


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2020-07-03  6:33 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-07-01 19:12 Reading from a buffer Greg Hill
2020-07-01 19:19 ` Eli Zaretskii
2020-07-01 19:20 ` Emanuel Berg via Users list for the GNU Emacs text editor
2020-07-01 19:21 ` Jakub Jankiewicz
2020-07-01 19:21 ` Jakub Jankiewicz
  -- strict thread matches above, loose matches on Subject: below --
2020-07-01 20:19 Greg Hill
2020-07-01 21:10 ` Stefan Monnier
2020-07-02  0:39 ` Emanuel Berg via Users list for the GNU Emacs text editor
2020-07-03  3:38 ` Jean-Christophe Helary
2020-07-03  6:33   ` Greg Hill

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).