* make-list.el
@ 2019-03-23 5:28 Emanuel Berg
0 siblings, 0 replies; only message in thread
From: Emanuel Berg @ 2019-03-23 5:28 UTC (permalink / raw)
To: help-gnu-emacs; +Cc: emacs-devel
;; This file: http://user.it.uu.se/~embe8573/emacs-init/make-list.el
;;
;;
;; EXAMPLE WHAT IT DOES
;;
;; Turn this:
;;
;; gnus-summary--inv gnus-summary-add-mark
;; gnus-summary-article-ancient-p gnus-summary-article-children
;; gnus-summary-article-header gnus-summary-article-intangible-p
;;
;; into this:
;;
;; gnus-summary--inv
;; gnus-summary-add-mark
;; gnus-summary-article-ancient-p
;; gnus-summary-article-children
;; gnus-summary-article-header
;; gnus-summary-article-intangible-p
;;
;;
;; QUICK START
;;
;; Three ways to use:
;;
;; 1) from Lisp, e.g.
;; (make-buffer-list 1 268)
;;
;; 2) interactively (`M-x blist RET') with
;; a region
;;
;; 3) interactively _without_ a region, then
;; the whole buffer is affected
;;
;;
;; TODO
;;
;; - docstring
;;
;; - add an additional optional argument
;; REGEXP-SEP in case text separators
;; aren't "[[:space:]]+" as is currently
;; hardcoded
;;
;;
;; SOME SAMPLE DATA TO TRY ON
;;
;; (first uncomment - well, it will work anyway
;; I guess...)
;;
;; gnus-summary--inv gnus-summary-add-mark
;; gnus-summary-article-ancient-p gnus-summary-article-children
;; gnus-summary-article-header gnus-summary-article-intangible-p
;; gnus-summary-article-map gnus-summary-article-mark
;; gnus-summary-article-number gnus-summary-article-parent
;; gnus-summary-article-pos gnus-summary-article-posted-p
;; gnus-summary-article-pseudo-p gnus-summary-article-score
;; gnus-summary-article-sparse-p gnus-summary-article-subject
;; gnus-summary-article-unread-p gnus-summary-articles-in-thread
;; gnus-summary-auto-select-subject gnus-summary-backend-map
;; gnus-summary-beginning-of-article gnus-summary-best-group
;; gnus-summary-best-unread-article gnus-summary-best-unread-subject
(defun make-buffer-list (&optional start stop)
(interactive
(if (use-region-p)
(list (region-beginning) (region-end))
(list (point-min) (point-max)) ))
(if (< stop start)
(error (format
"Start (%s) cannot be bigger than stop (%s)"
start stop) )
(if (or (< start (point-min))
(< (point-max) stop) )
(error (format
"Range provided [%s %s] but buffer is [%s %s]"
start stop (point-min) (point-max) ))
(progn
(narrow-to-region start stop)
(goto-char (point-min))
(while (re-search-forward "[[:space:]]+" nil t) ; BOUND NOERROR
(replace-match "\n" nil nil) ) ; FIXEDCASE LITERAL
(widen) ))))
(defalias 'blist #'make-buffer-list)
;;;; Testing indata verification:
;;
;; (make-buffer-list 10 1) ; error,
;; (make-buffer-list 0 100) ; error,
;; (make-buffer-list 1 10000) ; and error - good
--
underground experts united
http://user.it.uu.se/~embe8573
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2019-03-23 5:28 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-03-23 5:28 make-list.el Emanuel Berg
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).