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

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

Re: predictive.el -- New Release


From: Phillip Lord
Subject: Re: predictive.el -- New Release
Date: Wed, 03 May 2006 14:44:15 +0100
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (windows-nt)

>>>>> "TC" == Toby Cubitt <address@hidden> writes:

  TC> On Tue, May 02, 2006 at 07:29:33PM +0200, David Hansen wrote:
  >> Nice work.

  TC> Thanks!

  >> Just a note: rebinding RET is IMHO a very bad idea.  In
  >> programming modes i have bound it to
  >> `reindent-then-newline-and-indent' and e.g. rcirc won't work with
  >> predictive at all (RET is bound to `rcirc-send-input').

  TC> You're right, of course.

  TC> Trouble is, I have to rebind RET or the whole dynamic completion
  TC> mechanism gets screwed up. I'll see what I can do about making
  TC> RET sort out any dynamic completion, and then run whatever it
  TC> would have been bound to otherwise.

  TC> Shouldn't be too difficult, since I already have a macro that
  TC> does something very similar. But I wonder if there's a standard
  TC> solution to this? (Defadvice won't help, since I'd have to
  TC> advise every function that might be bound to RET!)

I has the same problem with pabbrev.el, although I bind tab. What I
tried to do is drop through to the underlying command when there was
no completion. This ofter works well, but fails if you are, for
instance indenting five lines by doing "tab,down,tab,down" repeat. You
end up doing a completion by mistake on one line. 

But I've had endless problems getting this working; keybinding in
emacs is harder than it should be. In the end, I've gone for this.

(defun pabbrev-get-previous-binding ()
  "Show the binding of tab if pabbrev were not active.
The command `pabbrev-show-previous-binding' prints this out."
  (let ((pabbrev-mode nil))
    ;; This is the original and satisfying solution
    ;;(key-binding (char-to-string last-command-event)))))
    
    ;; This is the new and unsatisfying one. The
    ;; keybindings are hard coded here, because I defined
    ;; [tab] and \t earlier. Both are tab, but the former
    ;; gets used in preference to the later. 
    (or (key-binding [tab])
        (key-binding "\t"))))
             


BTW, glad to see that you have factored the completion code out; I
should have done this with pabbrev years ago. I'm sure other people
would have found it useful. 

Cheers

Phil


reply via email to

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