From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: =?ISO-8859-1?Q?Andreas_R=F6hler?= Newsgroups: gmane.emacs.devel Subject: Re: beginning-of-defun (again) Date: Thu, 29 Oct 2015 18:39:56 +0100 Message-ID: <563259EC.9080409@online.de> References: <56320200.4050503@online.de> <87twp951ug.fsf@gmail.com> <87lhal990p.fsf@fencepost.gnu.org> <87oafhesca.fsf@gmail.com> <874mh9946z.fsf@fencepost.gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit X-Trace: ger.gmane.org 1446140394 26770 80.91.229.3 (29 Oct 2015 17:39:54 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 29 Oct 2015 17:39:54 +0000 (UTC) Cc: Oleh Krehel , emacs-devel@gnu.org To: David Kastrup Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Oct 29 18:39:48 2015 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1ZrrAv-0005bR-O1 for ged-emacs-devel@m.gmane.org; Thu, 29 Oct 2015 18:39:45 +0100 Original-Received: from localhost ([::1]:45586 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZrrAv-0004AB-7V for ged-emacs-devel@m.gmane.org; Thu, 29 Oct 2015 13:39:45 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:51448) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZrrAq-00046O-GR for emacs-devel@gnu.org; Thu, 29 Oct 2015 13:39:42 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZrrAp-0002K1-8C for emacs-devel@gnu.org; Thu, 29 Oct 2015 13:39:40 -0400 Original-Received: from mout.kundenserver.de ([212.227.126.187]:58834) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZrrAj-0002Ir-En; Thu, 29 Oct 2015 13:39:33 -0400 Original-Received: from [192.168.178.31] ([77.12.74.197]) by mrelayeu.kundenserver.de (mreue004) with ESMTPSA (Nemesis) id 0Lxbix-1aXSNE3DzP-017D0E; Thu, 29 Oct 2015 18:39:32 +0100 User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.9) Gecko/20100915 Thunderbird/3.1.4 In-Reply-To: <874mh9946z.fsf@fencepost.gnu.org> X-Provags-ID: V03:K0:Py+KPMYb83eTOnxFinDhZaE8S70JSv9eJe+c0/7Bu16Zkb9BYey Y9X9r32qHKNeQ4eEF1Ptnx0YMmZWr2H82Mlvnjb/SozNWbZQzpSAmTpPjApwQi9PdwNw6ge riXDRPHT0W04/dmxZrXhiaUImsXNUJDjQhZioVznmoiYKnQ4kR1S7+y8YpEvxc5Ji0tjske lkHTSeEeeXIdGlvwz8LgQ== X-UI-Out-Filterresults: notjunk:1;V01:K0:7equxKaW0OA=:WTe5biT9I2siocWFxpX8Uw 369mmhDQ2WevFQyNllhMxCTE+zJU0/IjRE2uigIRdcWHMrD0HYopK5pqGzsFihhqwU1jc24lU vjtVvFd/ePiS4I2qpz5MTNqYTruFUHqZAyOm4ycRSmVPaD2l99ZGsx2hJpKxcBGjB3ioRl8rf 4o/+NeAWcfpBdL6XKL/yjlDwaLTE2nerhcsmc8cmNFK2evStnjM7KluMiIUim7oQOHJlkMViz YMTVf5cjo3UWeyg3NlWEH244sLQH5uNbt+hesMlQDz1SIa7ZphAUkMvVR+LeLQ9kyPlBI4oVu BgrcX1xOwS88uLjzIF2ZMs0vmVSvA87k4U69mNkx+I+VQQ9poZcf/guANsnJ2Ri8PXUmXP1N8 k/52TAusjC5wLeGs47e+rtg1UGYYrFGRr/dMDknoVs7C1SLhKnKEvZNxkb1j0Zg4HVQtJ8I65 HcsR7CyK+Ydib4xLjCqeT5Z5LD7osqjECwPYkGFxChgtRdc95HrzMFeHevMyASS3w6phMEI30 F8fSMZeKwUWHG+Jfnawe1Ugrv4YA+zXb65h+zKvT2/QpWTh24qlKymgyOQXbuxI2XJtEVEZjA 6zYKUZtOsqzS6oHyiOFuPM/kn/FTSq9nyoW3e7W+b3L0HjKzKL/UobGT8KGknuo/jBUKGnJ7T FoUkX4ze82dtA9vNaPxdQBGzsafY4KXNgR14n4IypyQU6Wi+VBsqinMqaQ9G296URyjK+5Oac Saxl9o4vXjvtupux X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 212.227.126.187 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:192918 Archived-At: On 29.10.2015 14:47, David Kastrup wrote: > Oleh Krehel writes: > >> David Kastrup writes: >> >>> Oleh Krehel writes: >>> >>>> Hi Andreas, >>>> >>>> Andreas Röhler 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. > > > 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)) )))) ;;;