如何在 emacs 27 中为外部命令起别名
how to alias external commands in emacs 27
我正在尝试让 Emacs 27 为 javascript + flow 工作。
有很多 steps/packages/configs 可以让它工作。
我目前坚持的一个特定步骤。
我无法全局安装 npm 包(因为我们的 monorepo 使用不同版本的 node_module 包用于 repo 中的不同应用程序)。
所以我们不能用npm -g安装flow、typescript等东西
相反,我们需要将 emacs 指向 ./node_modules/.bin/flow(作为示例).
这是我在启动 emacs 时收到的具体错误消息
Command "javascript-typescript-stdio" is not present on the path.
Command "typescript-language-server --stdio" is not present on the path.
Command "flow lsp" is not present on the path.
所以,如果可能的话,我想在我的 .emacs 中定义
javacript-typescript-stdio
打字稿语言服务器
流量
这样它们将指向 /node_modules/.bin/
我启动 emacs 的目录在哪里
当搜索这个主题时,大多数查询返回了关于别名内部 emacs 函数的内容,但这不是我要找的。
我的 .emacs 部分与此相关:
;; lsp-javascript specific start
;; https://github.com/emacs-lsp/lsp-mode/issues/489
(use-package js2-mode
:mode "\.js\'"
:init
(add-hook 'js2-mode-hook #'js2-imenu-extras-mode)
(setf js2-mode-indent-inhibit-undo t)
:config
(with-eval-after-load "lsp-javascript-typescript"
(add-hook 'js2-mode-hook #'lsp)))
;; for flow start
(add-hook 'js2-mode-hook 'flow-minor-enable-automatically)
;; for flow end
;; JSON
(use-package json-mode
:defer t)
exec-path
包含搜索可执行文件的位置,因此添加一个条目应该可以,
(add-to-list 'exec-path "./node_modules/.bin")
这里的路径是相对于default-directory
,具体见。
我正在尝试让 Emacs 27 为 javascript + flow 工作。 有很多 steps/packages/configs 可以让它工作。
我目前坚持的一个特定步骤。
我无法全局安装 npm 包(因为我们的 monorepo 使用不同版本的 node_module 包用于 repo 中的不同应用程序)。 所以我们不能用npm -g安装flow、typescript等东西 相反,我们需要将 emacs 指向 ./node_modules/.bin/flow(作为示例).
这是我在启动 emacs 时收到的具体错误消息
Command "javascript-typescript-stdio" is not present on the path.
Command "typescript-language-server --stdio" is not present on the path.
Command "flow lsp" is not present on the path.
所以,如果可能的话,我想在我的 .emacs 中定义 javacript-typescript-stdio 打字稿语言服务器 流量
这样它们将指向 /node_modules/.bin/ 我启动 emacs 的目录在哪里
当搜索这个主题时,大多数查询返回了关于别名内部 emacs 函数的内容,但这不是我要找的。
我的 .emacs 部分与此相关:
;; lsp-javascript specific start
;; https://github.com/emacs-lsp/lsp-mode/issues/489
(use-package js2-mode
:mode "\.js\'"
:init
(add-hook 'js2-mode-hook #'js2-imenu-extras-mode)
(setf js2-mode-indent-inhibit-undo t)
:config
(with-eval-after-load "lsp-javascript-typescript"
(add-hook 'js2-mode-hook #'lsp)))
;; for flow start
(add-hook 'js2-mode-hook 'flow-minor-enable-automatically)
;; for flow end
;; JSON
(use-package json-mode
:defer t)
exec-path
包含搜索可执行文件的位置,因此添加一个条目应该可以,
(add-to-list 'exec-path "./node_modules/.bin")
这里的路径是相对于default-directory
,具体见。