打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
[emacs][delphi] 跳到函数声明/实现
(defun delphi-jump-to-declaration ()  (interactive)  (let ( (pt (ignore-errors               (save-excursion        (end-of-line)        (re-search-backward "^\\(procedure\\|function\\|constructor\\|destructor\\)[ \t]+\\([_a-zA-Z][_a-zA-Z0-9]*\\>\\)?\\.?\\([_a-zA-Z][_a-zA-Z0-9]*\\)")        (let ( (method-type  (match-string-no-properties 1))                (class-name   (if (match-string 3) (match-string-no-properties 2) "" ))               (func-name    (or (match-string-no-properties 3) (match-string-no-properties 2))) )          (beginning-of-buffer)          (if (> (length class-name) 0)              (re-search-forward (format "%s[ \t]+=" class-name)))          (when (re-search-forward (format "%s[ \t]+%s\\>" method-type func-name))              (backward-word)              (point)))))) )    (when pt (goto-char pt))))      (defun delphi-jump-to-implementaion()  (interactive)  (let ( (pt (ignore-errors               (beginning-of-line)               (when (re-search-forward "\\(procedure\\|function\\|constructor\\|destructor\\)[ \\t]+\\([_a-zA-Z][_a-zA-Z0-9]*\\)")                 (let ( (method-type  (match-string-no-properties 1))  ;;procedure/function/constructor                        (func-name    (match-string-no-properties 2))                        type-name                        type-type)                   (when (re-search-backward "\\<\\([_a-zA-Z][_a-zA-Z0-9]*\\)[ \\t]*=[ \\t]*\\(class\\|interface\\)")                     (setq type-name (match-string-no-properties 1))                     (setq type-type (match-string-no-properties 2)))                   (if (string= type-type "interface")                       (error "interface has no implementation part: %s" type-name)                     (progn                       (re-search-forward "^implementation\\>" nil t)                       ;;(message "%s|%s|%s" method-type type-name func-name)                       (if type-name                           (re-search-forward (format "%s[ \\t]+%s\\.[ \\t]?%s\\>" method-type type-name func-name))                         (re-search-forward (format "%s[ \\t]+%s\\>" method-type func-name))))))))) )    (when pt (progn	       (goto-char pt)	       (beginning-of-line)))))			(define-key delphi-mode-map (kbd "<C-S-up>") 'delphi-jump-to-declaration)(define-key delphi-mode-map (kbd "<C-S-down>") 'delphi-jump-to-implementaion)
本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
【热】打开小程序,算一算2024你的财运
如何使用 Go 中的函数类型 (function types)?
云风的个人空间 : Lua 函数重载
我心中的核心组件(可插拔的AOP)~第五回 消息组件
activiti 汉化 stencilset.json 文件内容
Events  |  Blockly  |  Google Developers
Go 语言系列2:变量
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服