;;; -*- lexical-binding: t -*- ;; ;; this file: ;; https://dataswamp.org/~incal/emacs-init/abc.el (require 'cl-lib) (defun alphabet (&optional as-list) (let ((abc "a b c d e f g h i j k l m n o p q r s t u v w x y z")) (if as-list (cl-remove ?\s (string-to-list abc)) abc) )) ;; (alphabet) ; a b c d e f g h i j k l m n o p q r s t u v w x y z ;; (alphabet t) ; (97 98 99 100 101 102 103 104 105 106 107 108 ...) (defun echo-alphabet (&optional num) (interactive "P") (or num (setq num (length (alphabet t)))) (let*((part (cl-subseq (alphabet t) 0 num)) (str-list (mapcar (lambda (c) (char-to-string c)) part)) (str-almost (format "%s" str-list)) (str (substring str-almost 1 (1- (length str-almost)))) ) (message str) )) (defalias 'abc #'echo-alphabet) ;; (echo-alphabet) ; a b c d e f g h i j k l m n o p q r s t u v w x y z ;; (echo-alphabet 2) ; a b ;; (echo-alphabet -2) ; a b c d e f g h i j k l m n o p q r s t u v w x ;; (echo-alphabet 10) ; a b c d e f g h i j ;; (echo-alphabet -10) ; a b c d e f g h i j k l m n o p (provide 'abc)