# HG changeset patch # User Oleksandr Gavenko # Date 1421101186 -7200 # Node ID 14d42e7c9224b669141ed793d651aec629f33980 # Parent 4f46f97a10e90b51395c06634f9bd1b8ddba5d7b my-complete-tag with my-ido-complete-tag. diff -r 4f46f97a10e9 -r 14d42e7c9224 .emacs-my --- a/.emacs-my Sat Jan 10 16:56:35 2015 +0200 +++ b/.emacs-my Tue Jan 13 00:19:46 2015 +0200 @@ -2308,7 +2308,27 @@ ) (setq tags-add-tables t) -(global-set-key [M-return] 'complete-tag) + +(defvar my-ido-tag-history nil + "History of tags selected using `my-ido-complete-tag'.") +(defun my-ido-complete-tag (&optional substr) + "Find a tag using ido." + (tags-completion-table) + (let ( tag-names ) + (mapatoms (lambda (x) (push (symbol-name x) tag-names)) tags-completion-table) + (ido-completing-read "Tag: " tag-names nil t substr 'my-ido-tag-history))) +(defun my-complete-tag (prefix point) + (interactive "P\nd") + (if prefix + (funcall #'complete-tag) + (let ( (bounds (find-tag-default-bounds)) tag ) + (if (or (not bounds) (< point (car bounds)) (< (cdr bounds) point)) + (setq tag (my-ido-complete-tag)) + (setq tag (my-ido-complete-tag (buffer-substring (car bounds) (cdr bounds)))) + (delete-region (car bounds) (cdr bounds))) + (insert tag)))) + +(global-set-key [M-return] #'my-complete-tag) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (message "CEDET, semantic, SRecord")