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

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

Re: Too fine design granularity leads to numerous macro/function/command


From: Emanuel Berg
Subject: Re: Too fine design granularity leads to numerous macro/function/command existed in Emacs.
Date: Fri, 13 Aug 2021 20:21:18 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

Arthur Miller wrote:

> learn relatively recently, say one year ago, but I find lisp
> much faster to code than shell. That what you coded there
> requires knowledge of zshell, awk, sort and tail.

They are just basic building blocks the basic usage of which
is known to everyone, it is like building Lego or something,
meanwhile the below code requires both some general
programming fluency AND some inside knowledge how the
particulars work in Lisp and even Emacs/Elisp.

Everyone that writes it can also combine a bunch of shell
tools, but everyone who can combine a bunch of shell tools
can't write that - many of them can't program at
all, actually.

(defun sort-lines-length (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))
      (sort-subr nil
                 #'forward-line
                 #'end-of-line
                 nil nil
                 (lambda (a b) (> (- (cdr a) (car a))
                                  (- (cdr b) (car b)) ))))))
(defalias 'sll #'sort-lines-length)

-- 
underground experts united
https://dataswamp.org/~incal




reply via email to

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