Pages

Showing posts with label completion. Show all posts
Showing posts with label completion. Show all posts

Wednesday, October 12, 2011

ido-mode and virtual buffers

Every now and again you come across something in Emacs and slap your forehead and say "why didn't I notice that before". ido-mode is one, but the setting ido-use-virtual-buffers really makes it. The concept is simple : ido-mode remembers all your past buffers so all you need to do is "C-x b" (ido-switch-buffer) and start to type the filename and ido will complete to it having remembered it from previous sessions. No need to use C-x C-f and possibly the ido find facility any more - just type the mainpart of the filename or part of it. Incredible cool time saver and very very useful.

From the Manual

ido-use-virtual-buffers is a variable defined in `ido.el'.
Its value is t
Original value was nil

Documentation:
If non-nil, refer to past buffers as well as existing ones.
Essentially it works as follows: Say you are visiting a file and
the buffer gets cleaned up by mignight.el. Later, you want to
switch to that buffer, but find it's no longer open. With
virtual buffers enabled, the buffer name stays in the buffer
list (using the `ido-virtual' face, and always at the end), and if
you select it, it opens the file back up again. This allows you
to think less about whether recently opened files are still open
or not. Most of the time you can quit Emacs, restart, and then
switch to a file buffer that was previously open as if it still
were.
This feature relies upon the `recentf' package, which will be
enabled if this variable is configured to a non-nil value.


my ido settings are currently:-

 '(ido-create-new-buffer (quote never))
'(ido-enable-flex-matching t)
'(ido-enable-last-directory-history nil)
'(ido-enable-regexp nil)
'(ido-max-directory-size 300000)
'(ido-max-file-prompt-width 0.1)
'(ido-use-filename-at-point (quote guess))
'(ido-use-url-at-point t)
'(ido-use-virtual-buffers t)

Saturday, June 11, 2011

enabling gtags auto tag completion in Global compatible modes

(require 'gtags)
(defun gtags-root-dir ()
"Returns GTAGS root directory or nil if doesn't exist."
(with-temp-buffer
(if (zerop (call-process "global" nil t nil "-pr"))
(buffer-substring (point-min) (1- (point-max)))
nil)))
(defun gtags-update ()
"Make GTAGS incremental update"
(message "updating GLOBAL tags using gtags -i ..")
(call-process "gtags" nil nil nil "-i -f gtags.files")
(gtags-make-complete-list))

(defun gtags-update-global ()
"Make GTAGS incremental update"
(message "updating GLOBAL tags!!")
(call-process "global" nil nil nil "-u")
(gtags-make-complete-list))

(defun gtags-update-hook ()
(when (gtags-root-dir)
(when (memq major-mode (list 'php-mode 'c-mode 'org-mode 'javascript-mode 'js-mode 'emacs-lisp-mode))
(progn (message "global root : %s" (gtags-root-dir))(gtags-update-global)))))
(add-hook 'after-save-hook 'gtags-update-hook)

(defadvice gtags-find-tag (before gtags-make-complete-list activate)
"Make Global completion tags" (unless gtags-complete-list (gtags-make-complete-list)))

(add-hook 'php-mode-hook '(lambda () (gtags-mode t)))
(add-hook 'c-mode-hook '(lambda () (gtags-mode t)))

(provide 'rgr-gtags)




--
My Emacs Files At GitHub

Saturday, June 13, 2009

Emacs Python IDE

I finally got emacs working properly with the excellent company-mode. But I have to think this guy:

http://www.enigmacurry.com/2009/01/21/autocompleteel-python-code-completion-in-emacs/

For some reason the rope/ropemacs/ropemode documentation is pretty inconsistent and hard to find. Installing it from mercurial as described in the article above did it.

company-mode supports rope and pysmell now out of the box.

See my emacs python integration here:

http://richardriley.net/projects/emacs/dotprogramming

rope etc is loaded by company-mode.