all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* slow bibtex menu access
@ 2005-03-01  1:25 Sebastian Luque
  0 siblings, 0 replies; 15+ messages in thread
From: Sebastian Luque @ 2005-03-01  1:25 UTC (permalink / raw)


Clicking on any item in my bibtex menu while editing *.bib files is taking
outrageously long times on my system:

GNU Emacs 21.3.1 (i386-pc-linux-gnu, X toolkit, Xaw3d scroll bars) of
2005-02-03 on trouble, modified by Debian

I've tried setting bibtex-maintain-sorted-entries to t and nil, but it
doesn't make a difference. It seems to be related to the size of the file,
as when I edit a blank or a few-entries long *.bib there's no problem. My
main reference file is 23,761 lines and that's when the menu is pretty
much unuseable. Does somebody know how to get around this?

Thanks,
-- 
Sebastian Luque

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: slow bibtex menu access
       [not found] <mailman.2117.1109641717.32256.help-gnu-emacs@gnu.org>
@ 2005-03-01 12:19 ` Roland Winkler
  2005-03-01 14:06   ` Sebastian Luque
       [not found]   ` <mailman.2167.1109686744.32256.help-gnu-emacs@gnu.org>
  2005-03-02 13:08 ` Stefan Monnier
  1 sibling, 2 replies; 15+ messages in thread
From: Roland Winkler @ 2005-03-01 12:19 UTC (permalink / raw)


Sebastian Luque <sluque@mun.ca> writes:

> Clicking on any item in my bibtex menu while editing *.bib files is taking
> outrageously long times on my system:

What do you want to do when "clicking on any item in my bibtex
menu"?

> GNU Emacs 21.3.1 (i386-pc-linux-gnu, X toolkit, Xaw3d scroll bars) of
> 2005-02-03 on trouble, modified by Debian
>
> I've tried setting bibtex-maintain-sorted-entries to t and nil, but it
> doesn't make a difference. It seems to be related to the size of the file,
> as when I edit a blank or a few-entries long *.bib there's no problem. My
> main reference file is 23,761 lines and that's when the menu is pretty
> much unuseable. Does somebody know how to get around this?

bibtex.el has been rewritten extensively. You might want to try the
CVS version. (However, this requires CVS emacs.)

Roland

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: slow bibtex menu access
  2005-03-01 12:19 ` slow bibtex menu access Roland Winkler
@ 2005-03-01 14:06   ` Sebastian Luque
  2005-03-01 14:31     ` Sebastian Luque
       [not found]   ` <mailman.2167.1109686744.32256.help-gnu-emacs@gnu.org>
  1 sibling, 1 reply; 15+ messages in thread
From: Sebastian Luque @ 2005-03-01 14:06 UTC (permalink / raw)


On Tue, 01 Mar 2005 13:19:50 +0100,
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de> wrote:

[...]

> What do you want to do when "clicking on any item in my bibtex
> menu"?

Anything, really, and now I've realized that it doesn't really affect the
bibtex menu, but any menu. Simply clicking on the menu bar hangs all of
Emacs for 30-60 s. Last night I realized the time increases according to
the line the cursor is on (no problems in the first few hundred lines).
Looks like a memory issue.


>> GNU Emacs 21.3.1 (i386-pc-linux-gnu, X toolkit, Xaw3d scroll bars) of
>> 2005-02-03 on trouble, modified by Debian
>>
>> I've tried setting bibtex-maintain-sorted-entries to t and nil, but it
>> doesn't make a difference. It seems to be related to the size of the
>> file, as when I edit a blank or a few-entries long *.bib there's no
>> problem. My main reference file is 23,761 lines and that's when the
>> menu is pretty much unuseable. Does somebody know how to get around
>> this?
>
> bibtex.el has been rewritten extensively. You might want to try the
> CVS version. (However, this requires CVS emacs.)

Excuse my ignorance, what is CVS Emacs? I've heard the term before, but
that's about it. OTOH, is that bibtex.el planned for the next regular
Emacs release? if so, does anybody know when that will happen?

Thank you,

-- 
Sebastian Luque

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: slow bibtex menu access
  2005-03-01 14:06   ` Sebastian Luque
@ 2005-03-01 14:31     ` Sebastian Luque
  0 siblings, 0 replies; 15+ messages in thread
From: Sebastian Luque @ 2005-03-01 14:31 UTC (permalink / raw)


Sebastian Luque <sluque@mun.ca> wrote:

[...]

> Anything, really, and now I've realized that it doesn't really affect
> the bibtex menu, but any menu.

Sorry, I meant "...*only* affect the bibtex menu, but any menu." here

-- 
Sebastian Luque

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: slow bibtex menu access
       [not found]   ` <mailman.2167.1109686744.32256.help-gnu-emacs@gnu.org>
@ 2005-03-01 14:44     ` Roland.Winkler
  2005-03-01 16:36       ` Sebastian Luque
       [not found]       ` <mailman.2198.1109696777.32256.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 15+ messages in thread
From: Roland.Winkler @ 2005-03-01 14:44 UTC (permalink / raw)


Sebastian Luque <sluque@mun.ca> writes:

> On Tue, 01 Mar 2005 13:19:50 +0100,
> Roland Winkler <Roland.Winkler@physik.uni-erlangen.de> wrote:
>> What do you want to do when "clicking on any item in my bibtex
>> menu"?
>
> Anything, really, and now I've realized that it doesn't really affect the
> bibtex menu, but any menu. Simply clicking on the menu bar hangs all of
> Emacs for 30-60 s. Last night I realized the time increases according to
> the line the cursor is on (no problems in the first few hundred lines).
> Looks like a memory issue.

That's strange. I never have had any such problem. (My largest bib
file has ~6000 lines.)

> > Anything, really, and now I've realized that it doesn't really affect
> > the bibtex menu, but any menu.
> 
> Sorry, I meant "...*only* affect the bibtex menu, but any menu."
> here

...still strange. I've never noticed anything like that.
 
> Excuse my ignorance, what is CVS Emacs? I've heard the term before, but
> that's about it. 

Take a look at

http://savannah.gnu.org/projects/emacs/

> OTOH, is that bibtex.el planned for the next regular Emacs
> release? if so, does anybody know when that will happen?

It'll be part of the next release, but I don't know when it will
appear.

Roland

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: slow bibtex menu access
  2005-03-01 14:44     ` Roland.Winkler
@ 2005-03-01 16:36       ` Sebastian Luque
       [not found]       ` <mailman.2198.1109696777.32256.help-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 15+ messages in thread
From: Sebastian Luque @ 2005-03-01 16:36 UTC (permalink / raw)


Roland.Winkler@physik.uni-erlangen.de wrote:

[...]

> That's strange. I never have had any such problem. (My largest bib
> file has ~6000 lines.)

The one I'm working on has ~23,000 lines, but I don't know if that would
make a difference in your system too. I'll do some tests with different
sized *.bib and see what happens.


[...]

> Take a look at
>
> http://savannah.gnu.org/projects/emacs/

Thanks,

-- 
Sebastian Luque

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: slow bibtex menu access
       [not found]       ` <mailman.2198.1109696777.32256.help-gnu-emacs@gnu.org>
@ 2005-03-01 22:13         ` Jochen Küpper
  0 siblings, 0 replies; 15+ messages in thread
From: Jochen Küpper @ 2005-03-01 22:13 UTC (permalink / raw)



[-- Attachment #1.1: Type: text/plain, Size: 566 bytes --]

Sebastian Luque <sluque-by2PdLBuqAc@public.gmane.org> writes:

> The one I'm working on has ~23,000 lines, but I don't know if that
> would make a difference in your system too. I'll do some tests with
> different sized *.bib and see what happens.

I've a >16000 line bib-file here, no problem whatsoever (GNU Emacs
21.3.1)

Greetings,
Jochen
-- 
Einigkeit und Recht und Freiheit                http://www.Jochen-Kuepper.de
    Liberté, Égalité, Fraternité                GnuPG key: CC1B0B4D
        (Part 3 you find in my messages before fall 2003.)

[-- Attachment #1.2: Type: application/pgp-signature, Size: 188 bytes --]

[-- Attachment #2: Type: text/plain, Size: 173 bytes --]

_______________________________________________
Help-gnu-emacs mailing list
Help-gnu-emacs-mXXj517/zsQ@public.gmane.org
http://lists.gnu.org/mailman/listinfo/help-gnu-emacs

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: slow bibtex menu access
       [not found] <mailman.2117.1109641717.32256.help-gnu-emacs@gnu.org>
  2005-03-01 12:19 ` slow bibtex menu access Roland Winkler
@ 2005-03-02 13:08 ` Stefan Monnier
  2005-03-02 19:47   ` Sebastian Luque
       [not found]   ` <mailman.2371.1109793933.32256.help-gnu-emacs@gnu.org>
  1 sibling, 2 replies; 15+ messages in thread
From: Stefan Monnier @ 2005-03-02 13:08 UTC (permalink / raw)


> Clicking on any item in my bibtex menu while editing *.bib files is taking
> outrageously long times on my system:

Have you tried with "emacs -q"?
My crystal ball is pretty fuzzy but it mumbled something about you maybe
adding an index menu (imenu) to the menu bar and setting imenu-auto-rescan.


        Stefan

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: slow bibtex menu access
  2005-03-02 13:08 ` Stefan Monnier
@ 2005-03-02 19:47   ` Sebastian Luque
       [not found]   ` <mailman.2371.1109793933.32256.help-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 15+ messages in thread
From: Sebastian Luque @ 2005-03-02 19:47 UTC (permalink / raw)



[...]

> Have you tried with "emacs -q"? My crystal ball is pretty fuzzy but it
> mumbled something about you maybe adding an index menu (imenu) to the
> menu bar and setting imenu-auto-rescan.

Not bad! With emacs -q normal bibtex menu-bar functionality was restored.
I do have the index menu enabled, but only for lisp mode buffers; from my
~/.emacs:

(add-hook 'emacs-lisp-mode-hook (quote (turn-on-eldoc-mode imenu-add-menubar-index
 checkdoc-minor-mode)))

(add-hook 'lisp-mode-hook 'imenu-add-menubar-index)


and imenu-auto-rescan is nil. I tried disabling the hooks above anyway
hoping for magic, but clicking the menu-bar while on a large bibtex buffer
is still getting slower with incresing (line-number-at-pos)

Great idea anyway!

-- 
Sebastian Luque

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: slow bibtex menu access
       [not found]   ` <mailman.2371.1109793933.32256.help-gnu-emacs@gnu.org>
@ 2005-03-03  4:04     ` Chong Yidong
  2005-03-03 16:18       ` Sebastian Luque
       [not found]       ` <mailman.2485.1109868847.32256.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 15+ messages in thread
From: Chong Yidong @ 2005-03-03  4:04 UTC (permalink / raw)


> > Have you tried with "emacs -q"? My crystal ball is pretty fuzzy but it
> > mumbled something about you maybe adding an index menu (imenu) to the
> > menu bar and setting imenu-auto-rescan.
> 
> Not bad! With emacs -q normal bibtex menu-bar functionality was restored.
> ...
> and imenu-auto-rescan is nil. I tried disabling the hooks above anyway
> hoping for magic, but clicking the menu-bar while on a large bibtex buffer
> is still getting slower with incresing (line-number-at-pos)

If emacs -q gets rid of the problem, the easiest way to proceed is to
find out which part of your .emacs is to blame. You should comment out
the whole file, then uncomment a few pieces at a time and test again,
trying to spot the point where the problem comes back.

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: slow bibtex menu access
  2005-03-03  4:04     ` Chong Yidong
@ 2005-03-03 16:18       ` Sebastian Luque
       [not found]       ` <mailman.2485.1109868847.32256.help-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 15+ messages in thread
From: Sebastian Luque @ 2005-03-03 16:18 UTC (permalink / raw)


Chong Yidong <cyd@physics.stanford.edu> wrote:

[...]

> If emacs -q gets rid of the problem, the easiest way to proceed is to
> find out which part of your .emacs is to blame. You should comment out
> the whole file, then uncomment a few pieces at a time and test again,
> trying to spot the point where the problem comes back.

Thank you, I'd forgotten that (haven't done it in a long time). So I found
the problem, and it was table.el. I had (require 'table) and (require
'emacs-wiki-table) (the latter requires table.el) in a few places. I have
no idea where and how table.el is causing the problem, but would it be
possible to turn it off (I guess a hook might do it) while in bibtex?
Tables are not needed in bibtex anyway.

Thanks for your help,
-- 
Sebastian Luque

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: slow bibtex menu access
       [not found]       ` <mailman.2485.1109868847.32256.help-gnu-emacs@gnu.org>
@ 2005-03-05 21:27         ` Stefan Monnier
  2005-03-08 22:56           ` Tak Ota
  0 siblings, 1 reply; 15+ messages in thread
From: Stefan Monnier @ 2005-03-05 21:27 UTC (permalink / raw)


> Thank you, I'd forgotten that (haven't done it in a long time). So I found
> the problem, and it was table.el. I had (require 'table) and (require
> 'emacs-wiki-table) (the latter requires table.el) in a few places. I have
> no idea where and how table.el is causing the problem, but would it be
> possible to turn it off (I guess a hook might do it) while in bibtex?
> Tables are not needed in bibtex anyway.

Setting debug-on-quit and hitting C-g while the menu is being built
indicates that the time is actually spent in table--find-row-column.

Looking some more at the table.el code, it seems there is a minor
logic-thinko bug in it.  Can you try the patch below (it's against the
Emacs-CVS version of table.el, so you may have to apply the patch by hand).

Tak, is my reasoning correct that `table--probe-cell' should return non-nil
iff we're inside a table?


        Stefan


--- orig/lisp/textmodes/table.el
+++ mod/lisp/textmodes/table.el
@@ -1025,13 +1025,13 @@
       :help "Insert a text based table at point"]
      ["Row" table-insert-row
       :active (and (not buffer-read-only)
-		   (or (table--probe-cell)
+		   (and (table--probe-cell)
 		       (save-excursion
 			 (table--find-row-column nil t))))
       :help "Insert row(s) of cells in table"]
      ["Column" table-insert-column
       :active (and (not buffer-read-only)
-		   (or (table--probe-cell)
+		   (and (table--probe-cell)
 		       (save-excursion
 			 (table--find-row-column 'column t))))
       :help "Insert column(s) of cells in table"])
@@ -1077,13 +1077,13 @@
     ("Insert"
      ["Row" table-insert-row
       :active (and (not buffer-read-only)
-		   (or (table--probe-cell)
+		   (and (table--probe-cell)
 		       (save-excursion
 			 (table--find-row-column nil t))))
       :help "Insert row(s) of cells in table"]
      ["Column" table-insert-column
       :active (and (not buffer-read-only)
-		   (or (table--probe-cell)
+		   (and (table--probe-cell)
 		       (save-excursion
 			 (table--find-row-column 'column t))))
       :help "Insert column(s) of cells in table"])

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: slow bibtex menu access
  2005-03-05 21:27         ` Stefan Monnier
@ 2005-03-08 22:56           ` Tak Ota
  2005-03-14 17:15             ` Tak Ota
  0 siblings, 1 reply; 15+ messages in thread
From: Tak Ota @ 2005-03-08 22:56 UTC (permalink / raw)
  Cc: monnier

[-- Attachment #1: Type: Text/Plain, Size: 2970 bytes --]

Stefan kindly informed me that table.el was slowing down menu
operation considerably depending on buffer contents.  The attached
patch corrects this problem.  Thanks Stefan.

-Tak

2005-03-08  Takaaki Ota  <Takaaki.Ota@am.sony.com>

	* textmodes/table.el (table--line-column-position): New idiom.
	(table--row-column-insertion-point-p): New function to test
	validity of row and column insertion operation at a location.
	(table-global-menu, table-cell-menu): Use above functions for
	deterministic test operation.
	(table--editable-cell-p): Behave in deterministic fashion.


Sat, 5 Mar 2005 13:27:00 -0800: "Stefan Monnier" <monnier@iro.umontreal.ca> wrote:

> The following message is a courtesy copy of an article
> that has been posted to gnu.emacs.help as well.
> 
> > Thank you, I'd forgotten that (haven't done it in a long time). So I
> found
> > the problem, and it was table.el. I had (require 'table) and (require
> > 'emacs-wiki-table) (the latter requires table.el) in a few places. I
> have
> > no idea where and how table.el is causing the problem, but would it be
> > possible to turn it off (I guess a hook might do it) while in bibtex?
> > Tables are not needed in bibtex anyway.
> 
> Setting debug-on-quit and hitting C-g while the menu is being built
> indicates that the time is actually spent in table--find-row-column.
> 
> Looking some more at the table.el code, it seems there is a minor
> logic-thinko bug in it.  Can you try the patch below (it's against the
> Emacs-CVS version of table.el, so you may have to apply the patch by
> hand).
> 
> Tak, is my reasoning correct that `table--probe-cell' should return
> non-nil
> iff we're inside a table?
> 
> 
>         Stefan
> 
> 
> --- orig/lisp/textmodes/table.el
> +++ mod/lisp/textmodes/table.el
> @@ -1025,13 +1025,13 @@
>        :help "Insert a text based table at point"]
>       ["Row" table-insert-row
>        :active (and (not buffer-read-only)
> -		   (or (table--probe-cell)
> +		   (and (table--probe-cell)
>  		       (save-excursion
>  			 (table--find-row-column nil t))))
>        :help "Insert row(s) of cells in table"]
>       ["Column" table-insert-column
>        :active (and (not buffer-read-only)
> -		   (or (table--probe-cell)
> +		   (and (table--probe-cell)
>  		       (save-excursion
>  			 (table--find-row-column 'column t))))
>        :help "Insert column(s) of cells in table"])
> @@ -1077,13 +1077,13 @@
>      ("Insert"
>       ["Row" table-insert-row
>        :active (and (not buffer-read-only)
> -		   (or (table--probe-cell)
> +		   (and (table--probe-cell)
>  		       (save-excursion
>  			 (table--find-row-column nil t))))
>        :help "Insert row(s) of cells in table"]
>       ["Column" table-insert-column
>        :active (and (not buffer-read-only)
> -		   (or (table--probe-cell)
> +		   (and (table--probe-cell)
>  		       (save-excursion
>  			 (table--find-row-column 'column t))))
>        :help "Insert column(s) of cells in table"])

[-- Attachment #2: table.el.patch --]
[-- Type: Text/Plain, Size: 4477 bytes --]

*** ../../../../d/pub/emacs/pure/emacs-21.3.50/lisp/textmodes/table.el	Wed Feb  9 07:50:36 2005
--- table.el	Tue Mar  8 11:15:27 2005
***************
*** 5,11 ****
  ;; Keywords: wp, convenience
  ;; Author: Takaaki Ota <Takaaki.Ota@am.sony.com>
  ;; Created: Sat Jul 08 2000 13:28:45 (PST)
! ;; Revised: Tue Jun 01 2004 11:36:39 (PDT)
  
  ;; This file is part of GNU Emacs.
  
--- 5,11 ----
  ;; Keywords: wp, convenience
  ;; Author: Takaaki Ota <Takaaki.Ota@am.sony.com>
  ;; Created: Sat Jul 08 2000 13:28:45 (PST)
! ;; Revised: Tue Mar 08 2005 11:15:27 (PST)
  
  ;; This file is part of GNU Emacs.
  
***************
*** 1024,1039 ****
        :active (and (not buffer-read-only) (not (table--probe-cell)))
        :help "Insert a text based table at point"]
       ["Row" table-insert-row
!       :active (and (not buffer-read-only)
! 		   (or (table--probe-cell)
! 		       (save-excursion
! 			 (table--find-row-column nil t))))
        :help "Insert row(s) of cells in table"]
       ["Column" table-insert-column
!       :active (and (not buffer-read-only)
! 		   (or (table--probe-cell)
! 		       (save-excursion
! 			 (table--find-row-column 'column t))))
        :help "Insert column(s) of cells in table"])
      "----"
      ("Recognize"
--- 1024,1033 ----
        :active (and (not buffer-read-only) (not (table--probe-cell)))
        :help "Insert a text based table at point"]
       ["Row" table-insert-row
!       :active (table--row-column-insertion-point-p)
        :help "Insert row(s) of cells in table"]
       ["Column" table-insert-column
!       :active (table--row-column-insertion-point-p 'column)
        :help "Insert column(s) of cells in table"])
      "----"
      ("Recognize"
***************
*** 1076,1091 ****
    '("Table"
      ("Insert"
       ["Row" table-insert-row
!       :active (and (not buffer-read-only)
! 		   (or (table--probe-cell)
! 		       (save-excursion
! 			 (table--find-row-column nil t))))
        :help "Insert row(s) of cells in table"]
       ["Column" table-insert-column
!       :active (and (not buffer-read-only)
! 		   (or (table--probe-cell)
! 		       (save-excursion
! 			 (table--find-row-column 'column t))))
        :help "Insert column(s) of cells in table"])
      ("Delete"
       ["Row" table-delete-row
--- 1070,1079 ----
    '("Table"
      ("Insert"
       ["Row" table-insert-row
!       :active (table--row-column-insertion-point-p)
        :help "Insert row(s) of cells in table"]
       ["Column" table-insert-column
!       :active (table--row-column-insertion-point-p 'column)
        :help "Insert column(s) of cells in table"])
      ("Delete"
       ["Row" table-delete-row
***************
*** 4698,4703 ****
--- 4686,4715 ----
        (setq multiplier (1- multiplier)))
      ret-str))
  
+ (defun table--line-column-position (line column)
+   "Return the location of LINE forward at COLUMN."
+   (save-excursion
+     (forward-line line)
+     (move-to-column column)
+     (point)))
+ 
+ (defun table--row-column-insertion-point-p (&optional columnp)
+   "Return non nil if it makes sense to insert a row or a column at point."
+   (and (not buffer-read-only)
+        (or (get-text-property (point) 'table-cell)
+ 	   (let ((column (current-column)))
+ 	     (if columnp
+ 		 (or (text-property-any (line-beginning-position 0)
+ 					(table--line-column-position -1 column)
+ 					'table-cell t)
+ 		     (text-property-any (line-beginning-position) (point) 'table-cell t)
+ 		     (text-property-any (line-beginning-position 2)
+ 					(table--line-column-position 1 column)
+ 					'table-cell t))
+ 	       (text-property-any (table--line-column-position -2 column)
+ 				  (table--line-column-position -2 (+ 2 column))
+ 				  'table-cell t))))))
+ 
  (defun table--find-row-column (&optional columnp no-error)
    "Search table and return a cell coordinate list of row or column."
    (let ((current-coordinate (table--get-coordinate)))
***************
*** 5136,5142 ****
  
  (defun table--editable-cell-p (&optional abort-on-error)
    (and (not buffer-read-only)
!        (table--probe-cell abort-on-error)))
  
  (defun table--probe-cell (&optional abort-on-error)
    "Probes a table cell around the point.
--- 5148,5154 ----
  
  (defun table--editable-cell-p (&optional abort-on-error)
    (and (not buffer-read-only)
!        (get-text-property (point) 'table-cell)))
  
  (defun table--probe-cell (&optional abort-on-error)
    "Probes a table cell around the point.

[-- Attachment #3: Type: text/plain, Size: 142 bytes --]

_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: slow bibtex menu access
  2005-03-08 22:56           ` Tak Ota
@ 2005-03-14 17:15             ` Tak Ota
  2005-03-18 22:07               ` Tak Ota
  0 siblings, 1 reply; 15+ messages in thread
From: Tak Ota @ 2005-03-14 17:15 UTC (permalink / raw)


[-- Attachment #1: Type: Text/Plain, Size: 3324 bytes --]

If there is no objection to this patch could someone check it in
please.  Thank you.

-Tak

Tue, 8 Mar 2005 14:56:51 -0800: "Ota, Takaaki" <Takaaki.Ota@us-ti-xims-1.am.sony.com> wrote:

> Stefan kindly informed me that table.el was slowing down menu
> operation considerably depending on buffer contents.  The attached
> patch corrects this problem.  Thanks Stefan.
> 
> -Tak
> 
> 2005-03-08  Takaaki Ota  <Takaaki.Ota@am.sony.com>
> 
> 	* textmodes/table.el (table--line-column-position): New idiom.
> 	(table--row-column-insertion-point-p): New function to test
> 	validity of row and column insertion operation at a location.
> 	(table-global-menu, table-cell-menu): Use above functions for
> 	deterministic test operation.
> 	(table--editable-cell-p): Behave in deterministic fashion.
> 
> 
> Sat, 5 Mar 2005 13:27:00 -0800: "Stefan Monnier"
> <monnier@iro.umontreal.ca> wrote:
> 
> > The following message is a courtesy copy of an article
> > that has been posted to gnu.emacs.help as well.
> > 
> > > Thank you, I'd forgotten that (haven't done it in a long time). So I
> > found
> > > the problem, and it was table.el. I had (require 'table) and
> (require
> > > 'emacs-wiki-table) (the latter requires table.el) in a few places. I
> > have
> > > no idea where and how table.el is causing the problem, but would it
> be
> > > possible to turn it off (I guess a hook might do it) while in
> bibtex?
> > > Tables are not needed in bibtex anyway.
> > 
> > Setting debug-on-quit and hitting C-g while the menu is being built
> > indicates that the time is actually spent in table--find-row-column.
> > 
> > Looking some more at the table.el code, it seems there is a minor
> > logic-thinko bug in it.  Can you try the patch below (it's against the
> > Emacs-CVS version of table.el, so you may have to apply the patch by
> > hand).
> > 
> > Tak, is my reasoning correct that `table--probe-cell' should return
> > non-nil
> > iff we're inside a table?
> > 
> > 
> >         Stefan
> > 
> > 
> > --- orig/lisp/textmodes/table.el
> > +++ mod/lisp/textmodes/table.el
> > @@ -1025,13 +1025,13 @@
> >        :help "Insert a text based table at point"]
> >       ["Row" table-insert-row
> >        :active (and (not buffer-read-only)
> > -		   (or (table--probe-cell)
> > +		   (and (table--probe-cell)
> >  		       (save-excursion
> >  			 (table--find-row-column nil t))))
> >        :help "Insert row(s) of cells in table"]
> >       ["Column" table-insert-column
> >        :active (and (not buffer-read-only)
> > -		   (or (table--probe-cell)
> > +		   (and (table--probe-cell)
> >  		       (save-excursion
> >  			 (table--find-row-column 'column t))))
> >        :help "Insert column(s) of cells in table"])
> > @@ -1077,13 +1077,13 @@
> >      ("Insert"
> >       ["Row" table-insert-row
> >        :active (and (not buffer-read-only)
> > -		   (or (table--probe-cell)
> > +		   (and (table--probe-cell)
> >  		       (save-excursion
> >  			 (table--find-row-column nil t))))
> >        :help "Insert row(s) of cells in table"]
> >       ["Column" table-insert-column
> >        :active (and (not buffer-read-only)
> > -		   (or (table--probe-cell)
> > +		   (and (table--probe-cell)
> >  		       (save-excursion
> >  			 (table--find-row-column 'column t))))
> >        :help "Insert column(s) of cells in table"])

[-- Attachment #2: table.el.patch --]
[-- Type: Text/Plain, Size: 4477 bytes --]

*** ../../../../d/pub/emacs/pure/emacs-21.3.50/lisp/textmodes/table.el	Wed Feb  9 07:50:36 2005
--- table.el	Tue Mar  8 11:15:27 2005
***************
*** 5,11 ****
  ;; Keywords: wp, convenience
  ;; Author: Takaaki Ota <Takaaki.Ota@am.sony.com>
  ;; Created: Sat Jul 08 2000 13:28:45 (PST)
! ;; Revised: Tue Jun 01 2004 11:36:39 (PDT)
  
  ;; This file is part of GNU Emacs.
  
--- 5,11 ----
  ;; Keywords: wp, convenience
  ;; Author: Takaaki Ota <Takaaki.Ota@am.sony.com>
  ;; Created: Sat Jul 08 2000 13:28:45 (PST)
! ;; Revised: Tue Mar 08 2005 11:15:27 (PST)
  
  ;; This file is part of GNU Emacs.
  
***************
*** 1024,1039 ****
        :active (and (not buffer-read-only) (not (table--probe-cell)))
        :help "Insert a text based table at point"]
       ["Row" table-insert-row
!       :active (and (not buffer-read-only)
! 		   (or (table--probe-cell)
! 		       (save-excursion
! 			 (table--find-row-column nil t))))
        :help "Insert row(s) of cells in table"]
       ["Column" table-insert-column
!       :active (and (not buffer-read-only)
! 		   (or (table--probe-cell)
! 		       (save-excursion
! 			 (table--find-row-column 'column t))))
        :help "Insert column(s) of cells in table"])
      "----"
      ("Recognize"
--- 1024,1033 ----
        :active (and (not buffer-read-only) (not (table--probe-cell)))
        :help "Insert a text based table at point"]
       ["Row" table-insert-row
!       :active (table--row-column-insertion-point-p)
        :help "Insert row(s) of cells in table"]
       ["Column" table-insert-column
!       :active (table--row-column-insertion-point-p 'column)
        :help "Insert column(s) of cells in table"])
      "----"
      ("Recognize"
***************
*** 1076,1091 ****
    '("Table"
      ("Insert"
       ["Row" table-insert-row
!       :active (and (not buffer-read-only)
! 		   (or (table--probe-cell)
! 		       (save-excursion
! 			 (table--find-row-column nil t))))
        :help "Insert row(s) of cells in table"]
       ["Column" table-insert-column
!       :active (and (not buffer-read-only)
! 		   (or (table--probe-cell)
! 		       (save-excursion
! 			 (table--find-row-column 'column t))))
        :help "Insert column(s) of cells in table"])
      ("Delete"
       ["Row" table-delete-row
--- 1070,1079 ----
    '("Table"
      ("Insert"
       ["Row" table-insert-row
!       :active (table--row-column-insertion-point-p)
        :help "Insert row(s) of cells in table"]
       ["Column" table-insert-column
!       :active (table--row-column-insertion-point-p 'column)
        :help "Insert column(s) of cells in table"])
      ("Delete"
       ["Row" table-delete-row
***************
*** 4698,4703 ****
--- 4686,4715 ----
        (setq multiplier (1- multiplier)))
      ret-str))
  
+ (defun table--line-column-position (line column)
+   "Return the location of LINE forward at COLUMN."
+   (save-excursion
+     (forward-line line)
+     (move-to-column column)
+     (point)))
+ 
+ (defun table--row-column-insertion-point-p (&optional columnp)
+   "Return non nil if it makes sense to insert a row or a column at point."
+   (and (not buffer-read-only)
+        (or (get-text-property (point) 'table-cell)
+ 	   (let ((column (current-column)))
+ 	     (if columnp
+ 		 (or (text-property-any (line-beginning-position 0)
+ 					(table--line-column-position -1 column)
+ 					'table-cell t)
+ 		     (text-property-any (line-beginning-position) (point) 'table-cell t)
+ 		     (text-property-any (line-beginning-position 2)
+ 					(table--line-column-position 1 column)
+ 					'table-cell t))
+ 	       (text-property-any (table--line-column-position -2 column)
+ 				  (table--line-column-position -2 (+ 2 column))
+ 				  'table-cell t))))))
+ 
  (defun table--find-row-column (&optional columnp no-error)
    "Search table and return a cell coordinate list of row or column."
    (let ((current-coordinate (table--get-coordinate)))
***************
*** 5136,5142 ****
  
  (defun table--editable-cell-p (&optional abort-on-error)
    (and (not buffer-read-only)
!        (table--probe-cell abort-on-error)))
  
  (defun table--probe-cell (&optional abort-on-error)
    "Probes a table cell around the point.
--- 5148,5154 ----
  
  (defun table--editable-cell-p (&optional abort-on-error)
    (and (not buffer-read-only)
!        (get-text-property (point) 'table-cell)))
  
  (defun table--probe-cell (&optional abort-on-error)
    "Probes a table cell around the point.

[-- Attachment #3: Type: text/plain, Size: 142 bytes --]

_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: slow bibtex menu access
  2005-03-14 17:15             ` Tak Ota
@ 2005-03-18 22:07               ` Tak Ota
  0 siblings, 0 replies; 15+ messages in thread
From: Tak Ota @ 2005-03-18 22:07 UTC (permalink / raw)


[-- Attachment #1: Type: Text/Plain, Size: 3718 bytes --]

Attached is a bug fix.  Could someone please check it in?  Thank you.
This is the third time I ask.

-Tak

Mon, 14 Mar 2005 09:15:05 -0800: "Ota, Takaaki" <Takaaki.Ota@us-ti-xims-1.am.sony.com> wrote:

> If there is no objection to this patch could someone check it in
> please.  Thank you.
> 
> -Tak
> 
> Tue, 8 Mar 2005 14:56:51 -0800: "Ota, Takaaki"
> <Takaaki.Ota@us-ti-xims-1.am.sony.com> wrote:
> 
> > Stefan kindly informed me that table.el was slowing down menu
> > operation considerably depending on buffer contents.  The attached
> > patch corrects this problem.  Thanks Stefan.
> > 
> > -Tak
> > 
> > 2005-03-08  Takaaki Ota  <Takaaki.Ota@am.sony.com>
> > 
> > 	* textmodes/table.el (table--line-column-position): New idiom.
> > 	(table--row-column-insertion-point-p): New function to test
> > 	validity of row and column insertion operation at a location.
> > 	(table-global-menu, table-cell-menu): Use above functions for
> > 	deterministic test operation.
> > 	(table--editable-cell-p): Behave in deterministic fashion.
> > 
> > 
> > Sat, 5 Mar 2005 13:27:00 -0800: "Stefan Monnier"
> > <monnier@iro.umontreal.ca> wrote:
> > 
> > > The following message is a courtesy copy of an article
> > > that has been posted to gnu.emacs.help as well.
> > > 
> > > > Thank you, I'd forgotten that (haven't done it in a long time). So
> I
> > > found
> > > > the problem, and it was table.el. I had (require 'table) and
> > (require
> > > > 'emacs-wiki-table) (the latter requires table.el) in a few places.
> I
> > > have
> > > > no idea where and how table.el is causing the problem, but would
> it
> > be
> > > > possible to turn it off (I guess a hook might do it) while in
> > bibtex?
> > > > Tables are not needed in bibtex anyway.
> > > 
> > > Setting debug-on-quit and hitting C-g while the menu is being built
> > > indicates that the time is actually spent in table--find-row-column.
> > > 
> > > Looking some more at the table.el code, it seems there is a minor
> > > logic-thinko bug in it.  Can you try the patch below (it's against
> the
> > > Emacs-CVS version of table.el, so you may have to apply the patch by
> > > hand).
> > > 
> > > Tak, is my reasoning correct that `table--probe-cell' should return
> > > non-nil
> > > iff we're inside a table?
> > > 
> > > 
> > >         Stefan
> > > 
> > > 
> > > --- orig/lisp/textmodes/table.el
> > > +++ mod/lisp/textmodes/table.el
> > > @@ -1025,13 +1025,13 @@
> > >        :help "Insert a text based table at point"]
> > >       ["Row" table-insert-row
> > >        :active (and (not buffer-read-only)
> > > -		   (or (table--probe-cell)
> > > +		   (and (table--probe-cell)
> > >  		       (save-excursion
> > >  			 (table--find-row-column nil t))))
> > >        :help "Insert row(s) of cells in table"]
> > >       ["Column" table-insert-column
> > >        :active (and (not buffer-read-only)
> > > -		   (or (table--probe-cell)
> > > +		   (and (table--probe-cell)
> > >  		       (save-excursion
> > >  			 (table--find-row-column 'column t))))
> > >        :help "Insert column(s) of cells in table"])
> > > @@ -1077,13 +1077,13 @@
> > >      ("Insert"
> > >       ["Row" table-insert-row
> > >        :active (and (not buffer-read-only)
> > > -		   (or (table--probe-cell)
> > > +		   (and (table--probe-cell)
> > >  		       (save-excursion
> > >  			 (table--find-row-column nil t))))
> > >        :help "Insert row(s) of cells in table"]
> > >       ["Column" table-insert-column
> > >        :active (and (not buffer-read-only)
> > > -		   (or (table--probe-cell)
> > > +		   (and (table--probe-cell)
> > >  		       (save-excursion
> > >  			 (table--find-row-column 'column t))))
> > >        :help "Insert column(s) of cells in table"])

[-- Attachment #2: table.el.patch --]
[-- Type: Text/Plain, Size: 4777 bytes --]

*** table.el	Fri Mar 18 13:50:13 2005
--- ../../../../d/pub/emacs/pure/emacs/lisp/textmodes/table.el	Wed Feb  9 07:50:36 2005
***************
*** 1,11 ****
  ;;; table.el --- create and edit WYSIWYG text based embedded tables
  
! ;; Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
  
  ;; Keywords: wp, convenience
  ;; Author: Takaaki Ota <Takaaki.Ota@am.sony.com>
  ;; Created: Sat Jul 08 2000 13:28:45 (PST)
! ;; Revised: Fri Mar 18 2005 13:50:13 (PST)
  
  ;; This file is part of GNU Emacs.
  
--- 1,11 ----
  ;;; table.el --- create and edit WYSIWYG text based embedded tables
  
! ;; Copyright (C) 2000, 01, 02, 03, 04 Free Software Foundation, Inc.
  
  ;; Keywords: wp, convenience
  ;; Author: Takaaki Ota <Takaaki.Ota@am.sony.com>
  ;; Created: Sat Jul 08 2000 13:28:45 (PST)
! ;; Revised: Tue Jun 01 2004 11:36:39 (PDT)
  
  ;; This file is part of GNU Emacs.
  
***************
*** 1024,1033 ****
        :active (and (not buffer-read-only) (not (table--probe-cell)))
        :help "Insert a text based table at point"]
       ["Row" table-insert-row
!       :active (table--row-column-insertion-point-p)
        :help "Insert row(s) of cells in table"]
       ["Column" table-insert-column
!       :active (table--row-column-insertion-point-p 'column)
        :help "Insert column(s) of cells in table"])
      "----"
      ("Recognize"
--- 1024,1039 ----
        :active (and (not buffer-read-only) (not (table--probe-cell)))
        :help "Insert a text based table at point"]
       ["Row" table-insert-row
!       :active (and (not buffer-read-only)
! 		   (or (table--probe-cell)
! 		       (save-excursion
! 			 (table--find-row-column nil t))))
        :help "Insert row(s) of cells in table"]
       ["Column" table-insert-column
!       :active (and (not buffer-read-only)
! 		   (or (table--probe-cell)
! 		       (save-excursion
! 			 (table--find-row-column 'column t))))
        :help "Insert column(s) of cells in table"])
      "----"
      ("Recognize"
***************
*** 1070,1079 ****
    '("Table"
      ("Insert"
       ["Row" table-insert-row
!       :active (table--row-column-insertion-point-p)
        :help "Insert row(s) of cells in table"]
       ["Column" table-insert-column
!       :active (table--row-column-insertion-point-p 'column)
        :help "Insert column(s) of cells in table"])
      ("Delete"
       ["Row" table-delete-row
--- 1076,1091 ----
    '("Table"
      ("Insert"
       ["Row" table-insert-row
!       :active (and (not buffer-read-only)
! 		   (or (table--probe-cell)
! 		       (save-excursion
! 			 (table--find-row-column nil t))))
        :help "Insert row(s) of cells in table"]
       ["Column" table-insert-column
!       :active (and (not buffer-read-only)
! 		   (or (table--probe-cell)
! 		       (save-excursion
! 			 (table--find-row-column 'column t))))
        :help "Insert column(s) of cells in table"])
      ("Delete"
       ["Row" table-delete-row
***************
*** 4686,4715 ****
        (setq multiplier (1- multiplier)))
      ret-str))
  
- (defun table--line-column-position (line column)
-   "Return the location of LINE forward at COLUMN."
-   (save-excursion
-     (forward-line line)
-     (move-to-column column)
-     (point)))
- 
- (defun table--row-column-insertion-point-p (&optional columnp)
-   "Return non nil if it makes sense to insert a row or a column at point."
-   (and (not buffer-read-only)
-        (or (get-text-property (point) 'table-cell)
- 	   (let ((column (current-column)))
- 	     (if columnp
- 		 (or (text-property-any (line-beginning-position 0)
- 					(table--line-column-position -1 column)
- 					'table-cell t)
- 		     (text-property-any (line-beginning-position) (point) 'table-cell t)
- 		     (text-property-any (line-beginning-position 2)
- 					(table--line-column-position 1 column)
- 					'table-cell t))
- 	       (text-property-any (table--line-column-position -2 column)
- 				  (table--line-column-position -2 (+ 2 column))
- 				  'table-cell t))))))
- 
  (defun table--find-row-column (&optional columnp no-error)
    "Search table and return a cell coordinate list of row or column."
    (let ((current-coordinate (table--get-coordinate)))
--- 4698,4703 ----
***************
*** 5148,5154 ****
  
  (defun table--editable-cell-p (&optional abort-on-error)
    (and (not buffer-read-only)
!        (get-text-property (point) 'table-cell)))
  
  (defun table--probe-cell (&optional abort-on-error)
    "Probes a table cell around the point.
--- 5136,5142 ----
  
  (defun table--editable-cell-p (&optional abort-on-error)
    (and (not buffer-read-only)
!        (table--probe-cell abort-on-error)))
  
  (defun table--probe-cell (&optional abort-on-error)
    "Probes a table cell around the point.

[-- Attachment #3: Type: text/plain, Size: 142 bytes --]

_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel

^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2005-03-18 22:07 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <mailman.2117.1109641717.32256.help-gnu-emacs@gnu.org>
2005-03-01 12:19 ` slow bibtex menu access Roland Winkler
2005-03-01 14:06   ` Sebastian Luque
2005-03-01 14:31     ` Sebastian Luque
     [not found]   ` <mailman.2167.1109686744.32256.help-gnu-emacs@gnu.org>
2005-03-01 14:44     ` Roland.Winkler
2005-03-01 16:36       ` Sebastian Luque
     [not found]       ` <mailman.2198.1109696777.32256.help-gnu-emacs@gnu.org>
2005-03-01 22:13         ` Jochen Küpper
2005-03-02 13:08 ` Stefan Monnier
2005-03-02 19:47   ` Sebastian Luque
     [not found]   ` <mailman.2371.1109793933.32256.help-gnu-emacs@gnu.org>
2005-03-03  4:04     ` Chong Yidong
2005-03-03 16:18       ` Sebastian Luque
     [not found]       ` <mailman.2485.1109868847.32256.help-gnu-emacs@gnu.org>
2005-03-05 21:27         ` Stefan Monnier
2005-03-08 22:56           ` Tak Ota
2005-03-14 17:15             ` Tak Ota
2005-03-18 22:07               ` Tak Ota
2005-03-01  1:25 Sebastian Luque

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.