emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* RFI -- Which completion system?
@ 2010-10-21 21:16 Sébastien Vauban
  2010-10-22  7:48 ` Tassilo Horn
  2010-10-22 10:24 ` Eric S Fraga
  0 siblings, 2 replies; 3+ messages in thread
From: Sébastien Vauban @ 2010-10-21 21:16 UTC (permalink / raw)
  To: emacs-orgmode-mXXj517/zsQ

Hello,

Before spending a lot of time trying to choose for the "best" completion
mechanism inside Emacs (and sticking to it), setting it up all the way
through, I wanted to know if you had had:

- particularly good or bad experiences with one of the "standard" ones?

- things to notice regarding the integration with Org?

From the many that do exist -- and which conflict in my =.emacs= file! --,
I've spotted the following ones of being of real interest:

- dabbrev
- hippie-expand
- pabbrev
- company

Any comment on this?

Best regards,
  Seb

-- 
Sébastien Vauban


_______________________________________________
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode-mXXj517/zsQ@public.gmane.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode

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

* Re: RFI -- Which completion system?
  2010-10-21 21:16 RFI -- Which completion system? Sébastien Vauban
@ 2010-10-22  7:48 ` Tassilo Horn
  2010-10-22 10:24 ` Eric S Fraga
  1 sibling, 0 replies; 3+ messages in thread
From: Tassilo Horn @ 2010-10-22  7:48 UTC (permalink / raw)
  To: emacs-orgmode

Sébastien Vauban <wxhgmqzgwmuf@spammotel.com>
writes:

Hi Seb,

> Before spending a lot of time trying to choose for the "best"
> completion mechanism inside Emacs (and sticking to it), setting it up
> all the way through, I wanted to know if you had had:
>
> - particularly good or bad experiences with one of the "standard" ones?
>
> - things to notice regarding the integration with Org?
>
> From the many that do exist -- and which conflict in my =.emacs= file! --,
> I've spotted the following ones of being of real interest:
>
> - dabbrev
> - hippie-expand

I use the former through the latter and bound M-/ to `hippie-expand'
instead of the normal `dabbrev-expand'.  In addition to the dabbrev
expand facility, I've teached my hippie-expand to also complete elisp
symbols, buffers, file names, and solve mathematical formulas:

  3 + 5 * 7 = <M-/>
  3 + 5 * 7 = 38

Cool! ;-)

Here's my config (the math stuff is stolen from someone):

--8<---------------cut here---------------start------------->8---
(global-set-key (kbd "M-/") 'hippie-expand)

(defun my-try-complete-with-calc-result (arg)
  "complete `3 + 4 = <TAB>' to `3 + 4 = 7'.
Great stuff by Michele Bini.
http://www.emacswiki.org/cgi-bin/emacs-en/MicheleBini"
  (and
   (not arg) (eolp)
   (save-excursion
     (beginning-of-line)
     (when (and (boundp 'comment-start)
		comment-start)
       (when (looking-at
	      (concat
	       "[ \n\t]*"
	       (regexp-quote comment-start)))
	 (goto-char (match-end 0))
	 (when (looking-at "[^\n\t ]+")
	   (goto-char (match-end 0)))))
     (looking-at ".* \\(\\([;=]\\) +$\\)"))
   (save-match-data
     (require 'calc-ext nil t))
   ;;(require 'calc-aent)
   (let ((start (match-beginning 0))
	 (op (match-string-no-properties 2)))
     (save-excursion
       (goto-char (match-beginning 1))
       (if (re-search-backward (concat "[\n" op "]") start t)
	   (goto-char (match-end 0)) (goto-char start))
       (looking-at (concat " *\\(.*[^ ]\\) +" op "\\( +\\)$"))
       (goto-char (match-end 2))
       (let* ((b (match-beginning 2))
	      (e (match-end 2))
	      (a (match-string-no-properties 1))
	      (r (calc-do-calc-eval a nil nil)))
	 (when (string-equal a r)
	   (let ((b (save-excursion
		      (and (search-backward "\n\n" nil t)
			   (match-end 0))))
		 (p (current-buffer))
		 (pos start)
		 (s nil))
	     (setq r
		   (calc-do-calc-eval
		    (with-temp-buffer
		      (insert a)
		      (goto-char (point-min))
		      (while (re-search-forward
			      "[^0-9():!^ \t-][^():!^ \t]*" nil t)
			(setq s (match-string-no-properties 0))
			(let ((r
			       (save-match-data
				 (save-excursion
				   (set-buffer p)
				   (goto-char pos)
				   (and
				    ;; TODO: support for line indentation
				    (re-search-backward
				     (concat "^" (regexp-quote s)
					     " =")
				     b t)
				    (progn
				      (end-of-line)
				      (search-backward "=" nil t)
				      (and (looking-at "=\\(.*\\)$")
					   (match-string-no-properties 1))))))))
			  (if r (replace-match (concat "(" r ")") t t))))
		      (buffer-substring (point-min) (point-max)))
		    nil nil))))
	 (and
	  r
	  (progn
	    (he-init-string b e)
	    (he-substitute-string (concat " " r))
	    t)))))))

(setq hippie-expand-try-functions-list '(try-complete-file-name
					 my-try-complete-with-calc-result
					 try-expand-dabbrev
					 try-complete-lisp-symbol
					 try-expand-dabbrev-all-buffers))
--8<---------------cut here---------------end--------------->8---

> - pabbrev
> - company

I've not tried those, but I also have auto-complete enabled globally,
which shows nice, unobstrusive overlay completion popups.  Basically
it's great and I've also written an intelligent completion function for
a language we're developing here at my University which was pretty easy
to do.  But auto-complete has some bugs and glitches which I've reported
at its bugtracker.  Sadly, it seems to me that its author has no time to
fix those, at least he didn't respond to my reports since 5 months...

Bye,
Tassilo

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

* Re: RFI -- Which completion system?
  2010-10-21 21:16 RFI -- Which completion system? Sébastien Vauban
  2010-10-22  7:48 ` Tassilo Horn
@ 2010-10-22 10:24 ` Eric S Fraga
  1 sibling, 0 replies; 3+ messages in thread
From: Eric S Fraga @ 2010-10-22 10:24 UTC (permalink / raw)
  To: Sébastien Vauban; +Cc: emacs-orgmode

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

On Thu, 21 Oct 2010 23:16:19 +0200, Sébastien Vauban <wxhgmqzgwmuf@spammotel.com> wrote:
> 
> Hello,
> 
> Before spending a lot of time trying to choose for the "best" completion
> mechanism inside Emacs (and sticking to it), setting it up all the way
> through, I wanted to know if you had had:
> 
> - particularly good or bad experiences with one of the "standard" ones?

I've tried a number over the years.  I've yet to reach a situation
where I am particularly happy with any of them but the one that seems
to work best *for me* so far is hippie.

I have the following settings (having just added Tassilo's expansion
function for calc which is brilliant!):

--8<---------------cut here---------------start------------->8---
(setq hippie-expand-try-functions-list
      '(;;yas/hippie-try-expand
	th/my-try-complete-with-calc-result
        try-expand-all-abbrevs
	try-expand-dabbrev
        try-expand-dabbrev-all-buffers
        try-expand-dabbrev-from-kill
        try-complete-file-name
        try-complete-lisp-symbol))
--8<---------------cut here---------------end--------------->8---

I no longer use yasnippets as they interfered too much with completion
in general.  

I have bound hippie-expand to C-; as I find this a lot easier to type
than M-/.  I also have TAB bound to the following:

--8<---------------cut here---------------start------------->8---
(defun esf/indent-or-expand (arg)
  "Either indent according to mode, or expand the word preceding point."
  (interactive "*P")
  (if (and
       (or (bobp) (= ?w (char-syntax (char-before))))
       (or (eobp) (not (= ?w (char-syntax (char-after))))))
      ;;(dabbrev-expand arg)
      (hippie-expand arg)
    (indent-according-to-mode)))
--8<---------------cut here---------------end--------------->8---

in most text buffers.  This means that TAB no longer does what it
should in org mode but I use C-i for that functionality as most of the
time I am typing text and not moving things around.

HTH,
eric

[-- Attachment #2: Type: text/plain, Size: 75 bytes --]

-- 
Eric S Fraga
GnuPG: 8F5C 279D 3907 E14A 5C29  570D C891 93D8 FFFC F67D

[-- Attachment #3: Type: text/plain, Size: 201 bytes --]

_______________________________________________
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode

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

end of thread, other threads:[~2010-10-22 10:24 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-10-21 21:16 RFI -- Which completion system? Sébastien Vauban
2010-10-22  7:48 ` Tassilo Horn
2010-10-22 10:24 ` Eric S Fraga

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.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).