emacs-devel
[Top][All Lists]
Advanced

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

Re: key to yank text at point into minibuffer?


From: Kevin Rodgers
Subject: Re: key to yank text at point into minibuffer?
Date: Tue, 14 Feb 2006 08:53:58 -0700
User-agent: Mozilla Thunderbird 0.9 (X11/20041105)

Drew Adams wrote:
>     ffap.el itself says:
>
>     ;; For the default installation, add this line to your .emacs file:
>     ;;
>     ;; (ffap-bindings)                      ; do default key bindings
>     ;;
>     ;; ffap-bindings makes the following global key bindings:
>     ...
>     ;; If you do not like these bindings, modify the variable
>     ;; `ffap-bindings', or write your own.
>
>     That last part is muy importante.
>
> Yes, I read that. That was why I suggested that ffap instead have a minor
> mode. I'm not crazy about that way of turning a set of bindings on.

I agree, and I like your minor mode idea.

>     > I no longer use ffap.el, but when I did, I added an option to
> > inhibit it, and set the option as a local variable when in Dired mode.
>     > That might be overkill, but it accomplished what I wanted.
>
>     I think that would be a userful feature.
>
> I think ffap.el should instead have a minor mode with its own keymap.

Is it as simple as this:

(defvar ffap-mode-map
  (let ((map (make-sparse-keymap)))
     ;; see ffap-bindings:

     (define-key map [S-mouse-3] 'ffap-at-mouse)
     (define-key map [C-S-mouse-3] 'ffap-menu)

     (define-key map "\C-x\C-f" 'find-file-at-point)
     (define-key map "\C-x\C-r" 'ffap-read-only)
     (define-key map "\C-x\C-v" 'ffap-alternate-file)

     (define-key map "\C-x4f"   'ffap-other-window)
     (define-key map "\C-x5f"   'ffap-other-frame)
     (define-key map "\C-x4r"   'ffap-read-only-other-window)
     (define-key map "\C-x5r"   'ffap-read-only-other-frame)

     (define-key map "\C-xd"    'dired-at-point)
     (define-key map "\C-x4d"   'ffap-dired-other-window)
     (define-key map "\C-x5d"   'ffap-dired-other-frame)
     (define-key map "\C-x\C-d" 'ffap-list-directory)

     ;; (add-hook 'gnus-summary-mode-hook 'ffap-gnus-hook)
     ;; (add-hook 'gnus-article-mode-hook 'ffap-gnus-hook)
     ;; (add-hook 'vm-mode-hook 'ffap-ro-mode-hook)
     ;; (add-hook 'rmail-mode-hook 'ffap-ro-mode-hook)

     map))

(defvar ffap-mode-hook nil
  "Hook run by `ffap-mode'.")

(define-minor-mode ffap-mode
  "Toggle `ffap' bindings in every buffer.

\\{ffap-mode-map}"
  :global t :lighter ""
  (run-hooks 'ffap-mode-hook))

> (BTW, I like "userful" for "user useful", whether it was a typo or not.)

It was a typo, but a serendipitous one.  I was going to add it to
Wikipedia's list of portmanteau words, but then Google pointed me to
userful.com, a company that markets a GNU/Linux-based PC for public
places like libraries.

--
Kevin Rodgers





reply via email to

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