elisp如何检查是否按住Shift键 [英] elisp how to check if Shift key is pressed
本文介绍了elisp如何检查是否按住Shift键的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要检查是否按住Shift键。
更确切地说,我想根据是否按Shift来设置dired开关。
I need to check if Shift key is pressed. More exactly I would like to set dired switches depending on whether Shift is pressed.
(defadvice find-file-noselect (around find-file-noselect-set-switches activate)
(let ((switches dired-listing-switches))
;; check if shift is pressed and set or not an "R" switch
(setq dired-listing-switches "-lhRA")
ad-do-it
(setq dired-listing-switches switches)))
当然,我可以为不同的dired交换机提供不同的快捷方式,但是我想在选择一个目录为dired时动态地更改交换机。 p>
Of course, I can have different shortcuts for different dired switches, but I would like to change my switches dynamically during choosing a directory for dired.
推荐答案
重复的问题(忽略另一个的Windows部分)。
Duplicate question (ignoring the 'Windows' part of the other one).
你可以做的最好的(正如你所说)有不同的shortcu TS。他们可以通过大小写区分...例如
The best you can do (is as you mention) have different shortcuts. They can be differentiated by capitalization... for example
(global-set-key (kbd "C-x C-D") 'dired-with-some-switches)
(global-set-key (kbd "C-x C-d") 'dired-with-other-switches)
这篇关于elisp如何检查是否按住Shift键的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文