emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Org Mdoe Auto Complete Source
@ 2008-12-16 19:31 Jonathan Arkell
  2008-12-17  8:32 ` Carsten Dominik
  0 siblings, 1 reply; 3+ messages in thread
From: Jonathan Arkell @ 2008-12-16 19:31 UTC (permalink / raw)
  To: emacs-orgmode@gnu.org

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

Hi list!

I have just finished a little something to hook org mode into the auto-complete.  Right now it does a verbatim copy of most of org-complete (which is bad).  Carsten, would it be possible to separate the gathering of completion candidates from the actual UI, that way other completion systems can be hooked in?  (Anything, Auto-Complete, etc.)

Enjoy!

Jonathan Arkell
Sr. Web Developer
Inspired by Drum + Bass, Scheme, Kawaii
402 – 11 Avenue SE
Calgary, AB T2G 0Y4
t: 403.206.4377
www.criticalmass.com


The information contained in this message is confidential. It is intended to be read only by the individual or entity named above or their designee. If the reader of this message is not the intended recipient, you are hereby notified that any distribution of this message, in any form, is strictly prohibited. If you have received this message in error, please immediately notify the sender and delete or destroy any copy of this message.

[-- Attachment #2: auto-complete-org.el --]
[-- Type: application/octet-stream, Size: 2770 bytes --]

(defvar ac-org-candidates nil)
(defvar ac-org-pattern nil)
(defun ac-org-construct-candidates ()
  "Pabbrev source for org."
  (let* ((end (point))
	 (beg1 (save-excursion
		(skip-chars-backward (org-re "[:alnum:]_@"))
		(point)))
	 (beg (save-excursion
	       (skip-chars-backward "a-zA-Z0-9_:$")
	       (point)))
	 (confirm (lambda (x) (stringp (car x))))
	 (searchhead (equal (char-before beg) ?*))
	 (struct
	  (when (and (member (char-before beg1) '(?. ?<))
		     (setq a (assoc (buffer-substring beg1 (point))
				    org-structure-template-alist)))
		(org-complete-expand-structure-template (1- beg1) a)
		(throw 'exit t)))
	 (tag (and (equal (char-before beg1) ?:)
		   (equal (char-after (point-at-bol)) ?*)))
	 (prop (and (equal (char-before beg1) ?:)
		    (not (equal (char-after (point-at-bol)) ?*))))
	 (texp (equal (char-before beg) ?\\))
	 (link (equal (char-before beg) ?\[))
	 (opt (equal (buffer-substring (max (point-at-bol) (- beg 2))
				       beg)
		     "#+"))
	 (startup (string-match "^#\\+STARTUP:.*"
				(buffer-substring (point-at-bol) (point))))
	 (completion-ignore-case opt)
	 (type nil)
	 (tbl nil)
	 (table (cond
		 (opt
		  (setq type :opt)
		  (require 'org-exp)
		  (append
		   (mapcar
		    (lambda (x)
		      (string-match "^#\\+\\(\\([A-Z_]+:?\\).*\\)" x)
		      (cons (match-string 2 x) (match-string 1 x)))
		    (org-split-string (org-get-current-options) "\n"))
		   (mapcar 'list org-additional-option-like-keywords)))
		 (startup
		  (setq type :startup)
		  org-startup-options)
		 (link (append org-link-abbrev-alist-local
			       org-link-abbrev-alist))
		 (texp
		  (setq type :tex)
		  org-html-entities)
		 ((string-match "\\`\\*+[ \t]+\\'"
				(buffer-substring (point-at-bol) beg))
		  (setq type :todo)
		  (mapcar 'list org-todo-keywords-1))
		 (searchhead
		  (setq type :searchhead)
		  (save-excursion
		   (goto-char (point-min))
		   (while (re-search-forward org-todo-line-regexp nil t)
			  (push (list
				 (org-make-org-heading-search-string
				  (match-string 3) t))
				tbl)))
		  tbl)
		 (tag (setq type :tag beg beg1)
		      (or org-tag-alist (org-get-buffer-tags)))
		 (prop (setq type :prop beg beg1)
		       (mapcar 'list (org-buffer-property-keys nil t t)))
		 (t (progn
		     (call-interactively org-completion-fallback-command)
		     (throw 'exit nil))))))
    (setq ac-org-pattern (buffer-substring-no-properties beg end))
    table))

(defvar ac-source-org nil)
(setq ac-source-org
      `((sigil . "o")
	(init . (lambda () (setq ac-org-candidates
				 (condition-case nil
						 (ac-org-construct-candidates)))))
	(candidates . (lambda ()
			(all-completions ac-target ac-org-candidates)))))


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

_______________________________________________
Emacs-orgmode mailing list
Remember: 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

* Re: Org Mdoe Auto Complete Source
  2008-12-16 19:31 Org Mdoe Auto Complete Source Jonathan Arkell
@ 2008-12-17  8:32 ` Carsten Dominik
  2008-12-17 16:13   ` Jonathan Arkell
  0 siblings, 1 reply; 3+ messages in thread
From: Carsten Dominik @ 2008-12-17  8:32 UTC (permalink / raw)
  To: Jonathan Arkell; +Cc: emacs-orgmode@gnu.org

Hi Jonathan,

I cannot get this to work yet, what do I need to do in make auto- 
complete use this?

- Carsten

On Dec 16, 2008, at 8:31 PM, Jonathan Arkell wrote:

> Hi list!
>
> I have just finished a little something to hook org mode into the  
> auto-complete.  Right now it does a verbatim copy of most of org- 
> complete (which is bad).  Carsten, would it be possible to separate  
> the gathering of completion candidates from the actual UI, that way  
> other completion systems can be hooked in?  (Anything, Auto- 
> Complete, etc.)
>
> Enjoy!
>
> Jonathan Arkell
> Sr. Web Developer
> Inspired by Drum + Bass, Scheme, Kawaii
> 402 – 11 Avenue SE
> Calgary, AB T2G 0Y4
> t: 403.206.4377
> www.criticalmass.com
>
>
> The information contained in this message is confidential. It is  
> intended to be read only by the individual or entity named above or  
> their designee. If the reader of this message is not the intended  
> recipient, you are hereby notified that any distribution of this  
> message, in any form, is strictly prohibited. If you have received  
> this message in error, please immediately notify the sender and  
> delete or destroy any copy of this message.
> <auto-complete-org.el>_______________________________________________
> Emacs-orgmode mailing list
> Remember: 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

* RE: Org Mdoe Auto Complete Source
  2008-12-17  8:32 ` Carsten Dominik
@ 2008-12-17 16:13   ` Jonathan Arkell
  0 siblings, 0 replies; 3+ messages in thread
From: Jonathan Arkell @ 2008-12-17 16:13 UTC (permalink / raw)
  To: Carsten Dominik; +Cc: emacs-orgmode@gnu.org

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

Hi Carsten,

Just to be clear, you have to use the auto-complete.el package by Matsuyama Tomohiro.  (http://www.emacswiki.org/emacs/AutoComplete)

I've been able to make auto-complete work by calling the ac-start command directly, but something is happening to the post-command hooks that don't allow it to pop up.  I am still trying to discern whether or not it is an issue with auto-complete, something I have done to it, org-mode or even some other emacs configuration issue.

-----Original Message-----
From: Carsten Dominik [mailto:carsten.dominik@gmail.com] On Behalf Of Carsten Dominik
Sent: Wednesday, December 17, 2008 1:33 AM
To: Jonathan Arkell
Cc: emacs-orgmode@gnu.org
Subject: Re: [Orgmode] Org Mdoe Auto Complete Source

Hi Jonathan,

I cannot get this to work yet, what do I need to do in make auto-
complete use this?

- Carsten

On Dec 16, 2008, at 8:31 PM, Jonathan Arkell wrote:

> Hi list!
>
> I have just finished a little something to hook org mode into the
> auto-complete.  Right now it does a verbatim copy of most of org-
> complete (which is bad).  Carsten, would it be possible to separate
> the gathering of completion candidates from the actual UI, that way
> other completion systems can be hooked in?  (Anything, Auto-
> Complete, etc.)
>
> Enjoy!
>
> Jonathan Arkell
> Sr. Web Developer
> Inspired by Drum + Bass, Scheme, Kawaii
> 402 – 11 Avenue SE
> Calgary, AB T2G 0Y4
> t: 403.206.4377
> www.criticalmass.com
>
>
> The information contained in this message is confidential. It is
> intended to be read only by the individual or entity named above or
> their designee. If the reader of this message is not the intended
> recipient, you are hereby notified that any distribution of this
> message, in any form, is strictly prohibited. If you have received
> this message in error, please immediately notify the sender and
> delete or destroy any copy of this message.
> <auto-complete-org.el>_______________________________________________
> Emacs-orgmode mailing list
> Remember: use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode


The information contained in this message is confidential. It is intended to be read only by the individual or entity named above or their designee. If the reader of this message is not the intended recipient, you are hereby notified that any distribution of this message, in any form, is strictly prohibited. If you have received this message in error, please immediately notify the sender and delete or destroy any copy of this message.

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

_______________________________________________
Emacs-orgmode mailing list
Remember: 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:[~2008-12-17 16:15 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-12-16 19:31 Org Mdoe Auto Complete Source Jonathan Arkell
2008-12-17  8:32 ` Carsten Dominik
2008-12-17 16:13   ` Jonathan Arkell

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).