GNU bug report logs - #4804
23.1; bookmark-bmenu-bookmark performances

Previous Next

Package: emacs;

Reported by: Thierry Volpiatto <thierry.volpiatto <at> gmail.com>

Date: Sun, 25 Oct 2009 08:50:05 UTC

Severity: wishlist

Tags: fixed

Fixed in version 23.2

Done: Stefan Kangas <stefan <at> marxist.se>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 4804 in the body.
You can then email your comments to 4804 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#4804; Package emacs. (Sun, 25 Oct 2009 08:50:05 GMT) Full text and rfc822 format available.

Acknowledgement sent to Thierry Volpiatto <thierry.volpiatto <at> gmail.com>:
New bug report received and forwarded. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. (Sun, 25 Oct 2009 08:50:06 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Thierry Volpiatto <thierry.volpiatto <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 23.1; bookmark-bmenu-bookmark performances
Date: Sun, 25 Oct 2009 09:36:46 +0100
[Message part 1 (text/plain, inline)]
Please write in English if possible, because the Emacs maintainers
usually do not have translators to read other languages for them.

Your bug report will be posted to the bug-gnu-emacs <at> gnu.org mailing list,
and to the gnu.emacs.bug news group.

Please describe exactly what actions triggered the bug
and the precise symptoms of the bug:

Hi,
About bookmark-bmenu-bookmark:

This function work as expected but it is not convenient for the
developper that work on bookmark.el, thus it is inefficient.

bookmark-bmenu-bookmark parse all the menu list with search-* to get the
bookmark name, but to do that, it have to toggle the filenames
visibility if these are toggle on.
That's the problem:

1) run a loop on all menu list to toggle filenames visibility.
2) come back to the original place and get bookmark name with
buffer-substring
3) run again a loop to toggle filenames visibility back.

That's very costly.
If you want one bookmark name, ok but if you run another loop to get
many bookmark names, that will be very long. 

The solution: (It's what i wrote for bookmark+.el.)

1) Create a defvar like `bookmark-latest-sorted-alist'.

,----
| (defvar bookmark-latest-sorted-alist nil)
`----


2) Set this variable to the copy of bookmark-alist obtained in
bookmark-maybe-sort-alist:

,----
| (defun bookmark-maybe-sort-alist ()
|   "Return a sorted copy of `bookmark-alist'.
| If `bookmark-sort-flag' is nil return `bookmark-alist'.
| The sorted copy of `bookmark-alist' is set to `sbookmark-latest-sorted-alist'."
|   (let ((bmk-alist (copy-alist bookmark-alist)))
|     (if bookmark-sort-flag
|         (setq bookmark-latest-sorted-alist
|               (sort bmk-alist #'(lambda (x y) (string-lessp (car x) (car y)))))
|         (setq bookmark-latest-sorted-alist bookmark-alist))))
`----

3) Get the bookmark name from this list with the position in menu list:

,----
| (defun bookmark-bmenu-bookmark ()
|   "Return a string which is bookmark of this line."
|   (let ((pos (- (line-number-at-pos) 3)))
|     (car (nth pos bookmark-latest-sorted-alist))))
`----

That simple and work fine here.
You can now work on menu list of bookmarks without thinking at toggling
filename visibility.(and it's much faster).
That's make easier working in bookmark.el for further modification.

You will find a patch attached.
 

If Emacs crashed, and you have the Emacs process in the gdb debugger,
please include the output from the following gdb commands:
    `bt full' and `xbacktrace'.
If you would like to further debug the crash, please read the file
/usr/share/emacs/23.1/etc/DEBUG for instructions.


In GNU Emacs 23.1.1 (i686-pc-linux-gnu, GTK+ Version 2.16.5)
 of 2009-07-31 on tux
Windowing system distributor `The X.Org Foundation', version 11.0.10603901
configured using `configure  '--prefix=/usr' '--build=i686-pc-linux-gnu' '--host=i686-pc-linux-gnu' '--mandir=/usr/share/man' '--infodir=/usr/share/info' '--datadir=/usr/share' '--sysconfdir=/etc' '--localstatedir=/var/lib' '--program-suffix=-emacs-23' '--infodir=/usr/share/info/emacs-23' '--with-sound' '--with-x' '--without-toolkit-scroll-bars' '--with-gif' '--with-jpeg' '--with-png' '--with-rsvg' '--with-tiff' '--with-xpm' '--with-xft' '--without-libotf' '--without-m17n-flt' '--with-x-toolkit=gtk' '--without-hesiod' '--without-kerberos' '--without-kerberos5' '--with-gpm' '--with-dbus' 'build_alias=i686-pc-linux-gnu' 'host_alias=i686-pc-linux-gnu' 'CFLAGS=-march=i686 -pipe -O2' 'LDFLAGS=-Wl,-O1''

Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: C
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: fr_FR.UTF-8
  value of $XMODIFIERS: nil
  locale-coding-system: utf-8-unix
  default-enable-multibyte-characters: t

Major mode: Lisp

Minor modes in effect:
  eldoc-mode: t
  icomplete-mode: t
  icicle-mode: t
  delete-selection-mode: t
  minibuffer-depth-indicate-mode: t
  stumpwm-mode: t
  slime-mode: t
  auto-image-file-mode: t
  partial-completion-mode: t
  show-paren-mode: t
  display-battery-mode: t
  display-time-mode: t
  diff-auto-refine-mode: t
  shell-dirtrack-mode: t
  recentf-mode: t
  savehist-mode: t
  desktop-save-mode: t
  tooltip-mode: t
  mouse-wheel-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  global-auto-composition-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t

Recent input:
<down> <down> C-x r l M-g e m a c s <backspace> <backspace> 
<backspace> <backspace> <backspace> q p <backspace> 
<backspace> <return> q M-x r e p o r t <tab> <down> 
<return>

Recent messages:
bunzip2ing elisp-9.info.bz2...done
bunzip2ing elisp-10.info.bz2...done
bunzip2ing elisp-11.info.bz2...done
Turning ON Icicle mode...done
Desktop lazily opening *info* (1 remaining)...done
Lazy desktop load complete
Collecting symbols...done
Auto-saving...done
Collecting symbols...done
Computing completion candidates...

-- 
A + Thierry Volpiatto
Location: Saint-Cyr-Sur-Mer - France

[SingleInitial-patchToTip.patch (text/x-patch, attachment)]

Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#4804; Package emacs. (Sun, 25 Oct 2009 15:20:04 GMT) Full text and rfc822 format available.

Acknowledgement sent to Stefan Monnier <monnier <at> iro.umontreal.ca>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. (Sun, 25 Oct 2009 15:20:05 GMT) Full text and rfc822 format available.

Message #10 received at 4804 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Thierry Volpiatto <thierry.volpiatto <at> gmail.com>
Cc: 4804 <at> debbugs.gnu.org
Subject: Re: bug#4804: 23.1; bookmark-bmenu-bookmark performances
Date: Sun, 25 Oct 2009 11:12:57 -0400
> 1) run a loop on all menu list to toggle filenames visibility.
> 2) come back to the original place and get bookmark name with
> buffer-substring
> 3) run again a loop to toggle filenames visibility back.
> That's very costly.

Agreed, it's costly, brittle, and ugly.

But your solution relies on a correspondance between
bookmark-latest-sorted-alist and the buffer's content, even though this
correspondance is nowhere enforced (i.e. future changes to the code are
likely to break it, or manual buffer modifications could also break it).

Much easier and more robust would be to put the relevant data directly
in the buffer in the form of text-properties, so it can be extracted
directly via get-text-property regardless of whether the filenames
are hidden.


        Stefan



Severity set to 'wishlist' from 'normal' Request was from Glenn Morris <rgm <at> gnu.org> to control <at> emacsbugs.donarmstrong.com. (Sat, 31 Oct 2009 02:30:22 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#4804; Package emacs. (Sun, 30 Jun 2019 01:11:01 GMT) Full text and rfc822 format available.

Message #15 received at 4804 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Kangas <stefan <at> marxist.se>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 4804 <at> debbugs.gnu.org, Thierry Volpiatto <thierry.volpiatto <at> gmail.com>
Subject: Re: bug#4804: 23.1; bookmark-bmenu-bookmark performances
Date: Sun, 30 Jun 2019 03:09:45 +0200
tags 4804 fixed
close 4804 23.2
quit

Stefan Monnier <monnier <at> iro.umontreal.ca> writes:
>> 1) run a loop on all menu list to toggle filenames visibility.
>> 2) come back to the original place and get bookmark name with
>> buffer-substring
>> 3) run again a loop to toggle filenames visibility back.
>> That's very costly.
>
> Agreed, it's costly, brittle, and ugly.
>
> But your solution relies on a correspondance between
> bookmark-latest-sorted-alist and the buffer's content, even though this
> correspondance is nowhere enforced (i.e. future changes to the code are
> likely to break it, or manual buffer modifications could also break it).
>
> Much easier and more robust would be to put the relevant data directly
> in the buffer in the form of text-properties, so it can be extracted
> directly via get-text-property regardless of whether the filenames
> are hidden.
>
>
>         Stefan

This was subsequently implemented by Stefan Monnier:

fc9d6ad645ab0332811bcd7b79341f68ddd958e8
2009-11-21 06:43:45 +0000
https://git.savannah.gnu.org/cgit/emacs.git/commit/?id=fc9d6ad645ab0332811bcd7b79341f68ddd958e8

I'm therefore closing this bug report.

Thanks,
Stefan Kangas




Added tag(s) fixed. Request was from Stefan Kangas <stefan <at> marxist.se> to control <at> debbugs.gnu.org. (Sun, 30 Jun 2019 01:11:02 GMT) Full text and rfc822 format available.

bug marked as fixed in version 23.2, send any further explanations to 4804 <at> debbugs.gnu.org and Thierry Volpiatto <thierry.volpiatto <at> gmail.com> Request was from Stefan Kangas <stefan <at> marxist.se> to control <at> debbugs.gnu.org. (Sun, 30 Jun 2019 01:11:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sun, 28 Jul 2019 11:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 4 years and 263 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.