Remove old library
This commit is contained in:
parent
0564bde343
commit
bfc5ca2b5a
|
@ -1,48 +0,0 @@
|
||||||
(defun cp-get-buffer-regexp (regexp &optional all)
|
|
||||||
"Returns the name of the first buffer in the buffer list which matches REGEXP.
|
|
||||||
|
|
||||||
If ALL is non-nil, multiple matches will be returned as a list."
|
|
||||||
(let ((results (cl-remove-if-not (lambda (a)
|
|
||||||
(string-match regexp a))
|
|
||||||
(mapcar #'buffer-name (buffer-list)))))
|
|
||||||
(if all results (car results))))
|
|
||||||
|
|
||||||
(cl-defun cp-buffer-name-match-p (regexp &optional (string (buffer-name)))
|
|
||||||
"Checks if STRING matches REGEXP.
|
|
||||||
If STRING is not provided, uses the current buffer name."
|
|
||||||
(if (string-match regexp string) t nil))
|
|
||||||
|
|
||||||
(defun cp/random-elt (list)
|
|
||||||
"Retun a random element from LIST."
|
|
||||||
(nth (random (length list)) list))
|
|
||||||
|
|
||||||
(defun cp/map-two (fn list)
|
|
||||||
"Apply FN to the first two elements of LIST, then the second two, and so on."
|
|
||||||
(let ((newlist '()))
|
|
||||||
(while (not (= 0 (- (length list) 1)))
|
|
||||||
(setq newlist
|
|
||||||
(append
|
|
||||||
newlist (list
|
|
||||||
(funcall fn (car list) (cadr list)))))
|
|
||||||
(pop list))
|
|
||||||
newlist))
|
|
||||||
|
|
||||||
(defun cp/average (numbers)
|
|
||||||
(/ (-reduce '+ numbers)
|
|
||||||
(length numbers)))
|
|
||||||
|
|
||||||
(defun cp/pastebinit ()
|
|
||||||
(interactive)
|
|
||||||
(-> (shell-command-on-region
|
|
||||||
(if (region-active-p) (region-beginning) (point-min))
|
|
||||||
(if (region-active-p) (region-end) (point-max))
|
|
||||||
"pastebinit")
|
|
||||||
(kill-new)))
|
|
||||||
|
|
||||||
(defun ^ (base pwr)
|
|
||||||
(while (not (zerop pwr))
|
|
||||||
(setq base (* base base)
|
|
||||||
pwr (- pwr 1)))
|
|
||||||
base)
|
|
||||||
|
|
||||||
(provide 'cp)
|
|
1
init.org
1
init.org
|
@ -591,7 +591,6 @@ ARGS are ignored."
|
||||||
**
|
**
|
||||||
#+BEGIN_SRC emacs-lisp
|
#+BEGIN_SRC emacs-lisp
|
||||||
(add-to-list 'load-path "~/.emacs.d/contrapunctus/")
|
(add-to-list 'load-path "~/.emacs.d/contrapunctus/")
|
||||||
(load "cp")
|
|
||||||
|
|
||||||
;; (if (not (server-running-p)) (server-start))
|
;; (if (not (server-running-p)) (server-start))
|
||||||
(server-start)
|
(server-start)
|
||||||
|
|
Loading…
Reference in New Issue