all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* [PATCH] Isearch: yanking before point
@ 2007-08-21 15:59 Johannes Weiner
  2007-08-22  3:15 ` Richard Stallman
  2007-08-22 15:08 ` Johan Bockgård
  0 siblings, 2 replies; 12+ messages in thread
From: Johannes Weiner @ 2007-08-21 15:59 UTC (permalink / raw)
  To: Emacs development discussions

[-- Attachment #1: Type: text/plain, Size: 263 bytes --]

Hi Emacs-hackers,

It happens often enough that I want to search for a word that is *before* the
point.  Isearch already allows yanking the word/line after the point into the
minibuffer, so I extended isearch in the same manner for before-point yanking.

	Hannes

[-- Attachment #2: emacs-isearch-yank-before-point.patch --]
[-- Type: text/x-diff, Size: 1615 bytes --]

diff -Naur emacs.orig/lisp/isearch.el emacs/lisp/isearch.el
--- emacs.orig/lisp/isearch.el	2007-08-21 17:51:40.000000000 +0200
+++ emacs/lisp/isearch.el	2007-08-21 17:52:40.000000000 +0200
@@ -371,9 +371,11 @@
     (define-key map [?\S-\ ] 'isearch-printing-char)
 
     (define-key map    "\C-w" 'isearch-yank-word-or-char)
+    (define-key map    "\C-b" 'isearch-yank-word-before-point)
     (define-key map "\M-\C-w" 'isearch-del-char)
     (define-key map "\M-\C-y" 'isearch-yank-char)
     (define-key map    "\C-y" 'isearch-yank-line)
+    (define-key map    "\C-l" 'isearch-yank-line-before-point)
 
     ;; Turned off because I find I expect to get the global definition--rms.
     ;; ;; Instead bind C-h to special help command for isearch-mode.
@@ -1371,6 +1373,11 @@
   (interactive)
   (isearch-yank-internal (lambda () (forward-word 1) (point))))
 
+(defun isearch-yank-word-before-point ()
+  "Pull previous word from buffer into search string."
+  (interactive)
+  (isearch-yank-internal (lambda () (backward-word) (point))))
+
 (defun isearch-yank-line ()
   "Pull rest of line from buffer into search string."
   (interactive)
@@ -1378,6 +1385,13 @@
    (lambda () (let ((inhibit-field-text-motion t))
 		(line-end-position (if (eolp) 2 1))))))
 
+(defun isearch-yank-line-before-point ()
+  "Pull whole line up to point into search string."
+  (interactive)
+  (isearch-yank-internal
+   (lambda () (let ((inhibit-field-text-motion t))
+		(line-beginning-position (if (bolp) 0 1))))))
+
 (defun isearch-search-and-update ()
   ;; Do the search and update the display.
   (when (or isearch-success

[-- 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] 12+ messages in thread

end of thread, other threads:[~2007-08-23 19:41 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-08-21 15:59 [PATCH] Isearch: yanking before point Johannes Weiner
2007-08-22  3:15 ` Richard Stallman
2007-08-22  3:33   ` Johannes Weiner
2007-08-22  7:25     ` Tassilo Horn
2007-08-22 14:20       ` Johannes Weiner
2007-08-23  0:45         ` Richard Stallman
2007-08-22 15:17       ` Stefan Monnier
2007-08-23  5:56         ` Stefan Reichör
2007-08-23  6:15           ` David Kastrup
2007-08-23 19:41           ` Peter Lee
2007-08-22 15:08 ` Johan Bockgård
2007-08-23  0:45   ` Richard Stallman

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.