help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Reading from a buffer


From: Emanuel Berg
Subject: Re: Reading from a buffer
Date: Thu, 02 Jul 2020 02:39:05 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux)

Greg Hill wrote:

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

Glad to hear it, but I don't follow what you intend
to do?

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

Unformat the buffer? ... ?

Something like:

(how-many "[[:digit:]]") ; eight

(when (re-search-forward "[[:digit:]]+" (point-max) t)
  (message (format "found digit: %s" (match-string-no-properties 0)) ))

eval the above `when' to find...

256

-- 
underground experts united
http://user.it.uu.se/~embe8573
https://dataswamp.org/~incal




reply via email to

[Prev in Thread] Current Thread [Next in Thread]