unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: Antoine Levitt <antoine.levitt@gmail.com>
Cc: emacs-devel@gnu.org
Subject: Re: ERC completion
Date: Mon, 02 May 2011 12:02:08 -0300	[thread overview]
Message-ID: <jwvmxj5duan.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <87wriciwnc.fsf@gmail.com> (Antoine Levitt's message of "Fri, 29 Apr 2011 22:50:58 +0200")

> Nowadays, I have in my .emacs the following, which actually works fine
> but which I now realize is utterly wrong :)

> (setq tab-always-indent 'complete)
> (defun my-dabbrev-expand ()
>   (when (and (not (bolp))
> 	     (looking-at "\\_>"))
>     (dabbrev-expand nil)))
> (defun my-dabbrev-expand-and-nil ()
>   (my-dabbrev-expand)
>   nil)

Why my-dabbrev-expand-and-nil?

> (setq completion-at-point-functions '(my-dabbrev-expand-and-nil))

`setq' on a hook is almost always the wrong thing to do.
Either use `setq-default' here if you really intend to throw away the
default global completion functions, or otherwise use something like:

(add-hook 'completion-at-point-functions 'my-dabbrev-expand 'append)

> I seem to recall talks of priority for completions. Couldn't that be
> used here? That way, I'd set completion-at-point-functions to something
> that returns the list of dabbrev expands with a low priority, and every
> other completion would take precedence over it.

By placing it at the end of the hook, you're giving it the lowest priority.

> Yes it does. It does change the semantics of
> erc-pcomplete-nick-postfix though, by adding an extra space
> automatically. I guess nobody will ever need to complete without
> a space, so that's fine.

Every other erc-pcomplete completion adds a space, so it shouldn't be
too much of a surprise,


        Stefan



  reply	other threads:[~2011-05-02 15:02 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-27 18:58 ERC completion Antoine Levitt
2011-04-28  0:18 ` Stefan Monnier
2011-04-28 10:44   ` Antoine Levitt
2011-04-28 19:34     ` Stefan Monnier
2011-04-28 19:48       ` Antoine Levitt
2011-04-29  0:50         ` Stefan Monnier
2011-04-29  7:43           ` Antoine Levitt
2011-04-29 15:20             ` Stefan Monnier
2011-04-29 20:50               ` Antoine Levitt
2011-05-02 15:02                 ` Stefan Monnier [this message]
2011-05-02 15:19                   ` Antoine Levitt
2011-05-02 18:04                     ` Stefan Monnier
2011-05-02 21:29                       ` Antoine Levitt
2011-05-03  0:47                         ` Stefan Monnier

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

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=jwvmxj5duan.fsf-monnier+emacs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=antoine.levitt@gmail.com \
    --cc=emacs-devel@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 public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).