[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Code completion
From: |
Noah Slater |
Subject: |
Re: Code completion |
Date: |
Fri, 23 Jun 2006 21:34:01 +0100 |
Try putting the following in your ~/.emacs file (customise project
specific details):
;;; Tags
;; When revisiting the tag file, do not prompt to reload.
(setq tags-revert-without-query t)
(defun rebuild-tags (project-name directory-name tags-file)
"Rebuild tags-file for directory-name."
(eshell-command (format "find %s -type f -name '*.py' | etags -o %s -"
directory-name tags-file))
(message "Rebuilt %s tags file." project-name))
(defun remember-find-tag (tagname)
"Call `find-tag' and remember `last-tag'."
(interactive
(if (bound-and-true-p last-tag)
(list nil)
(list (find-tag-tag "Find tag: "))))
(find-tag tagname t))
(defun indent-or-complete ()
"Complete if point is at the end of a word, otherwise indent line."
(interactive)
(if (looking-at "\\>")
(dabbrev-expand nil)
(indent-for-tab-command)))
;; Key more commonly bound to `indent-for-tab-command' command.
(global-set-key (kbd "TAB") 'indent-or-complete)
;; Key more commonly bound to `forward-char' command.
(global-set-key (kbd "C-f") 'remember-find-tag)
;; Key more commonly bound to `backward-char' command.
(global-set-key (kbd "C-b") 'pop-tag-mark)
; ;; Key more commonly bound to `next-line' command.
(global-set-key (kbd "C-n") 'find-tag-other-window)
;; Key more commonly bound to `previous-line' command.
(global-set-key (kbd "C-p") 'tags-apropos)
(defvar my-project-tags-file
"/path/to/my/project/etags_file"
"My project tags file.")
(defun my-project-build-tags ()
"Build my project tags file."
(interactive)
(rebuild-tags "My Project"
"/path/to/my/project"
hyperbind-tags-file))
;; Visit tags table and rebuild after every save.
(visit-tags-table my-project-tags-file)
(add-hook 'after-save-hook 'my-project-build-tags)
--
"Creativity can be a social contribution, but only in so
far as society is free to use the results." - R. Stallman
- Code completion, Jorge Peixoto de Morais Neto, 2006/06/23
- Re: Code completion,
Noah Slater <=