changelog shortlog graph tags branches changeset file revisions annotate raw help

Mercurial > core / emacs/util.el

revision 451: 8e94959e96bd
parent 188: 34bacb513d55
child 596: 46e9425cf3c2
     1.1--- a/emacs/util.el	Sun Jun 16 02:22:07 2024 +0000
     1.2+++ b/emacs/util.el	Sun Jun 16 18:26:21 2024 -0400
     1.3@@ -5,14 +5,14 @@
     1.4 
     1.5 ;;; Helpers
     1.6 (defun group (source n)
     1.7-  "This is Paul Graham's group utility from 'On Lisp'.
     1.8+  "This is Paul Graham's group utility from On Lisp.
     1.9 
    1.10 Group a list of arguments SOURCE by any provided grouping amount
    1.11 N.
    1.12 
    1.13 For example:
    1.14-(group '(foo 2 bar 4) 2) ;=> ((foo 2) (bar 4))
    1.15-(group '(a b c d e f) 3) ;=> ((a b c) (d e f))
    1.16+(group (quote (foo 2 bar 4)) 2) ;=> ((foo 2) (bar 4))
    1.17+(group (quote (a b c d e f)) 3) ;=> ((a b c) (d e f))
    1.18 "
    1.19   (when (zerop n) (error "zero length"))
    1.20   (cl-labels ((rec (source acc)
    1.21@@ -26,9 +26,9 @@
    1.22     (when source (rec source nil))))
    1.23 
    1.24 (defun flatten (x)
    1.25-  "Paul Graham's flatten utility from 'On Lisp'.
    1.26+  "Paul Graham's flatten utility from On Lisp.
    1.27 
    1.28-Given a tree X, return all the 'leaves' of the tree."
    1.29+Given a tree X, return all the leaves of the tree."
    1.30   (cl-labels ((rec (x acc)
    1.31                    (cond ((null x) acc)
    1.32                          ((atom x) (cons x acc))
    1.33@@ -38,7 +38,7 @@
    1.34     (rec x nil)))
    1.35 
    1.36 (defun mkstr (&rest args)
    1.37-  "Paul Graham's mkstr utility from 'On Lisp'.
    1.38+  "Paul Graham's mkstr utility from On Lisp.
    1.39 
    1.40 Coerce ARGS into a single string and return it."
    1.41   (let* ((s ""))
    1.42@@ -51,7 +51,7 @@
    1.43     s))
    1.44 
    1.45 (defun symb (&rest args)
    1.46-  "Paul Graham's symb utility from 'On Lisp'.
    1.47+  "Paul Graham's symb utility from On Lisp.
    1.48 
    1.49 Concat ARGS and return a newly interned symbol."
    1.50   (intern (apply #'mkstr args)))
    1.51@@ -88,7 +88,7 @@
    1.52              (setq result (concat (file-name-as-directory result) dir)))
    1.53     result))
    1.54 
    1.55-(defun wc (&optional start end)
    1.56+(defun wc ()
    1.57   "Return a 3-element list with lines, words and characters in
    1.58 region or whole buffer."
    1.59   (interactive)
    1.60@@ -116,7 +116,7 @@
    1.61 expression.
    1.62 With optional N, search in the Nth line from point."
    1.63   (save-excursion
    1.64-    (goto-char (point-at-bol))
    1.65+    (goto-char (pos-bol))
    1.66     (and (not (bobp))
    1.67          (or (beginning-of-line n) t)
    1.68          (save-match-data
    1.69@@ -161,16 +161,7 @@
    1.70 
    1.71 ;;; Server
    1.72 ;;;###autoload
    1.73-(defun kill-emacs-restart (&optional arg)
    1.74-  "Handler for SIGUSR1 signal, to (re)start an emacs server.
    1.75-
    1.76-Can be tested from within emacs with:
    1.77-  (signal-process (emacs-pid) 'sigusr1)
    1.78-
    1.79-or from the command line with:
    1.80-$ kill -USR1 <emacs-pid>
    1.81-$ emacsclient -c
    1.82-"
    1.83+(defun kill-emacs-restart ()
    1.84   (interactive)
    1.85   (server-force-delete)
    1.86   (server-start))