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

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

require basic stuff from specific packages


From: Emanuel Berg
Subject: require basic stuff from specific packages
Date: Mon, 04 Jul 2016 01:13:33 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux)

(require 'cl-lib)
(require 'erc)

;; Here is a common situation.
;; You are in need of something low-level, generic.
;; You make a search.
;; You find it, only it is in some other pack that is not
;; low-level or generic, but very specific and
;; has nothing to do with what you do.
;; To `require' it is like venturing into the
;; master's secret workshop to get nails and bolts!
;; What should you do then?
;; Here is an example:

(defun sequence-string (start stop &optional step delim)
  (let*((the-step  (or step 1))
        (the-delim (or delim " "))
        (string    (format "%s" start))
        )
    (cl-loop for n from (+ start the-step) to stop by the-step do
             (setq string
                   (format "%s%s%s" string the-delim n) ))
    (erc-trim-string string) ; here
    ))

;;;; testing for dummies - the fun and easy way:
;;
;; (sequence-string 1 10)          ; "1 2 3 4 5 6 7 8 9 10"
;; (sequence-string 3 5 3)         ; "3"
;; (sequence-string 5 15 2)        ; "5 7 9 11 13 15"
;; (sequence-string 20 30 3 ", ")  ; "20, 23, 26, 29"

-- 
underground experts united .... http://user.it.uu.se/~embe8573
Emacs Gnus Blogomatic ......... http://user.it.uu.se/~embe8573/blogomatic
                   - so far: 56 Blogomatic articles -                   


reply via email to

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