我一直在寻找互联网,并没有提出解决方案。有没有人知道如何跳转到html文件中的css声明,并打开一个新的缓冲区,该点是否接近该声明?
经过更多搜索后,我决定使用搜索打开缓冲区进行字符串处理。
;; CSS search open buffers
(defun search-open-css-buffers-for-region-or-word ()
"Use the current region/point and search open css buffers"
(interactive)
(let (searchTerm)
(setq searchTerm
(if (region-active-p)
(buffer-substring-no-properties (region-beginning) (region-end))
(thing-at-point 'symbol)))
(multi-occur (mapcar (lambda (buf)
(if (string-match "\w*.css" (buffer-name buf))
buf)) (buffer-list))
searchTerm 5)))
(global-set-key (kbd "M-s-.") 'search-open-css-buffers-for-region-or-word)
虽然感觉这是一个黑客。
答案 0 :(得分:3)
有一些事情使得这种非一般化:
话虽如此,这是一个例子,对于nxml模式(虽然它很容易适应)。
(defun find-css-defun () (interactive) (when (memq 'nxml-attribute-value (get-text-property (point) 'face)) (let ((css-buffers (mapcar (lambda (file) (find-file-noselect file)) (directory-files default-directory t ".*\\.css$")))) (multi-occur css-buffers (thing-at-point 'symbol)))))
一切正常。
PS它需要这些天默认在emacs中的东西