all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Andreas Röhler" <andreas.roehler@online.de>
To: David Kastrup <dak@gnu.org>
Cc: Oleh Krehel <ohwoeowho@gmail.com>, emacs-devel@gnu.org
Subject: Re: beginning-of-defun (again)
Date: Thu, 29 Oct 2015 18:39:56 +0100	[thread overview]
Message-ID: <563259EC.9080409@online.de> (raw)
In-Reply-To: <874mh9946z.fsf@fencepost.gnu.org>

  On 29.10.2015 14:47, David Kastrup wrote:
> Oleh Krehel<ohwoeowho@gmail.com>  writes:
>
>> David Kastrup<dak@gnu.org>  writes:
>>
>>> Oleh Krehel<ohwoeowho@gmail.com>  writes:
>>>
>>>> Hi Andreas,
>>>>
>>>> Andreas Röhler<andreas.roehler@online.de>  writes:
>>>>
>>>>> maybe it's time to have a reasonable default-behavior of
>>>>> beginning-of-defun in Emacs Lisp.
>>>> I think it works pretty well as is.
>>>>
>>>>> open-paren-in-column-0-is-defun-start
>>>> It's a strange variable that doesn't seem to do anything.
>>> Huh?
>> Please give an example then. I'm not able to see a difference when it's
>> unset.
> <URL:http://git.savannah.gnu.org/cgit/lilypond.git/commit/scm/define-grob-properties.scm?id=51172615f31aa2af30c0343b92f1cc372ef0ce91>
>
> This is a Scheme file containing a large structure with multiline
> strings.  Occasionally when working with this file, I have to reformat
> strings which happened to have "(" after a newline after other people
> worked on the file, in order to keep Emacs from misinterpreting the
> context.  Such misinterpretation looks ugly in fontification and is a
> real nuisance if you want to add several lines of new material and have
> Emacs indent it since Emacs will not indent within "strings" (and when
> it lost count of "..." pairs, that means everywhere where you'd want
> it).
>

Below some benchmarks - don't know how to read the results BTW, it took 
several seconds each.
No idea WRT diff between two test rows.

In any case didn't feel a significant diff between pps-based un-compiled 
approach considered reliable and the built-in.
GNU Emacs 24.4.1 (i586-pc-linux-gnu, GTK+ Version 3.14.5) of 2015-03-07 
on binet, modified by Debian

ar-beginning-of-defun is available here:
http://bazaar.launchpad.net/~a-roehler/s-x-emacs-werkstatt/trunk/view/head:/gnu-emacs-fixes.el

;;;;;;;;;;

(bod-test 'ar-beginning-of-defun 99999)"Elapsed time: 0.001541s"
(bod-test 'ar-beginning-of-defun 99999)"Elapsed time: 0.001197s"
(bod-test 'ar-beginning-of-defun 99999)"Elapsed time: 0.001845s"
(bod-test 'ar-beginning-of-defun 99999)"Elapsed time: 0.001326s"

(bod-test 'beginning-of-defun 99999)"Elapsed time: 0.002036s"
(bod-test 'beginning-of-defun 99999)"Elapsed time: 0.001215s"
(bod-test 'beginning-of-defun 99999)"Elapsed time: 0.001478s"
(bod-test 'beginning-of-defun 99999)"Elapsed time: 0.001699s"

;;;; tests some times later

(bod-test 'ar-beginning-of-defun 99999)"Elapsed time: 0.003947s"
(bod-test 'ar-beginning-of-defun 99999)"Elapsed time: 0.008513s"
(bod-test 'ar-beginning-of-defun 99999)"Elapsed time: 0.004473s"
(bod-test 'ar-beginning-of-defun 99999)"Elapsed time: 0.004457s"

(bod-test 'beginning-of-defun 99999)"Elapsed time: 0.004883s"
(bod-test 'beginning-of-defun 99999)"Elapsed time: 0.004741s"
(bod-test 'beginning-of-defun 99999)"Elapsed time: 0.004179s"
(bod-test 'beginning-of-defun 99999)"Elapsed time: 0.004660s"

;;;;;;;;;;

(defun bod-test (func repeat)
   (interactive)
   (let ((undo-outer-limit 999999999))
     (set-buffer (get-buffer-create (concat (prin1-to-string func) 
"-bm-test")))
     (erase-buffer)
     (dotimes (i repeat) (insert "(defun foo1 (&optional beg end)
   \" \"
   (interactive \"\*\")
   (let ((beg (cond (beg)
                    ((use-region-p)
                     (region-beginning))
                    (t (point-min))))
         (end (cond (end (copy-marker end))
                    ((use-region-p)
                     (copy-marker (region-end)))
                    (t (copy-marker (point-max))))))
     (save-excursion
       (goto-char beg))
     (when (interactive-p) (message \"%s %s\" beg end))))
"))
     (benchmark repeat
            (progn
          (beginning-of-line)
          (funcall func)
          ;; (message "%s" (point))
      ))))

;;;



  reply	other threads:[~2015-10-29 17:39 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-29 11:24 beginning-of-defun (again) Andreas Röhler
2015-10-29 11:52 ` Oleh Krehel
2015-10-29 12:03   ` David Kastrup
2015-10-29 13:07     ` Oleh Krehel
2015-10-29 13:28       ` David Kastrup
2015-10-29 13:47       ` David Kastrup
2015-10-29 17:39         ` Andreas Röhler [this message]
2015-10-29 12:11   ` Andreas Röhler
2015-10-29 12:16     ` Kaushal Modi
2015-10-29 17:56   ` John Wiegley
2015-10-30  1:35     ` Richard Stallman
2015-10-30  2:20       ` John Wiegley
2015-10-30  9:29         ` Oleh Krehel
2015-10-30 18:17           ` John Wiegley
2015-10-30 23:13         ` Richard Stallman
2015-10-30 23:29           ` Alan Mackenzie
2015-10-30 23:34             ` John Wiegley
2015-11-01  1:05             ` Richard Stallman
2015-10-29 12:46 ` Alan Mackenzie
2015-10-29 12:56   ` Andreas Röhler
2015-10-29 13:31     ` David Kastrup
2015-10-29 14:46       ` Andreas Röhler
2015-10-29 14:57         ` David Kastrup
2015-10-29 14:14     ` Alan Mackenzie
2015-10-30  1:34 ` Richard Stallman
2015-10-30  6:47   ` Andreas Röhler
2015-10-30 23:14     ` Richard Stallman
2015-10-31  8:01       ` Andreas Röhler
2015-10-31 12:24         ` David Kastrup
2015-10-31 15:55           ` Andreas Röhler
2015-11-01  1:06         ` Richard Stallman

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=563259EC.9080409@online.de \
    --to=andreas.roehler@online.de \
    --cc=dak@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=ohwoeowho@gmail.com \
    /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.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.