From: Emanuel Berg <moasenwood@zoho.eu>
To: help-gnu-emacs@gnu.org
Cc: emacs-devel@gnu.org
Subject: make-list.el
Date: Sat, 23 Mar 2019 06:28:04 +0100 [thread overview]
Message-ID: <864l7udusb.fsf@zoho.eu> (raw)
;; 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
reply other threads:[~2019-03-23 5:28 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=864l7udusb.fsf@zoho.eu \
--to=moasenwood@zoho.eu \
--cc=emacs-devel@gnu.org \
--cc=help-gnu-emacs@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.