all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* replace C-s with C-f
@ 2003-02-17 18:31 Bruce Ingalls
  2003-02-17 18:39 ` David Kastrup
  0 siblings, 1 reply; 11+ messages in thread
From: Bruce Ingalls @ 2003-02-17 18:31 UTC (permalink / raw)


I bound C-f to isearch-forward, as follows:

   (global-set-key [(control s)] 'save-buffer)
   (global-set-key [(control f)] 'isearch-forward)

The bindings work, but when I want to continue a search,
by hitting C-f again, it instead stops & restarts the search.

C-g is generally bound to continuing a search, but I'd rather not
go that route.

What is the best way to handle this?

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

* Re: replace C-s with C-f
  2003-02-17 18:31 replace C-s with C-f Bruce Ingalls
@ 2003-02-17 18:39 ` David Kastrup
  2003-02-17 19:35   ` Bruce Ingalls
  0 siblings, 1 reply; 11+ messages in thread
From: David Kastrup @ 2003-02-17 18:39 UTC (permalink / raw)


Bruce Ingalls <bingalls@CUT-this-SPAM-BLOCK.fit-zones.com> writes:

> I bound C-f to isearch-forward, as follows:
> 
>    (global-set-key [(control s)] 'save-buffer)
>    (global-set-key [(control f)] 'isearch-forward)
> 
> The bindings work, but when I want to continue a search,
> by hitting C-f again, it instead stops & restarts the search.
> 
> C-g is generally bound to continuing a search, but I'd rather not
> go that route.
> 
> What is the best way to handle this?
> 

isearch-forward is an interactive compiled Lisp function in `isearch'.
It is bound to C-s, <menu-bar> <edit> <search> <i-search> <isearch-forward>.
(isearch-forward &optional REGEXP-P NO-RECURSIVE-EDIT)

Do incremental search forward.
With a prefix argument, do an incremental regular expression search instead.

As you type characters, they add to the search string and are found.
The following non-printing keys are bound in `isearch-mode-map'.

Type DEL to cancel characters from end of search string.
Type RET to exit, leaving point at location found.
[...]

The above keys, bound in `isearch-mode-map', are often controlled by
 options; do M-x apropos on search-.* to find them.
Other control and meta characters terminate the search
 and are then executed normally (depending on `search-exit-option').
Likewise for function keys and mouse button events.

*SNIP*

So the answer is obvious:  add your stuff to isearch-mode-map.

-- 
David Kastrup, Kriemhildstr. 15, 44793 Bochum

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

* Re: replace C-s with C-f
  2003-02-17 18:39 ` David Kastrup
@ 2003-02-17 19:35   ` Bruce Ingalls
  2003-02-17 20:18     ` David Kastrup
  0 siblings, 1 reply; 11+ messages in thread
From: Bruce Ingalls @ 2003-02-17 19:35 UTC (permalink / raw)


David Kastrup wrote:
> Bruce Ingalls <bingalls@CUT-this-SPAM-BLOCK.fit-zones.com> writes:
> 
>>I bound C-f to isearch-forward, as follows:
>>
>>   (global-set-key [(control s)] 'save-buffer)
>>   (global-set-key [(control f)] 'isearch-forward)
>>
>>The bindings work, but when I want to continue a search,
>>by hitting C-f again, it instead stops & restarts the search.

>>What is the best way to handle this?
...> So the answer is obvious:  add your stuff to isearch-mode-map.

Thanks for the help. I have problems with the syntax.
At least the following compiled :)

(append 'isearch-mode-map '(define-key map "\C-f" 'isearch-repeat-forward))

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

* Re: replace C-s with C-f
  2003-02-17 19:35   ` Bruce Ingalls
@ 2003-02-17 20:18     ` David Kastrup
  2003-02-17 21:59       ` Stefan Monnier <foo@acm.com>
  2003-02-18  1:42       ` Unknown
  0 siblings, 2 replies; 11+ messages in thread
From: David Kastrup @ 2003-02-17 20:18 UTC (permalink / raw)


Bruce Ingalls <bingalls@CUT-this-SPAM-BLOCK.fit-zones.com> writes:

> David Kastrup wrote:
> > Bruce Ingalls <bingalls@CUT-this-SPAM-BLOCK.fit-zones.com> writes:
> > 
> >>I bound C-f to isearch-forward, as follows:
> >>
> >>   (global-set-key [(control s)] 'save-buffer)
> >>   (global-set-key [(control f)] 'isearch-forward)
> >>
> >>The bindings work, but when I want to continue a search,
> >>by hitting C-f again, it instead stops & restarts the search.
> 
> >>What is the best way to handle this?
> ...> So the answer is obvious:  add your stuff to isearch-mode-map.
> 
> Thanks for the help. I have problems with the syntax.
> At least the following compiled :)
> 
> (append 'isearch-mode-map '(define-key map "\C-f" 'isearch-repeat-forward))

What nonsense.  How about looking up the functions you are using with
C-h f ?

In this case, I'd try something like
(eval-after-load 'isearch
  (define-key isearch-mode-map ?\C-f 'isearch-repeat-forward))

-- 
David Kastrup, Kriemhildstr. 15, 44793 Bochum

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

* Re: replace C-s with C-f
  2003-02-17 20:18     ` David Kastrup
@ 2003-02-17 21:59       ` Stefan Monnier <foo@acm.com>
  2003-02-18  1:42       ` Unknown
  1 sibling, 0 replies; 11+ messages in thread
From: Stefan Monnier <foo@acm.com> @ 2003-02-17 21:59 UTC (permalink / raw)


> (eval-after-load 'isearch

In Emacs, isearch is preloaded, so there's no need to "eval after load".

>   (define-key isearch-mode-map ?\C-f 'isearch-repeat-forward))
                                [     ]

        Stefan

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

* Re: replace C-s with C-f
  2003-02-17 20:18     ` David Kastrup
  2003-02-17 21:59       ` Stefan Monnier <foo@acm.com>
@ 2003-02-18  1:42       ` Unknown
  2003-02-18  3:15         ` John Russell
  1 sibling, 1 reply; 11+ messages in thread
From: Unknown @ 2003-02-18  1:42 UTC (permalink / raw)


David Kastrup wrote:

> Bruce Ingalls <bingalls@CUT-this-SPAM-BLOCK.fit-zones.com> writes:
> 
>> David Kastrup wrote:
>> > Bruce Ingalls <bingalls@CUT-this-SPAM-BLOCK.fit-zones.com> writes:
>> > 
>> >>I bound C-f to isearch-forward, as follows:
>> >>
>> >>   (global-set-key [(control s)] 'save-buffer)
>> >>   (global-set-key [(control f)] 'isearch-forward)
>> >>
>> >>The bindings work, but when I want to continue a search,
>> >>by hitting C-f again, it instead stops & restarts the search.
>> 
>> >>What is the best way to handle this?
>> ...> So the answer is obvious:  add your stuff to isearch-mode-map.
>> 
>> Thanks for the help. I have problems with the syntax.
>> At least the following compiled :)
>> 
>> (append 'isearch-mode-map '(define-key map "\C-f" 'isearch-repeat-forward))
> 
> What nonsense.  How about looking up the functions you are using with
> C-h f ?
> 
> In this case, I'd try something like
> (eval-after-load 'isearch
>   (define-key isearch-mode-map ?\C-f 'isearch-repeat-forward))
> 

Here is a sniplet from my init file.  It's commented out, because I've wholly 
given up on making Emacs work how I wish.  It's obviously much smarter than 
me.  I'd advise you to do the same.  ;) ...

;*old code* >>>>>>>>>>>>>>>>>>>
;(global-set-key [(control f)] 'isearch-forward-regexp)
;(global-set-key [(control F)] 'isearch-backward-regexp)
;(global-set-key [(control r)] 'query-replace-regexp)

;(mapcar
; '(lambda (map)
;    (define-key map [(control f)] 'isearch-repeat-forward)
;    (define-key map [(control F)] 'isearch-repeat-backward)
;    (define-key map [(tab)] 'isearch-complete)
;    (define-key map [(control s)] (lookup-key
;                                   global-map
;                                   [(control s)]))
;    (define-key map [(control r)] (lookup-key
;                                   global-map
;                                   [(control r)])))
; (list isearch-mode-map minibuffer-local-isearch-map))

--
Le

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

* Re: replace C-s with C-f
  2003-02-18  1:42       ` Unknown
@ 2003-02-18  3:15         ` John Russell
  2003-02-18 19:18           ` Keybinding std WAS: " Bruce Ingalls
  0 siblings, 1 reply; 11+ messages in thread
From: John Russell @ 2003-02-18  3:15 UTC (permalink / raw)



> Here is a sniplet from my init file.  It's commented out, because I've wholly 
> given up on making Emacs work how I wish.  It's obviously much smarter than 
> me.  I'd advise you to do the same.  ;) ...

I've been reading this thread and I just wanted to chime in because I'm 
nosy and can't help myself.  Pretty much all of the keybindings talked 
about here exists as standard emacs key-bindings.  I suppose that it is 
a matter of preference, but in my experience of trying to to reset 
standard emacs keys, I always find myself stepping on other cool 
keybindings which I have to remap to other keybidings which step on 
other cool keybindings .........

I know that emacs is way smarter than I am.  I've decided that someone 
put the keybindings there because they just work.  Just a thought.


> 
> ;*old code* >>>>>>>>>>>>>>>>>>>
> ;(global-set-key [(control f)] 'isearch-forward-regexp)
> ;(global-set-key [(control F)] 'isearch-backward-regexp)
> ;(global-set-key [(control r)] 'query-replace-regexp)
> 
> ;(mapcar
> ; '(lambda (map)
> ;    (define-key map [(control f)] 'isearch-repeat-forward)
> ;    (define-key map [(control F)] 'isearch-repeat-backward)
> ;    (define-key map [(tab)] 'isearch-complete)
> ;    (define-key map [(control s)] (lookup-key
> ;                                   global-map
> ;                                   [(control s)]))
> ;    (define-key map [(control r)] (lookup-key
> ;                                   global-map
> ;                                   [(control r)])))
> ; (list isearch-mode-map minibuffer-local-isearch-map))
> 
> --
> Le

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

* Keybinding std WAS: replace C-s with C-f
  2003-02-18  3:15         ` John Russell
@ 2003-02-18 19:18           ` Bruce Ingalls
  2003-02-18 22:36             ` Kevin Rodgers
  0 siblings, 1 reply; 11+ messages in thread
From: Bruce Ingalls @ 2003-02-18 19:18 UTC (permalink / raw)


John Russell wrote:
>     Here is a sniplet from my init file.  It's commented out, because
>     I've wholly given up on making Emacs work how I wish.  It's
>     obviously much smarter than me.  I'd advise you to do the same.  ;) ...
...
> a matter of preference, but in my experience of trying to to reset 
> standard emacs keys, I always find myself stepping on other cool 
> keybindings which I have to remap to other keybidings which step on 
> other cool keybindings .........
> 
> I know that emacs is way smarter than I am.  I've decided that someone 
> put the keybindings there because they just work.  Just a thought.

Well, These keybindings are options for people who complain that (X)Emacs
is hard to learn, or doesn't work like editors.

About the only thing missing, at this point, is that the keybindings 
don't show
up in the menu, to the right of the commands, ex:
	Search...			C-f

I'm happy with the native bindings, but I am leaving the following turned on
for some time, until I am comfortable that it works. These are all Customize
options. However, I agree that it is best to migrate to native bindings.
I would expect that viper users would do the same.

Finally, there is a rumor, that KDE & Gnome may soon come to an agreement
on keybinding standards. I feel that Emacs & XEmacs should step up to the
plate, and try to conform to any reasonable standard.

   (cond					;email current buffer
    ((fboundp 'metamail-buffer)
     (global-set-key [(control e)] 'metamail-buffer))
    ((fboundp 'w3-mail-current-document)
     (global-set-key [(control e)] 'w3-mail-current-document)))

   (global-set-key [(control p)] 'print-buffer)
   (global-set-key [(control s)] 'save-buffer)
   (global-set-key [(control q)] 'save-buffers-kill-emacs)
   (global-set-key [(control w)] 'kill-buffer)

;;EDIT
;;C-u duplicates selection, without affecting clipboard. Can this be done in
;;Emacs?
;;C-i inverts selection: all selected items become unselected, and vice 
versa

   (global-set-key [(control a)] 'mark-whole-buffer)
   (global-set-key [(control f)] 'isearch-forward)
   (define-key isearch-mode-map [(control f)] 'isearch-repeat-forward)

;;Control G as 'find next match' useful enough to conflict?
;;(global-set-key [(control h)] 'query-replace)  ;conflicts with help

   (global-set-key [(control v)] 'yank)

;;Any way to build an Emacs macro for redo?
;;This replaces zap-to-char()
   (when (fboundp 'redo)
     (global-set-key [(meta z)] 'redo)) ;exists for XEmacs, only

;;VIEW
   (global-set-key [(control r)] 'recenter) ;"refresh view"

;;RELOAD/REFRESH
;;(global-set-key [(control d)] 'bookmark-set) ;conflicts with 
delete-forward
;;(global-set-key [(control b)] 'edit-bookmarks)

;;FORMAT
   (global-set-key [(control b)] 'bold-region)
;;  (global-set-key [(control u)] 'facemenu-set-underline)
;;We need an alternative to universal-argument() to allow the previous line

;;WINDOW MANAGER STANDARDS
;;TODO: FIX FOLLOWING SYNTAX!!!
   (global-set-key [(meta \040)] 'tmm-menubar) ;M-space is symbiotic?
   )

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

* Re: Keybinding std WAS: replace C-s with C-f
  2003-02-18 19:18           ` Keybinding std WAS: " Bruce Ingalls
@ 2003-02-18 22:36             ` Kevin Rodgers
  2003-02-18 23:09               ` Hannu Koivisto
  2003-02-19 20:57               ` Bruce Ingalls
  0 siblings, 2 replies; 11+ messages in thread
From: Kevin Rodgers @ 2003-02-18 22:36 UTC (permalink / raw)


Bruce Ingalls wrote:

> About the only thing missing, at this point, is that the keybindings 
> don't show
> up in the menu, to the right of the commands, ex:
>     Search...            C-f


Because src/xmenu.c:menu_item_equiv_key only displays the first key sequence
returned by where-is-internal.  "First" doesn't seem to be well-defined, so
maybe if you removed the default keybinding(s) before adding your custom key
binding, it would help.


...


> Finally, there is a rumor, that KDE & Gnome may soon come to an agreement
> on keybinding standards. I feel that Emacs & XEmacs should step up to the
> plate, and try to conform to any reasonable standard.


Obviously, KDE and Gnome should respect Emacs' precedent key bindings.


...


> ;;WINDOW MANAGER STANDARDS
> ;;TODO: FIX FOLLOWING SYNTAX!!!
>   (global-set-key [(meta \040)] 'tmm-menubar) ;M-space is symbiotic?
>   )

[(meta ?\040)] or just "\M- "

-- 
<a href="mailto:&lt;kevin.rodgers&#64;ihs.com&gt;">Kevin Rodgers</a>

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

* Re: Keybinding std WAS: replace C-s with C-f
  2003-02-18 22:36             ` Kevin Rodgers
@ 2003-02-18 23:09               ` Hannu Koivisto
  2003-02-19 20:57               ` Bruce Ingalls
  1 sibling, 0 replies; 11+ messages in thread
From: Hannu Koivisto @ 2003-02-18 23:09 UTC (permalink / raw)


Kevin Rodgers <kevin.rodgers@ihs.com> writes:

> [(meta ?\040)] or just "\M- "

Or just [(meta \ )]

-- 
Hannu

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

* Re: Keybinding std WAS: replace C-s with C-f
  2003-02-18 22:36             ` Kevin Rodgers
  2003-02-18 23:09               ` Hannu Koivisto
@ 2003-02-19 20:57               ` Bruce Ingalls
  1 sibling, 0 replies; 11+ messages in thread
From: Bruce Ingalls @ 2003-02-19 20:57 UTC (permalink / raw)


Kevin Rodgers wrote:
> Bruce Ingalls wrote:
>> About the only thing missing, at this point, is that the keybindings 
>> don't show
>> up in the menu, to the right of the commands, ex:
>>     Search...            C-f
> 
> Because src/xmenu.c:menu_item_equiv_key only displays the first key 
> sequence
> returned by where-is-internal.  "First" doesn't seem to be well-defined, so
> maybe if you removed the default keybinding(s) before adding your custom 
> key
> binding, it would help.

Thanks, Kevin. I tried
	(global-unset-key [(control s)])
before re-assigning it (to save) but this had no effect on the menu.
Am I using the wrong command?

Here's what I have, so far:

   (global-unset-key [(control s)])
   (global-set-key [(control s)] 'save-buffer)

   (global-set-key [(control f)] 'isearch-forward)
   (define-key isearch-mode-map [(control f)] 'isearch-repeat-forward)

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

end of thread, other threads:[~2003-02-19 20:57 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-02-17 18:31 replace C-s with C-f Bruce Ingalls
2003-02-17 18:39 ` David Kastrup
2003-02-17 19:35   ` Bruce Ingalls
2003-02-17 20:18     ` David Kastrup
2003-02-17 21:59       ` Stefan Monnier <foo@acm.com>
2003-02-18  1:42       ` Unknown
2003-02-18  3:15         ` John Russell
2003-02-18 19:18           ` Keybinding std WAS: " Bruce Ingalls
2003-02-18 22:36             ` Kevin Rodgers
2003-02-18 23:09               ` Hannu Koivisto
2003-02-19 20:57               ` Bruce Ingalls

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.