[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
ABC index
From: |
Emanuel Berg |
Subject: |
ABC index |
Date: |
Tue, 27 Oct 2020 22:23:05 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) |
A friend asked how to do this
Kate Moss
Elle Macpherson
Alicia Silverstone
into this
A Kate Moss
B Elle Macpherson
C Alicia Silverstone
No idea why!
Anyway, ABC index contest! Elisp and keyboard macros allowed!
Here is contribution CONTRIBUTION by Yours Truly:
(require 'cl-lib)
(defun index-abc (&optional beg end)
(interactive (if (use-region-p)
(list (region-beginning) (region-end))
(list (point-min) (point-max) )))
(save-excursion
(save-restriction
(narrow-to-region beg end)
(goto-char (point-min))
(cl-loop for i from ?A to ?Z do
(when (re-search-forward "^" nil t)
(insert (char-to-string i) " ") )))))
--
underground experts united
http://user.it.uu.se/~embe8573
https://dataswamp.org/~incal
- ABC index,
Emanuel Berg <=