具有 Windows 风格键绑定的 Xemacs

发布于 2024-08-14 09:42:35 字数 565 浏览 7 评论 0原文

Xemacs 是否可用于 Windows 样式键绑定 ? Emacs 有这些 Windows 键绑定

Emacs 的键绑定早于 现代 GUI,以及过去的按键 由后来的 GUI 选择进行剪切和复制 被赋予了重要的职能,如 Emacs 中的扩展键盘映射。 CUA模式 尝试让两种绑定共存 通过将 Cx 和 Cc 定义为终止区域 和 copy-region-as-kill 当 区域很活跃,让他们 具有正常的 Emacs 绑定 该区域不活跃。很多人 发现这是可以接受的 妥协。 CUA模式还定义了一个 其他键的数量(Cv、Shift 选择),并且可以从 选项菜单

Is Xemacs available with Windows Style Key Bindings ?
Emacs has these Windows key bindings

The keybindings of Emacs predate
modern GUIs, and the keys that were
chosen by later GUIs for cut and copy
were given important functions as
extended keymaps in Emacs. CUA mode
attempts to let both bindings co-exist
by defining C-x and C-c as kill-region
and copy-region-as-kill when the
region is active, and letting them
have their normal Emacs bindings when
the region is not active. Many people
find this to be an acceptable
compromise. CUA mode also defines a
number of other keys (C-v, Shift
selection), and can be turned on from
the Options menu

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

得不到的就毁灭 2024-08-21 09:42:35

如果您可以忍受 emacs 而不是 Xemacs,那么有 EmacsW32
它是经过简单修改的​​ emacs,以便更好地与 Windows 集成。它有很多功能,包括 emacs/win 键绑定之间的选择。

来自网页:

EmacsW32 是 Emacs 的集合
Lisp 模块和 MS Windows 程序
您可以从 Emacs 中使用。它可以使
Emacs 中的键盘和其他东西
功能更像他们通常做的
MS Windows 程序。

EmacsW32 不是用于 MS Windows 的 Emacs。
相反,它是 Emacs 的一个附加组件
微软视窗。不过您可以下载
Emacs+EmacsW32 合一安装程序。

If you could put up with emacs instead of Xemacs there is EmacsW32
it's plain emacs modified to integrate better with windows. It has a lot of features including a choice between emacs/win keybindings.

From webpage:

EmacsW32 is a collection of Emacs
lisp modules and MS Windows programs
you can use from Emacs. It can make
the keyboard and other things in Emacs
function more like they do usually in
MS Windows programs.

EmacsW32 is not Emacs for MS Windows.
Instead it is an add-on to Emacs for
MS Windows. You can however download
Emacs+EmacsW32 in one installer.

关于从前 2024-08-21 09:42:35

我不确定您正在寻找哪个 Windows 键绑定,可能是剪切、复制、粘贴?这称为 CUA,默认情况下它不附带这些键绑定,但可以轻松添加它们。
这是一个具有 xemacs CUA 模式的站点的链接。您应该能够安装 XEmacs,然后添加 CUA 模式,从而有效地创建您想要的内容。
http://sites.google.com/site/olegalexandrov/xemacs

或者,您可以自己添加它们,并在 init.el 文件中添加几行键分配。首先使用 Cx Ce 在缓冲区中尝试运行它们并确保它们工作。

我不使用kill-ring,并且想以不同的方式标记块,因此我在文件 skm-mark-blocks.el 中编写了一些函数,我将尝试在此处插入或附加该函数。在文件末尾,您可以看到 global-set-key 行,并将它们用作模板,使 Windows 键按照在 Windows 中的方式工作。

-剪断--------------------------------------

; skm-blocks.el

;拜雷尔和史蒂夫·米切尔

; 2009 年 11 月 12 日

;通过以下方式标记块:

;用于标记第一个和第二个块结束标记的相同键

;一旦标记了两端,就可以使用复制、剪切、移动和复制键。删除块

;目标:

;用左手执行所有块命令:标记、复制、移动、删除等

;右手用光标键在缓冲区中定位
;

;第一次写模仿 Vedit+ 方法(右手)::

; F9 标记第一端,

; F9 标记第二个结尾,

;然后 Cntl-F9(复制到光标)或 Alt-F9(移动到光标)

; Vedit+ 在块突出显示时使用删除键来删除
堵塞。不会在这里工作

;所以我们定义一个具有相同前缀(super)的键来删除突出显示的块

;可能的改进:

;添加变量来选择在 block 时如何移动点(或光标位置或块标记)

;被复制等

;也就是说,这些东西是否随块移动,留在原来的位置

;或移动到新块的末尾等

;添加功能来取消标记所有块结束?

;当前标记了“第三”端,取消了之前的 2 端标记
选定的块结束

;并将第三端视为标记块的新第一端

;除了我的缩写之外,为这种块标记找到一个名称。

;添加使用新组合键进行柱状块标记(矩形)的功能。

;添加变量来配置柱状块标记应如何工作、插入、覆盖等

(defvar block-marker-highlight-mode 1

 "block-marker-highlight-mode can have 3 values: 

  0 = highlighing is removed following a block copy or block move

  1 = w/ a copy, orig block remains highlighted

      w/ a move, block is highlighted at new position

  2 = w/ copy or move, block is highlighted at new position" )

(defvar block-marker-end-position-mode t

 "block-marker-end-position-mode has 2 values:

  t = after a block copy/move, cursor is positioned at end of 

插入块

  nil = after a block copy/move, cursor is positioned at beginning of inserted block

  note: t is similar to the way Xemacs works by default")

(defvar block-mark1 (point-marker)) ;var 保存块的第一个结尾

(defvar block-mark2 ( point-marker)) ;var 保存块的第二个末端

(defvar block-ends-marked 0) ;0 如果没有标记末端,
;1 或 2 表示标记的结束数

(defvar block-copiedp nil) ;t 如果块已复制

;-------- mark-block ----------------- ---------

(defun mark-block ()

“用 skm 类型块标记块的任一端。”

(交互式)

(if ( or (eq block-ends-marked 0 ) (eq block-ends-标记为 2))
;我们正在标记块的第一端吗?

  (progn 

(setq block-mark1 (point-marker))    

(setq block-ends-marked 1)

    (clear-highlighting )

(set-mark-command nil))       ;starts highlighting      

( if (eq block-ends-marked 1)  ; if there is 1 block marker already, we are marking the second end.

(progn (setq block-mark2 (point-marker))

       (setq block-ends-marked 2) 

           (highlight-region )  ))) )

;-------- copy-block-to-point -----------------

(defun copy-block-to-point ()

"复制 skm 标记的块到 cur. pos. "

(交互式)

(let ((start-pos (point)))

(if ( < block-ends-marked 2) 

(message "Both ends not marked: %d end(s) marked." block-ends-marked ) ;error if there aren't 2 ends marked 

  (save-excursion

(set-buffer (marker-buffer block-mark1))

(copy-to-register ?c block-mark1 block-mark2))

  (insert-register ?c t)                     

  (setq block-copiedp t)

  (let ((end-pos (point)))

(if (eq block-marker-highlight-mode 0)               ;0 = clear all highlighting

    (clear-highlighting-at-point ( marker-buffer block-mark1) block-mark1)

  (if (eq block-marker-highlight-mode 2 )             ;2 = highlight at new position  

      (progn 

    (clear-highlighting-at-point ( marker-buffer block-mark1) block-mark1)

    (goto-char start-pos)

    (push-mark)

    (goto-char end-pos)

    (highlight-region))))))

(if (not block-marker-end-position-mode) ;determine where to leave cursor

(goto-char start-pos)) ))

;-------- 移动块到点 ------------ -----

(defun move-block-to-point ()

"将 skm 标记的块移动到当前光标位置。"

(交互式)

(if ( < block-ends-marked 2)

  (message "Both ends not marked: %d end(s) marked." block-ends-marked )

(save-excursion

  (set-buffer (marker-buffer block-mark1))

  (copy-to-register ?c block-mark1 block-mark2 t))

(let ((start-pos (point)) end-pos )

  (insert-register ?c t)

  (setq end-pos (point))

  (setq block-copiedp t)

  (clear-highlighting-at-point ( marker-buffer block-mark1) block-mark1)

  (if (eq block-marker-highlight-mode 0) ;0 = clear all highlighting

  nil

(goto-char start-pos)

(push-mark)

(goto-char end-pos)

(highlight-region))

  (if (not block-marker-end-position-mode)             ;determine where to leave cursor

  (goto-char start-pos)) )))

;------ -- cut-block ---------------------------

(defun cut-block ()

"从文件中剪切 skm 标记的块。"

( Interactive)

(if ( < block-ends-marked 2)

  (message "Both ends not marked: %d end(s) marked." block-ends-marked )

(copy-to-register ?c block-mark1 block-mark2 t)

(setq block-copiedp t)))

;------- 持续高亮显示一个块 --------------

(defunhighlight-region ()

(interactive)

(let ( new-extent) (setq new-extent (make-extent (标记 t)
(point)))

   (set-extent-property new-extent 'face 'zmacs-region)

   (set-extent-property new-extent 'wordstar-block t)))

;------- 清除缓冲区中突出显示的块 -----------

(defun clear-highlighting-whole-buffer (&可选缓冲区)

(交互式)

( let ((highlighted-list (extent-list buffer nil nil nil 'face 'zmacs-region)))

(while highlighted-list

  (delete-extent (car highlighted-list))

  (setq highlighted-list (cdr highlighted-list)))))

(defun clear-highlighting-at-point (&可选缓冲区位置)

(交互式)

(if (不是位置)

  (setq position (point)))

(while (extent-at 位置缓冲区 'wordstar-block nil 'at )

(delete-extent (extent-at position buffer 'wordstar-block nil 'at )) ))

;------------ 键分配 ------------------

;-- - 模仿 VEdit+ 方法的按键分配

;--- 验证我们的算法是否正确

;--- 一旦不需要它们就注释掉

(global-set-key [ f9 ] 'mark-block)

(global-set-key [ ( control f9) ] '复制块到点)

(global-set-key [ (meta f9) ] '移动块到点)

(global-set-key [ (control meta f9) ] '剪切- block) ;不在 Vedit 中,但用于测试

(global-set-key [ (control shift f9) ] 'clear-highlighting) ;不在 Vedit 中,但用于测试

;-------- 左手使用的键分配

;--- 仅使用超级键(左 Windows 徽标键)移动

;由于 Windows 抢占了超级键,因此不适用于 Windows 中的 xemacs

;必须尝试找到一些适用于 Windows 的东西'
xemacs...

(global-set-key [ (super space) ] 'mark-block)

(global-set-key [ (super v) ] 'copy-block-to-point) ;助记符:V 表示插入、驱动器a V (wedge) in

(global-set-key [ (super m) ] 'move-block-to-point) ;助记符:M 表示移动

(global-set-key [ (super c) ] 'cut-block) ;助记符:C 代表剪切

(global-set-key [ (super n) ] 'clear-highlighting-at-point)

;助记符:认为 N 代表不突出显示

--snip------------ -----
希望这可以帮助您了解这是多么容易做到的。
在看到代码如何进入此消息后,很明显我需要一些练习将代码放入此编辑器中(咧嘴笑)。

I'm not sure which Windows key bindings you are looking for, probably cut.copy,paste? That is called CUA and no it does not come with those key bindings by default, but they can be easily added.
Here's a link to a site that has a CUA-mode for xemacs. You should be able to install XEmacs, then add the CUA-mode, effectively creating what you are wanting.
http://sites.google.com/site/olegalexandrov/xemacs

Alternatively, you can add them yourself with a few lines of key assignments added to your init.el file. Try them first in a buffer with C-x C-e to run them and make sure they work.

I do not use the kill-ring and wanted to mark blocks a different way, so I wrote some functions in a file skm-mark-blocks.el which I will try to insert or attach here. At the end of the file you can see the global-set-key lines and use them as a template for making the Windows keys work the way they do in Windows.

-snip--------------------------------------

; skm-blocks.el

; Byrel and Steve Mitchell

; Nov 12, 2009

; mark blocks by:

; same key for marking first and second block end markers

; once both ends marked, keys to copy, cut, move, & delete block

;

; Goal:

; to do all block commands: mark, copy, move, del, etc. with the left hand

; while the right hand used for positioning in buffer with cursor keys
;

; first written mimicing Vedit+ method (for right hand)::

; F9 to mark first end,

; F9 to mark second end,

; then Cntl-F9 (copy to cursor) or Alt-F9 (move to cursor)

; Vedit+ uses the delete key while block highlighted to delete
block. Won't work here

; so we define a key with the same prefix (super) for deleting highlighted block

;

; possible improvements:

; add vars to choose how point (or cursor position or block markers) is moved when block

; is copied, etc.

; that is, do these things move with the block, stay where they were was,

; or move to end of new block, etc.

; add function to unmark all block ends?

; currently marking a "third" end unmarks the 2 previously
selected block ends

; and counts the third end as marking a new first end of block

; find a name for this kind of block marking other than my intials.

; add functions to do columnar block marking (rectangles), with new key combinations.

; add vars to config how columnar block marking should work, insert, overwrite, etc.

;

(defvar block-marker-highlight-mode 1

 "block-marker-highlight-mode can have 3 values: 

  0 = highlighing is removed following a block copy or block move

  1 = w/ a copy, orig block remains highlighted

      w/ a move, block is highlighted at new position

  2 = w/ copy or move, block is highlighted at new position" )

(defvar block-marker-end-position-mode t

 "block-marker-end-position-mode has 2 values:

  t = after a block copy/move, cursor is positioned at end of 

inserted block

  nil = after a block copy/move, cursor is positioned at beginning of inserted block

  note: t is similar to the way Xemacs works by default")

(defvar block-mark1 (point-marker)) ;var to hold 1st end of our block

(defvar block-mark2 (point-marker)) ;var to hold 2nd end of our block

(defvar block-ends-marked 0) ;0 if no ends marked,
;1 or 2 for number of ends marked

(defvar block-copiedp nil) ;t if block copied

;-------- mark-block --------------------------

(defun mark-block ()

"Marks either end of block with skm type blocks."

(interactive)

(if ( or (eq block-ends-marked 0 ) (eq block-ends-marked 2))
;are we marking the first end of a block?

  (progn 

(setq block-mark1 (point-marker))    

(setq block-ends-marked 1)

    (clear-highlighting )

(set-mark-command nil))       ;starts highlighting      

( if (eq block-ends-marked 1)  ; if there is 1 block marker already, we are marking the second end.

(progn (setq block-mark2 (point-marker))

       (setq block-ends-marked 2) 

           (highlight-region )  ))) )

;-------- copy-block-to-point -----------------

(defun copy-block-to-point ()

"Copies skm-marked block to cur. cursor pos. "

(interactive)

(let ((start-pos (point)))

(if ( < block-ends-marked 2) 

(message "Both ends not marked: %d end(s) marked." block-ends-marked ) ;error if there aren't 2 ends marked 

  (save-excursion

(set-buffer (marker-buffer block-mark1))

(copy-to-register ?c block-mark1 block-mark2))

  (insert-register ?c t)                     

  (setq block-copiedp t)

  (let ((end-pos (point)))

(if (eq block-marker-highlight-mode 0)               ;0 = clear all highlighting

    (clear-highlighting-at-point ( marker-buffer block-mark1) block-mark1)

  (if (eq block-marker-highlight-mode 2 )             ;2 = highlight at new position  

      (progn 

    (clear-highlighting-at-point ( marker-buffer block-mark1) block-mark1)

    (goto-char start-pos)

    (push-mark)

    (goto-char end-pos)

    (highlight-region))))))

(if (not block-marker-end-position-mode) ;determine where to leave cursor

(goto-char start-pos)) ))

;-------- move-block-to-point -----------------

(defun move-block-to-point ()

"Moves skm-marked block to current cursor pos. "

(interactive)

(if ( < block-ends-marked 2)

  (message "Both ends not marked: %d end(s) marked." block-ends-marked )

(save-excursion

  (set-buffer (marker-buffer block-mark1))

  (copy-to-register ?c block-mark1 block-mark2 t))

(let ((start-pos (point)) end-pos )

  (insert-register ?c t)

  (setq end-pos (point))

  (setq block-copiedp t)

  (clear-highlighting-at-point ( marker-buffer block-mark1) block-mark1)

  (if (eq block-marker-highlight-mode 0) ;0 = clear all highlighting

  nil

(goto-char start-pos)

(push-mark)

(goto-char end-pos)

(highlight-region))

  (if (not block-marker-end-position-mode)             ;determine where to leave cursor

  (goto-char start-pos)) )))

;-------- cut-block ---------------------------

(defun cut-block ()

"Cuts skm-marked block from file."

(interactive)

(if ( < block-ends-marked 2)

  (message "Both ends not marked: %d end(s) marked." block-ends-marked )

(copy-to-register ?c block-mark1 block-mark2 t)

(setq block-copiedp t)))

;------- highlight a block persistantly -----------

(defun highlight-region ()

(interactive)

(let (new-extent) (setq new-extent (make-extent (mark t)
(point)))

   (set-extent-property new-extent 'face 'zmacs-region)

   (set-extent-property new-extent 'wordstar-block t)))

;------- clear the highlighted blocks in a buffer -----------

(defun clear-highlighting-whole-buffer (&optional buffer)

(interactive)

(let ((highlighted-list (extent-list buffer nil nil nil 'face 'zmacs-region)))

(while highlighted-list

  (delete-extent (car highlighted-list))

  (setq highlighted-list (cdr highlighted-list)))))

(defun clear-highlighting-at-point (&optional buffer position)

(interactive)

(if (not position)

  (setq position (point)))

(while (extent-at position buffer 'wordstar-block nil 'at )

(delete-extent (extent-at position buffer 'wordstar-block nil 'at )) ))

;------------key assignments ------------------

;--- key assignments to mimic VEdit+ method

;--- to verify we have algorithm correct

;--- comment out once they are not needed

(global-set-key [ f9 ] 'mark-block)

(global-set-key [ (control f9) ] 'copy-block-to-point)

(global-set-key [ (meta f9) ] 'move-block-to-point)

(global-set-key [ (control meta f9) ] 'cut-block) ;not in Vedit, but for testing

(global-set-key [ (control shift f9) ] 'clear-highlighting) ;not in Vedit, but for testing

;------- key assignments for left hand use

;--- using only super key (left windows-logo key) shifting

;Doesn't work with xemacs in Windows since Windows preempts the super key

; have to experiment to find something to work for windows'
xemacs...

(global-set-key [ (super space) ] 'mark-block)

(global-set-key [ (super v) ] 'copy-block-to-point) ;mnemonic: V for insert, drive a V (wedge) in

(global-set-key [ (super m) ] 'move-block-to-point) ;mnemonic: M for move

(global-set-key [ (super c) ] 'cut-block) ;mnemonic: C for Cut

(global-set-key [ (super n) ] 'clear-highlighting-at-point)

;mnemonic: think N for No highlighting

--snip-----------------
Hope this helps you see how easy it is to do.
After seeing how the code went into this message, it is obvious that I need some practice putting code into this editor (grin).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文