Open guoqinglei opened 2 years ago
I have found some commands: isearch-forward-symbol-at-point and swiper-thing-at-point, it's almost well although not perfect.
The remaining question is: how to use the counsel-etags-find-tag-at-point to search the tag of Macro in verilog projects ? It's a little special that the Macro in verilog always comes with a prefix `.
I think counsel-etags-find-tag-at-point need to ignore the first character ` when do the job in minor mode of verilog.
You can change ~/.ctags
, add your own regular expression to parse new tags. See https://github.com/redguardtoo/counsel-etags#ctags-setup
Besides, you can write Emacs Lisp to update TAGS
, see https://github.com/redguardtoo/counsel-etags#insert-extra-content-into-tags-file-after-its-updated
I think the problem may still exist for me. Actually I still prefer to improve the function of counsel-etags-find-tag-at-point. For string " `MACRO " in the verilog code, when the mouse point is at character "M", the tag this command will get is actually "`MACRO" instead of "MACRO", here the character "`" is the cause of the problem. Then the question is: how to ignore the special character such as "`" in verilog when we want to get the tag of the point ?
You can customise counsel-etags-find-tag-name-function
.
I may get what you mean. Maybe I need to modify the function counsel-etags-find-tag-name-default defined as follow:
(defun counsel-etags-find-tag-name-default ()
"Find tag at point."
(let ((tag-name (find-tag-default)))
(when (and (memq major-mode
counsel-etags-major-modes-to-strip-default-tag-name)
(string-match "^\\(`.*`\\|=.*=\\|~.*~\\|\".*\"\\|'.*'\\)$" tag-name))
(setq tag-name (substring tag-name 1 (1- (length tag-name)))))
tag-name))
The key point is to modify the lines with "string-match", is that right ?
Yes. The tag name at point is found here. It's used as a keyword for searching the TAGS file.
The emacs.d from redguardtoo is the config I have been using for over three months. One of the reasons I like this is the fast start speed and proved high programming efficiency. Recently, I want to use this config to develop some verilog projects. However, this config is not suitable in some cases. For example, when I press C-] at the point of a Macro, i.e., `DEF_MACRO, it reported "No tag is found. Grep "`DEF_MACRO" at directory: /bin/bash: -c: line 0: unexpected EOF while looking for matching `.
I wonder what I could do to fix it.
Another similar feature I am eagerly to want is that I usually need to search the variable/word at point . I know the command counsel-etags-find-tag-at-point can be used, but It only shows some definitions of this variable/word. Actually, I want to know all the occcurences of the variable/word in the buffer, just like the way of swiper or occur command works. Is there a command like swiper-at-point or occur-at-point ?