A+和 Emacs(但*不是* XEmacs)

发布于 2024-08-02 07:07:39 字数 2984 浏览 3 评论 0原文

我已经使用 aplus-fsf-dev 和 aplus-fsf-el 软件包在 Debian 中安装了 A+ 并设置了 XEmacs; XEmacs 作为依赖项安装。

我检查了A+网站(http://www.aplusdev.org/),似乎有与在普通 Emacs(而不是 XEmacs)上运行 A+ 无关。

有谁知道是否有 elisp 文件可以在普通(FSF)Emacs 上设置 A+?

谢谢!

PS:所以,XEmacs 的 elisp 文件不能在 Emacs 上运行。我尝试转换它们,但我不得不越来越深入地研究代码,所以我放弃了。

PS2:在Emacs中,当我这样做(需要'aplus)时,这就是我得到的:

Debugger entered--Lisp error: (wrong-type-argument arrayp (super 97))
  define-key((keymap) (super 97) a-self-insert)
  (let ((key ...) (apl ...)) (define-key a-minor-map (append a-modifier-list ...) (quote a-self-insert)) (define-key a-minor-map (vector ... key) (quote a-self-insert)) (aset a-key-string (char-to-int key) apl))
  a-insert-map((97 . 193))
  mapcar(a-insert-map ((97 . 193) (98 . 194) (99 . 195) (100 . 196) (101 . 197) (102 . 95) (103 . 199) (104 . 200) (105 . 201) (106 . 202) (107 . 39) (108 . 204) (109 . 124) (110 . 206) (111 . 207) (112 . 42) (113 . 63) (114 . 210) (115 . 211) (116 . 126) (117 . 213) (118 . 214) (119 . 215) (120 . 216) (121 . 217) (122 . 218) (49 . 161) (50 . 162) (51 . 60) (52 . 164) (53 . 61) (54 . 166) (55 . 62) (56 . 168) (57 . 169) (48 . 94) (45 . 171) (61 . 223) (92 . 220) (96 . 254) (44 . 172) (91 . 251) (93 . 253) (59 . 219) (39 . 221) (46 . 220) (47 . 175) (33 . 224) (64 . 230) (35 . 231) ...))
  eval-buffer(#<buffer  *load*<3>> nil "/usr/share/emacs/site-lisp/aplus-fsf-el/keyb.el" nil t)  ; Reading at buffer position 3754
  load-with-code-conversion("/usr/share/emacs/site-lisp/aplus-fsf-el/keyb.el" "/usr/share/emacs/site-lisp/aplus-fsf-el/keyb.el" nil t)
  require(keyb)
  eval-buffer(#<buffer  *load*<2>> nil "/usr/share/emacs/site-lisp/aplus-fsf-el/xa.el" nil t)  ; Reading at buffer position 16
  load-with-code-conversion("/usr/share/emacs/site-lisp/aplus-fsf-el/xa.el" "/usr/share/emacs/site-lisp/aplus-fsf-el/xa.el" nil t)
  load("xa" nil t)
  (if aplus-setup-global-bindings (load "xa" nil t))
  eval-buffer(#<buffer  *load*> nil "/usr/share/emacs/site-lisp/aplus-fsf-el/aplus.el" nil t)  ; Reading at buffer position 1373
  load-with-code-conversion("/usr/share/emacs/site-lisp/aplus-fsf-el/aplus.el" "/usr/share/emacs/site-lisp/aplus-fsf-el/aplus.el" nil t)
  require(aplus)
  eval((require (quote aplus)))
  eval-last-sexp-1(nil)
  eval-last-sexp(nil)
  call-interactively(eval-last-sexp nil nil)

这是因为在keyb.el中,有这个函数:

(defun a-insert-map (akeydef)
  (let ((key (car akeydef))
        (apl (cdr akeydef)))
    (define-key a-minor-map (append a-modifier-list (list key)) 'a-self-insert)
    (define-key a-minor-map (vector '(control c) key) 'a-self-insert)
    (aset a-key-string (char-to-int key) apl)))

我将append更改为vconcat,然后在最后一行出现错误该函数,因为 Emacs 没有 char-to-int 函数。我删除了函数调用并用参数(“key”)本身替换,因为我知道 Emacs 已经将该字符视为数字。

然后其他函数还有其他不那么明显的错误;其中大多数涉及定义键和键盘映射。

我想 Emacs 和 XEmacs 处理键盘映射的方式不同?

I have installed A+ and set up XEmacs in Debian, using the aplus-fsf-dev and aplus-fsf-el packages; XEmacs was installed as a dependency.

I checked the A+ site (http://www.aplusdev.org/), and there seems to be nothing about running A+ on plain Emacs (and not XEmacs).

Does anyone know if there are elisp files somewhere for setting up A+ on plain (FSF) Emacs?

Thanks!

PS: So, the elisp files for XEmacs do not run on Emacs. I tried converting them, but I had to go farther and farther into the code, so I gave up.

PS2: In Emacs, when I do (require 'aplus), this is what I get:

Debugger entered--Lisp error: (wrong-type-argument arrayp (super 97))
  define-key((keymap) (super 97) a-self-insert)
  (let ((key ...) (apl ...)) (define-key a-minor-map (append a-modifier-list ...) (quote a-self-insert)) (define-key a-minor-map (vector ... key) (quote a-self-insert)) (aset a-key-string (char-to-int key) apl))
  a-insert-map((97 . 193))
  mapcar(a-insert-map ((97 . 193) (98 . 194) (99 . 195) (100 . 196) (101 . 197) (102 . 95) (103 . 199) (104 . 200) (105 . 201) (106 . 202) (107 . 39) (108 . 204) (109 . 124) (110 . 206) (111 . 207) (112 . 42) (113 . 63) (114 . 210) (115 . 211) (116 . 126) (117 . 213) (118 . 214) (119 . 215) (120 . 216) (121 . 217) (122 . 218) (49 . 161) (50 . 162) (51 . 60) (52 . 164) (53 . 61) (54 . 166) (55 . 62) (56 . 168) (57 . 169) (48 . 94) (45 . 171) (61 . 223) (92 . 220) (96 . 254) (44 . 172) (91 . 251) (93 . 253) (59 . 219) (39 . 221) (46 . 220) (47 . 175) (33 . 224) (64 . 230) (35 . 231) ...))
  eval-buffer(#<buffer  *load*<3>> nil "/usr/share/emacs/site-lisp/aplus-fsf-el/keyb.el" nil t)  ; Reading at buffer position 3754
  load-with-code-conversion("/usr/share/emacs/site-lisp/aplus-fsf-el/keyb.el" "/usr/share/emacs/site-lisp/aplus-fsf-el/keyb.el" nil t)
  require(keyb)
  eval-buffer(#<buffer  *load*<2>> nil "/usr/share/emacs/site-lisp/aplus-fsf-el/xa.el" nil t)  ; Reading at buffer position 16
  load-with-code-conversion("/usr/share/emacs/site-lisp/aplus-fsf-el/xa.el" "/usr/share/emacs/site-lisp/aplus-fsf-el/xa.el" nil t)
  load("xa" nil t)
  (if aplus-setup-global-bindings (load "xa" nil t))
  eval-buffer(#<buffer  *load*> nil "/usr/share/emacs/site-lisp/aplus-fsf-el/aplus.el" nil t)  ; Reading at buffer position 1373
  load-with-code-conversion("/usr/share/emacs/site-lisp/aplus-fsf-el/aplus.el" "/usr/share/emacs/site-lisp/aplus-fsf-el/aplus.el" nil t)
  require(aplus)
  eval((require (quote aplus)))
  eval-last-sexp-1(nil)
  eval-last-sexp(nil)
  call-interactively(eval-last-sexp nil nil)

This is because in keyb.el, there is this function:

(defun a-insert-map (akeydef)
  (let ((key (car akeydef))
        (apl (cdr akeydef)))
    (define-key a-minor-map (append a-modifier-list (list key)) 'a-self-insert)
    (define-key a-minor-map (vector '(control c) key) 'a-self-insert)
    (aset a-key-string (char-to-int key) apl)))

I changed append to vconcat, and then I got an error on the last line of that function, because Emacs does not have an char-to-int function. I removed the function call and replaced by the argument ("key") itself, since I understand that Emacs will already treat that character as a number.

Then There were other not so obvious errors in other functions; most of them dealing with define-key and keymaps.

I suppose Emacs and XEmacs deal with keymaps differently?

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

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

发布评论

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

评论(1

迷路的信 2024-08-09 07:07:39

让答案开始吧。 SO 并不是真正为运行调试会话而设计的,但这里是。

根据您是否想让 Emacs 和 XEmacs 都可以加载相同的 .el 文件,您必须弄清楚如何隔离差异。

在 Emacs 中定义键的最(?)可移植方法是使用 'kbd 宏。因此,'define-key 调用应该类似于:

(define-key a-minor-map (kbd (format "C-c %c" key)) 'a-self-insert)

我不知道 a-modifier-list 的用途,但它可能可以被压缩为字符串以传递给 'kbd。可以在 此处。关于 Emacs 键绑定的文档可以在此处。它涵盖了键绑定的各种符号,也许它可以用于解码一些 XEmacs 的东西。

Let the answers begin. SO wasn't really designed for a running debugging session, but here goes.

Depending on whether you want to make the same .el files loadable by both Emacs and XEmacs, you'll have to figure how you want to isolate the differences.

The most(?) portable way to define keys in Emacs is using the 'kbd macro. So, the 'define-key invocation should look something like:

(define-key a-minor-map (kbd (format "C-c %c" key)) 'a-self-insert)

I don't know what the a-modifier-list is for, but it probably can be massaged into a string to pass to 'kbd. A good introduction to 'kbd or 'read-kbd-macro can be found here. A long document on Emacs keybindings can be found here. It covers all sorts of notations for keybindings, and perhaps it would be of use to decode some of the XEmacs things.

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