From: Thierry Volpiatto <thierry.volpiatto@gmail.com>
To: 10998@debbugs.gnu.org
Subject: bug#10998: Allow movements in bookmark-bmenu-search
Date: Mon, 01 Oct 2012 09:45:42 +0200 [thread overview]
Message-ID: <87zk46hbyx.fsf@gmail.com> (raw)
In-Reply-To: <87r4wy1hdn.fsf@gmail.com>
Karl Fogel <kfogel@openitp.org> writes:
> The code has changed somewhat since the original patch -- it now uses
> `pcase' instead of `case', for example (and thus `_' instead of `t'),
> ever since monnier@iro.umontreal.ca-20120710115154-012cs2xbndtlpvh1.
>
> Furthermore, in http://debbugs.gnu.org/cgi/bugreport.cgi?bug=10998#11
> Thierry said "the patch sent contain free-variables, it is fixed here"
> but there was no new patch attached.
It is fixed "here" mean I fixed this on my own version of bookmark but
didn't send any patch because no body was interested by this change.
It is working with no problem since then.
> So, I've adjusted the original patch (see below) and done some light
> testing, but I'm not confident enough in this to commit it yet.
> Thierry, what were those free variables?
Don't remember that was more than one year ago.
> And can you test this to make sure it behaves as your original patch
> did?
I have not anymore this patch.
You will find bookmark-extensions.el at:
https://github.com/thierryvolpiatto/emacs-bmk-ext.git
Install it and try cursor movements to see if it behave like your patch.
Here the function:
#+BEGIN_SRC lisp
(defun bookmark-read-search-input ()
"Read each keyboard input and add it to `bookmark-search-pattern'."
(let ((prompt (propertize "Pattern: " 'face 'minibuffer-prompt))
(tmp-list ())
(index 0))
(while
(let ((char (read-key (concat prompt (bookmark-set-cursor-in-prompt
bookmark-search-pattern
index tmp-list)))))
(case char
((?\e ?\r) nil) ; RET or ESC break the search loop.
(?\C-g (setq bookmark-quit-flag t) nil)
(?\d (with-no-warnings ; Delete last char of pattern with DEL.
(pop (nthcdr index tmp-list))) t)
;; Movements in minibuffer.
(?\C-b ; backward-char.
(setq index (min (1+ index) (length tmp-list))) t)
(?\C-f ; forward-char.
(setq index (max (1- index) 0)) t)
(?\C-a ; move bol.
(setq index (length tmp-list)) t)
(?\C-e ; move eol.
(setq index 0) t)
(?\C-k
(kill-new (substring bookmark-search-pattern
(- (length tmp-list) index)))
(setq tmp-list (nthcdr index tmp-list)) (setq index 0) t)
(?\C-y
(let ((str (car kill-ring)))
(loop for char across str
do (push char (nthcdr index tmp-list)))) t)
(t
(if (characterp char)
(push char (nthcdr index tmp-list))
(setq unread-command-events
(nconc (mapcar 'identity
(this-single-command-raw-keys))
unread-command-events))
nil))))
(setq bookmark-search-pattern
(apply 'string (reverse tmp-list))))))
#+END_SRC
Note: I don't maintain anymore bookmark-extensions.el, only small
bugfixes for my personal usage (e.g recently `bookmark-write-file')
> I agree with Stefan that this is not an ideal solution, by the way, and
> have left a comment in the patch below to that effect.
Keep in mind that this is not a real minibuffer.
--
Thierry
Get my Gnupg key:
gpg --keyserver pgp.mit.edu --recv-keys 59F29997
next prev parent reply other threads:[~2012-10-01 7:45 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-03-12 6:08 bug#10998: Allow movements in bookmark-bmenu-search Thierry Volpiatto
2012-03-12 12:31 ` Stefan Monnier
2012-03-12 12:49 ` Thierry Volpiatto
2012-03-12 15:52 ` Stefan Monnier
2012-03-13 15:34 ` Thierry Volpiatto
2012-10-01 4:35 ` Karl Fogel
2012-10-01 7:45 ` Thierry Volpiatto [this message]
2012-10-01 14:53 ` Stefan Monnier
2012-10-01 15:11 ` Thierry Volpiatto
2012-10-02 2:47 ` Stefan Monnier
2019-06-12 16:28 ` Stefan Kangas
2019-06-12 20:30 ` npostavs
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=87zk46hbyx.fsf@gmail.com \
--to=thierry.volpiatto@gmail.com \
--cc=10998@debbugs.gnu.org \
/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.