bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#4804: 23.1; bookmark-bmenu-bookmark performances


From: Thierry Volpiatto
Subject: bug#4804: 23.1; bookmark-bmenu-bookmark performances
Date: Sun, 25 Oct 2009 09:36:46 +0100
User-agent: Gnus/5.110011 (No Gnus v0.11) Emacs/23.1 (gnu/linux)

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@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

Attachment: SingleInitial-patchToTip.patch
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]