From: Emanuel Berg via help-gnu-emacs <help-gnu-emacs@gnu.org>
To: help-gnu-emacs@gnu.org
Subject: Re: Is Elisp really that slow?
Date: Thu, 30 May 2019 14:09:05 +0200 [thread overview]
Message-ID: <86r28g400u.fsf@zoho.eu> (raw)
In-Reply-To: 87imu9p4c1.fsf@telefonica.net
Re: Is Elisp really that slow?
Óscar Fuentes wrote:
> (In my experience, the possibility that
> better things could exist don't cross the
> mind of many users.)
But finding things in Emacs isn't always
so easy. Often I get a feeling, either this
exists already or how come in hell I'm the first
person to think of such a basic thing?
I know about the on-line help (on-line = not on
paper :)), about `info', about `apropos' with
`apropos-command' and `apropos-value' and
all that. Still, when you are in the workflow,
and you don't want to leave it to find the real
deal (which you think, but cannot _know_
already exists) you just write Elisp yourself.
Here are two examples. This one I wrote as
a pretty novice Lisper:
(require 'dired)
(defun su-edit ()
"Edit the current buffer file as superuser."
(interactive)
(let*((window-start (window-start))
(point (point))
(mark (when mark-active (mark)))
(path (or dired-directory
(file-truename (buffer-file-name)) ))
(sudo-path (sudo-root-path path)) )
(find-alternate-file sudo-path)
(when mark (set-mark mark))
(goto-char point)
(when dired-directory (dired-previous-line 1))
(set-window-start nil window-start) ; the selected WINDOW
)) ; [1]
The `sudo-root-path path' is here: [2]
This OTOH I wrote just this week or so:
(defun case-sensitive-regexp-search-and-replace (regexp to-string &optional start stop)
(interactive
`(,(read-from-minibuffer "regexp: ")
,(read-from-minibuffer "replace: ")
,@(if (use-region-p) (list (region-beginning) (region-end))
(list (point-min) (point-max))) ))
(save-excursion
(let ((beg (or start (point-min)))
(end (or stop (point-max))) )
(goto-char beg)
(let ((case-fold-search nil))
(while (re-search-forward regexp end t)
(replace-match to-string t) )))))
(defalias 'cs-replace #'case-sensitive-regexp-search-and-replace) ; [3]
In both "cases" ... :) ... I'm pretty sure
there are canonical ways to do both because
they would seem so fundamental.
As for the quality of the code and possible
bugs, actually I'm more confident with
"su-edit" because I used that so many times,
despite the code doesn't really look good,
than with "cs-replace", having used that only
a few couple of times thus far. But as always,
suggestions/corrections are welcome, even when
the code serves to illustrate a detached
phenomena...
[1] line 64 @ https://dataswamp.org/~incal/emacs-init/edit.el
[2] https://dataswamp.org/~incal/emacs-init/sudo-user-path.el
[3] line 8, same URL as in [1]
--
underground experts united
http://user.it.uu.se/~embe8573
https://dataswamp.org/~incal
next prev parent reply other threads:[~2019-05-30 12:09 UTC|newest]
Thread overview: 298+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-14 23:54 Is Elisp really that slow? Ergus
2019-05-15 11:57 ` Emanuel Berg
2019-05-15 13:06 ` Dmitry Gutov
2019-05-15 13:25 ` Óscar Fuentes
2019-05-15 13:30 ` Dmitry Gutov
2019-05-15 14:18 ` Óscar Fuentes
2019-05-15 14:45 ` Dmitry Gutov
2019-05-15 15:14 ` Óscar Fuentes
2019-05-15 15:39 ` Dmitry Gutov
2019-05-15 15:51 ` Óscar Fuentes
2019-05-15 16:05 ` Óscar Fuentes
2019-05-15 16:07 ` Dmitry Gutov
2019-05-15 16:05 ` Dmitry Gutov
2019-05-15 16:12 ` Óscar Fuentes
2019-05-15 16:15 ` Dmitry Gutov
2019-05-15 20:23 ` Óscar Fuentes
2019-05-15 20:30 ` Dmitry Gutov
2019-05-15 15:42 ` Stefan Monnier
2019-05-15 17:29 ` Drew Adams
2019-05-15 19:38 ` Ergus
2019-05-15 19:53 ` Drew Adams
2019-05-15 20:09 ` Ergus
2019-05-15 23:24 ` Emanuel Berg
2019-05-15 20:46 ` Ergus
2019-05-15 23:30 ` Emanuel Berg
2019-05-15 23:12 ` Emanuel Berg
2019-05-15 19:47 ` Ergus
2019-05-15 19:45 ` Ergus
2019-05-15 15:18 ` Stefan Monnier
2019-05-15 15:34 ` Óscar Fuentes
2019-05-15 15:51 ` Stefan Monnier
2019-05-15 17:30 ` John Yates
2019-05-15 19:29 ` Ergus
2019-05-15 20:15 ` Ergus
2019-05-15 20:21 ` Dmitry Gutov
2019-05-15 20:57 ` Ergus
2019-05-15 21:00 ` Dmitry Gutov
2019-05-15 21:17 ` Ergus
2019-05-17 11:09 ` Dmitry Gutov
2019-05-15 15:07 ` Uniformity (was: Is Elisp really that slow?) Stefan Monnier
2019-05-15 15:24 ` Uniformity Óscar Fuentes
2019-05-15 15:45 ` Uniformity Stefan Monnier
2019-05-15 19:58 ` Uniformity (was: Is Elisp really that slow?) Ergus
2019-05-18 23:51 ` Emanuel Berg
2019-05-15 15:14 ` Is Elisp really that slow? Eli Zaretskii
2019-05-15 15:40 ` Óscar Fuentes
2019-05-15 16:14 ` Eli Zaretskii
2019-05-15 16:23 ` Tadeus Prastowo
2019-05-15 16:27 ` tomas
2019-05-15 17:00 ` Eli Zaretskii
2019-05-15 20:09 ` Óscar Fuentes
2019-05-16 13:12 ` Eli Zaretskii
2019-05-16 13:40 ` Óscar Fuentes
2019-05-16 14:06 ` Eli Zaretskii
2019-05-15 21:09 ` Ergus
2019-05-16 14:12 ` Eli Zaretskii
2019-05-16 16:14 ` Ergus
2019-05-16 17:46 ` Eli Zaretskii
2019-05-16 20:23 ` Ergus
2019-05-16 20:50 ` Óscar Fuentes
2019-05-16 22:46 ` Ergus
2019-05-16 23:19 ` Óscar Fuentes
2019-05-28 21:08 ` Emanuel Berg via help-gnu-emacs
2019-05-28 21:50 ` Drew Adams
2019-05-17 1:28 ` Jean-Christophe Helary
2019-05-17 2:26 ` Óscar Fuentes
2019-05-17 4:05 ` Jean-Christophe Helary
2019-05-17 6:08 ` Ergus
2019-05-17 9:21 ` tomas
2019-05-17 14:01 ` Óscar Fuentes
2019-05-17 14:16 ` Dmitry Gutov
2019-05-17 14:50 ` Óscar Fuentes
2019-05-17 18:19 ` Dmitry Gutov
2019-05-17 19:23 ` Óscar Fuentes
2019-05-17 20:51 ` Dmitry Gutov
2019-05-17 16:37 ` tomas
2019-05-17 16:50 ` Óscar Fuentes
2019-05-17 17:05 ` Óscar Fuentes
2019-05-17 18:11 ` Dmitry Gutov
2019-05-17 18:16 ` Dmitry Gutov
2019-05-17 18:14 ` Dmitry Gutov
2019-05-30 12:09 ` Emanuel Berg via help-gnu-emacs [this message]
2019-06-25 16:48 ` Jean Louis
2019-05-29 4:58 ` Emanuel Berg via help-gnu-emacs
2019-05-17 13:46 ` Óscar Fuentes
2019-05-29 4:26 ` Emanuel Berg via help-gnu-emacs
2019-05-17 5:52 ` Ergus
2019-05-17 9:01 ` Eli Zaretskii
2019-05-17 12:35 ` Ergus
2019-05-17 13:13 ` Eli Zaretskii
2019-05-17 13:22 ` Dmitry Gutov
2019-05-17 13:39 ` Eli Zaretskii
2019-05-17 15:07 ` Óscar Fuentes
2019-05-18 15:41 ` Dmitry Gutov
2019-05-17 15:39 ` Ergus
2019-05-17 15:47 ` Noam Postavsky
2019-05-17 15:48 ` Eli Zaretskii
2019-05-17 19:24 ` Ergus
2019-05-17 20:12 ` Eli Zaretskii
2019-05-19 13:38 ` Ergus
2019-05-19 13:42 ` Noam Postavsky
2019-06-06 3:24 ` Emanuel Berg via help-gnu-emacs
2019-06-05 6:05 ` Emanuel Berg via help-gnu-emacs
2019-06-05 4:44 ` Emanuel Berg via help-gnu-emacs
2019-06-06 21:06 ` Xavier Maillard
2019-06-07 19:01 ` Emanuel Berg via help-gnu-emacs
2019-05-31 15:50 ` Emanuel Berg via help-gnu-emacs
2019-05-31 17:57 ` Eli Zaretskii
2019-06-07 18:46 ` Emanuel Berg via help-gnu-emacs
2019-06-02 10:49 ` Stefan Huchler
2019-06-02 19:16 ` Marcin Borkowski
2019-06-02 22:49 ` Stefan Huchler
2019-06-07 18:55 ` Emanuel Berg via help-gnu-emacs
2019-06-07 18:53 ` Emanuel Berg via help-gnu-emacs
2019-05-17 14:21 ` Óscar Fuentes
2019-05-17 15:02 ` Drew Adams
2019-05-17 16:29 ` Stefan Huchler
2019-05-17 17:19 ` Ergus
2019-06-05 2:29 ` Emanuel Berg via help-gnu-emacs
2019-06-04 22:29 ` Emanuel Berg via help-gnu-emacs
2019-05-30 3:30 ` Emanuel Berg via help-gnu-emacs
2019-05-17 14:12 ` Óscar Fuentes
2019-05-17 8:54 ` Dmitry Gutov
2019-05-17 9:36 ` Eli Zaretskii
2019-05-17 11:09 ` Dmitry Gutov
2019-05-17 12:04 ` Eli Zaretskii
2019-05-17 12:56 ` Ergus
2019-05-17 13:31 ` Eli Zaretskii
2019-05-17 15:03 ` Drew Adams
2019-06-04 1:27 ` Emanuel Berg via help-gnu-emacs
2019-05-31 19:03 ` Emanuel Berg via help-gnu-emacs
2019-06-01 8:17 ` Jean Louis
2019-06-07 18:49 ` Emanuel Berg via help-gnu-emacs
2019-05-17 13:17 ` Dmitry Gutov
2019-05-17 13:35 ` Eli Zaretskii
2019-05-17 13:43 ` Dmitry Gutov
2019-05-17 14:36 ` Eli Zaretskii
2019-05-18 16:54 ` Dmitry Gutov
2019-05-18 17:17 ` Eli Zaretskii
2019-05-18 22:43 ` Dmitry Gutov
2019-05-18 23:54 ` Óscar Fuentes
2019-05-19 0:24 ` 조성빈
2019-05-19 5:24 ` Óscar Fuentes
2019-05-19 15:18 ` Stefan Huchler
2019-05-19 18:40 ` Óscar Fuentes
2019-05-20 6:47 ` tomas
2019-05-20 14:57 ` Drew Adams
2019-05-20 15:28 ` Óscar Fuentes
2019-06-06 5:16 ` Emanuel Berg via help-gnu-emacs
2019-05-21 12:19 ` Van L
2019-05-23 20:01 ` Robert Thorpe
2019-05-23 23:05 ` Stefan Huchler
2019-05-24 14:40 ` Robert Thorpe
2019-05-25 0:07 ` Stefan Huchler
2019-05-25 10:54 ` Robert Thorpe
2019-06-06 6:02 ` Emanuel Berg via help-gnu-emacs
2019-06-06 0:16 ` Emanuel Berg via help-gnu-emacs
2019-06-06 0:08 ` Emanuel Berg via help-gnu-emacs
2019-06-06 0:06 ` Emanuel Berg via help-gnu-emacs
2019-05-19 2:40 ` Eli Zaretskii
2019-05-31 21:04 ` Emanuel Berg via help-gnu-emacs
2019-05-31 15:05 ` Emanuel Berg via help-gnu-emacs
2019-05-17 14:40 ` Óscar Fuentes
2019-06-02 2:00 ` Emanuel Berg via help-gnu-emacs
2019-05-19 18:35 ` Stefan Monnier
2019-05-19 19:23 ` 조성빈
2019-05-20 6:53 ` tomas
2019-06-06 5:03 ` Emanuel Berg via help-gnu-emacs
2019-06-11 13:06 ` Ergus via help-gnu-emacs
2019-06-11 13:37 ` Óscar Fuentes
2019-06-12 1:08 ` Ergus via help-gnu-emacs
2019-05-30 21:30 ` Emanuel Berg via help-gnu-emacs
2019-05-30 21:25 ` Emanuel Berg via help-gnu-emacs
[not found] ` <<20190517055202.ted62gt6hqcip7xt@Ergus>
[not found] ` <<83mujlbgjh.fsf@gnu.org>
2019-05-17 15:03 ` Drew Adams
2019-06-04 1:20 ` Emanuel Berg via help-gnu-emacs
2019-06-04 1:50 ` Emanuel Berg via help-gnu-emacs
2019-05-28 23:16 ` Emanuel Berg via help-gnu-emacs
2019-05-17 9:05 ` tomas
2019-05-28 21:54 ` Emanuel Berg via help-gnu-emacs
2019-05-17 8:47 ` Dmitry Gutov
2019-05-17 15:22 ` Óscar Fuentes
2019-05-17 18:28 ` Dmitry Gutov
2019-05-17 19:55 ` Óscar Fuentes
2019-06-04 1:41 ` Emanuel Berg via help-gnu-emacs
2019-06-04 1:38 ` Emanuel Berg via help-gnu-emacs
2019-06-04 1:37 ` Emanuel Berg via help-gnu-emacs
2019-05-31 3:36 ` Emanuel Berg via help-gnu-emacs
2019-05-17 8:55 ` tomas
2019-05-17 15:02 ` Drew Adams
2019-05-31 4:52 ` Emanuel Berg via help-gnu-emacs
2019-05-27 14:30 ` Emanuel Berg via help-gnu-emacs
2019-05-29 5:02 ` Xavier Maillard
2019-06-07 18:40 ` Emanuel Berg via help-gnu-emacs
2019-05-17 6:24 ` Eli Zaretskii
2019-05-30 17:58 ` Emanuel Berg via help-gnu-emacs
2019-05-25 8:22 ` Emanuel Berg via help-gnu-emacs
2019-05-25 9:05 ` 조성빈 via help-gnu-emacs
2019-05-25 5:14 ` Emanuel Berg via help-gnu-emacs
2019-05-25 4:42 ` Emanuel Berg via help-gnu-emacs
2019-05-25 6:31 ` Eli Zaretskii
2019-06-07 18:34 ` Emanuel Berg via help-gnu-emacs
2019-06-07 20:21 ` Eli Zaretskii
2019-05-19 0:03 ` Emanuel Berg
2019-05-19 8:16 ` Van L
2019-05-19 10:35 ` 조성빈
2019-05-19 12:48 ` Van L
2019-05-19 13:13 ` Ergus
2019-06-06 2:54 ` Emanuel Berg via help-gnu-emacs
2019-05-19 13:00 ` Ergus
2019-05-19 14:57 ` 조성빈
2019-06-06 3:08 ` Emanuel Berg via help-gnu-emacs
2019-05-19 13:05 ` Ergus
2019-05-21 12:00 ` Van L
2019-06-06 3:20 ` Emanuel Berg via help-gnu-emacs
2019-06-06 0:52 ` Emanuel Berg via help-gnu-emacs
2019-06-06 0:53 ` Emanuel Berg via help-gnu-emacs
2019-05-19 14:32 ` Drew Adams
2019-05-21 12:09 ` Van L
2019-06-06 0:43 ` Emanuel Berg via help-gnu-emacs
2019-06-06 2:12 ` Drew Adams
2019-05-23 20:16 ` Robert Thorpe
2019-06-07 18:23 ` Emanuel Berg via help-gnu-emacs
2019-06-08 20:12 ` Robert Thorpe
2019-06-09 13:37 ` Tomas Nordin
2019-06-09 13:50 ` tomas
2019-06-10 22:55 ` Emanuel Berg via help-gnu-emacs
2019-06-12 9:16 ` [offtopic] " Van L
2019-06-12 9:28 ` tomas
2019-06-12 11:31 ` Van L
2019-06-12 11:44 ` tomas
2019-06-14 4:12 ` Xavier Maillard
2019-06-14 7:07 ` tomas
2019-06-12 11:16 ` [offtopic] " Jean-Christophe Helary
2019-06-12 13:28 ` Van L
2019-05-16 23:31 ` Emanuel Berg
-- strict thread matches above, loose matches on Subject: below --
2019-05-16 1:32 Ergus
2019-05-22 7:13 ` Emanuel Berg
2019-05-16 1:19 Ergus
2019-05-20 11:32 ` Emanuel Berg
2019-05-02 21:40 Why is Elisp slow? Ergus
2019-05-02 23:39 ` 조성빈
2019-05-03 0:44 ` Ergus
2019-05-10 13:14 ` Van L
2019-05-10 13:22 ` Michael Heerdegen
2019-05-11 0:38 ` Emanuel Berg
2019-05-11 7:32 ` Is Elisp really that slow? (was: Why is Elisp slow?) tomas
2019-05-11 7:42 ` 조성빈
2019-05-11 7:57 ` tomas
2019-05-11 23:09 ` Emanuel Berg
2019-05-12 7:54 ` tomas
2019-05-12 9:46 ` 조성빈
2019-05-12 14:21 ` Eli Zaretskii
2019-05-12 14:45 ` Is Elisp really that slow? Óscar Fuentes
2019-05-12 15:28 ` Eli Zaretskii
2019-05-12 15:46 ` Óscar Fuentes
2019-05-12 17:20 ` Eli Zaretskii
2019-05-12 18:37 ` Óscar Fuentes
2019-05-12 18:53 ` Eli Zaretskii
2019-05-13 1:44 ` Emanuel Berg
2019-05-12 21:18 ` Stefan Monnier
2019-05-12 22:22 ` Óscar Fuentes
2019-05-14 13:39 ` Stefan Monnier
2019-05-14 15:09 ` Óscar Fuentes
2019-05-13 0:57 ` Samuel Wales
2019-05-13 12:37 ` Stefan Monnier
2019-05-13 14:23 ` Emanuel Berg
2019-05-13 14:33 ` Emanuel Berg
2019-05-14 8:24 ` tomas
2019-05-14 13:21 ` Emanuel Berg
2019-05-14 14:44 ` tomas
2019-05-15 11:25 ` Emanuel Berg
2019-05-15 12:05 ` tomas
2019-05-15 23:02 ` Emanuel Berg
2019-05-16 6:48 ` tomas
2019-05-16 9:37 ` Noam Postavsky
2019-05-16 11:02 ` tomas
2019-05-23 14:23 ` Emanuel Berg
2019-05-24 1:33 ` Van L
2019-05-16 13:31 ` Eli Zaretskii
2019-05-23 14:28 ` Emanuel Berg
2019-05-23 14:54 ` Drew Adams
2019-05-23 14:55 ` Eli Zaretskii
2019-06-06 5:18 ` Emanuel Berg via help-gnu-emacs
2019-05-16 14:45 ` Stefan Monnier
2019-05-25 4:53 ` Emanuel Berg via help-gnu-emacs
2019-05-13 1:52 ` Emanuel Berg
2019-05-13 1:35 ` Emanuel Berg
2019-05-12 21:01 ` Stefan Monnier
2019-05-13 1:27 ` Emanuel Berg
2019-05-13 14:38 ` Eli Zaretskii
2019-05-13 15:00 ` Emanuel Berg
2019-05-13 15:25 ` Eli Zaretskii
2019-05-14 11:54 ` Emanuel Berg
2019-05-14 16:21 ` Eli Zaretskii
2019-05-14 17:05 ` Emanuel Berg
2019-05-14 18:30 ` Eli Zaretskii
2019-05-15 11:27 ` Emanuel Berg
2019-05-15 14:51 ` Eli Zaretskii
2019-05-16 23:19 ` Emanuel Berg
2019-05-17 6:41 ` Eli Zaretskii
2019-05-13 15:02 ` John Yates
2019-05-13 15:14 ` Eli Zaretskii
2019-05-13 22:40 ` Dmitry Gutov
2019-05-14 6:27 ` Paul W. Rankin
2019-05-14 13:10 ` Emanuel Berg
2019-05-13 15:42 ` Van L
2019-05-17 15:17 ` Ken Goldman
2019-06-04 1:36 ` Emanuel Berg via help-gnu-emacs
2019-06-08 0:26 ` Is Elisp really that slow? (was: Why is Elisp slow?) Samuel Wales
2019-06-08 8:52 ` tomas
2019-06-08 21:00 ` Samuel Wales
2019-06-08 21:14 ` tomas
2019-06-08 21:44 ` Is Elisp really that slow? Óscar Fuentes
2019-06-08 23:29 ` Emanuel Berg via help-gnu-emacs
2019-06-11 4:10 ` Xavier Maillard
[not found] <<878sv7sp3r.fsf@telefonica.net>
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=86r28g400u.fsf@zoho.eu \
--to=help-gnu-emacs@gnu.org \
--cc=moasenwood@zoho.eu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).