Mercurial > emacs
comparison lisp/emulation/edt-mapper.el @ 91073:4bc33ffdda1a
Merge from emacs--devo--0
Patches applied:
* emacs--devo--0 (patch 902-908)
- Update from CVS
- Merge from emacs--rel--22
* emacs--rel--22 (patch 131-137)
- Update from CVS
- Merge from gnus--rel--5.10
* gnus--rel--5.10 (patch 261-262)
- Update from CVS
Revision: emacs@sv.gnu.org/emacs--unicode--0--patch-278
author | Miles Bader <miles@gnu.org> |
---|---|
date | Sat, 27 Oct 2007 09:12:07 +0000 |
parents | f55f9811f5d7 437a25964d35 |
children | 606f2d163a64 |
comparison
equal
deleted
inserted
replaced
91072:74ab3ea909f9 | 91073:4bc33ffdda1a |
---|---|
116 | 116 |
117 ;;; | 117 ;;; |
118 ;;; Decide Emacs Variant, GNU Emacs or XEmacs (aka Lucid Emacs). | 118 ;;; Decide Emacs Variant, GNU Emacs or XEmacs (aka Lucid Emacs). |
119 ;;; Determine Window System, and X Server Vendor (if appropriate). | 119 ;;; Determine Window System, and X Server Vendor (if appropriate). |
120 ;;; | 120 ;;; |
121 (defconst edt-x-emacs-p (string-match "XEmacs" emacs-version) | 121 (defconst edt-window-system (if (featurep 'xemacs) (console-type) window-system) |
122 "Non-nil if we are running XEmacs version 19, or higher.") | |
123 | |
124 (defconst edt-emacs-variant (if edt-x-emacs-p "xemacs" "gnu") | |
125 "Indicates Emacs variant: GNU Emacs or XEmacs \(aka Lucid Emacs\).") | |
126 | |
127 (defconst edt-window-system (if edt-x-emacs-p (console-type) window-system) | |
128 "Indicates window system \(in GNU Emacs\) or console type \(in XEmacs\).") | 122 "Indicates window system \(in GNU Emacs\) or console type \(in XEmacs\).") |
129 | 123 |
130 (defconst edt-xserver (if (eq edt-window-system 'x) | 124 (defconst edt-xserver (if (eq edt-window-system 'x) |
131 (if edt-x-emacs-p | 125 (if (featurep 'xemacs) |
132 ;; The Cygwin window manager has a `/' in its | 126 ;; The Cygwin window manager has a `/' in its |
133 ;; name, which breaks the generated file name of | 127 ;; name, which breaks the generated file name of |
134 ;; the custom key map file. Replace `/' with a | 128 ;; the custom key map file. Replace `/' with a |
135 ;; `-' to work around that. | 129 ;; `-' to work around that. |
136 (replace-in-string (x-server-vendor) "[ /]" "-") | 130 (replace-in-string (x-server-vendor) "[ /]" "-") |
243 ;;; | 237 ;;; |
244 ;;; For GNU Emacs, running in a Window System, first hide bindings in | 238 ;;; For GNU Emacs, running in a Window System, first hide bindings in |
245 ;;; function-key-map. | 239 ;;; function-key-map. |
246 ;;; | 240 ;;; |
247 (cond | 241 (cond |
248 (edt-x-emacs-p | 242 ((featurep 'xemacs) |
249 (setq edt-return-seq (read-key-sequence "Hit carriage-return <CR> to continue ")) | 243 (setq edt-return-seq (read-key-sequence "Hit carriage-return <CR> to continue ")) |
250 (setq edt-return (concat "[" (format "%s" (event-key (aref edt-return-seq 0))) "]"))) | 244 (setq edt-return (concat "[" (format "%s" (event-key (aref edt-return-seq 0))) "]"))) |
251 (t | 245 (t |
252 (if edt-window-system | 246 (if edt-window-system |
253 (progn | 247 (progn |
325 | 319 |
326 | 320 |
327 ;;; | 321 ;;; |
328 ;;; Key mapping functions | 322 ;;; Key mapping functions |
329 ;;; | 323 ;;; |
330 (defun edt-lucid-map-key (ident descrip) | 324 (defun edt-map-key (ident descrip) |
331 (interactive) | 325 (interactive) |
332 (setq edt-key-seq (read-key-sequence (format "Press %s%s: " ident descrip))) | 326 (if (featurep 'xemacs) |
333 (setq edt-key (concat "[" (format "%s" (event-key (aref edt-key-seq 0))) "]")) | 327 (progn |
334 (cond ((not (equal edt-key edt-return)) | 328 (setq edt-key-seq (read-key-sequence (format "Press %s%s: " ident descrip))) |
335 (set-buffer "Keys") | 329 (setq edt-key (concat "[" (format "%s" (event-key (aref edt-key-seq 0))) "]")) |
336 (insert (format " (\"%s\" . %s)\n" ident edt-key)) | 330 (cond ((not (equal edt-key edt-return)) |
337 (set-buffer "Directions")) | 331 (set-buffer "Keys") |
338 ;; bogosity to get next prompt to come up, if the user hits <CR>! | 332 (insert (format " (\"%s\" . %s)\n" ident edt-key)) |
339 ;; check periodically to see if this is still needed... | 333 (set-buffer "Directions")) |
340 (t | 334 ;; bogosity to get next prompt to come up, if the user hits <CR>! |
341 (set-buffer "Keys") | 335 ;; check periodically to see if this is still needed... |
342 (insert (format " (\"%s\" . \"\" )\n" ident)) | 336 (t |
343 (set-buffer "Directions"))) | 337 (set-buffer "Keys") |
338 (insert (format " (\"%s\" . \"\" )\n" ident)) | |
339 (set-buffer "Directions")))) | |
340 (setq edt-key (read-key-sequence (format "Press %s%s: " ident descrip))) | |
341 (cond ((not (equal edt-key edt-return)) | |
342 (set-buffer "Keys") | |
343 (insert (if (vectorp edt-key) | |
344 (format " (\"%s\" . %s)\n" ident edt-key) | |
345 (format " (\"%s\" . \"%s\")\n" ident edt-key))) | |
346 (set-buffer "Directions")) | |
347 ;; bogosity to get next prompt to come up, if the user hits <CR>! | |
348 ;; check periodically to see if this is still needed... | |
349 (t | |
350 (set-buffer "Keys") | |
351 (insert (format " (\"%s\" . \"\" )\n" ident)) | |
352 (set-buffer "Directions")))) | |
344 edt-key) | 353 edt-key) |
345 | 354 |
346 (defun edt-gnu-map-key (ident descrip) | |
347 (interactive) | |
348 (setq edt-key (read-key-sequence (format "Press %s%s: " ident descrip))) | |
349 (cond ((not (equal edt-key edt-return)) | |
350 (set-buffer "Keys") | |
351 (insert (if (vectorp edt-key) | |
352 (format " (\"%s\" . %s)\n" ident edt-key) | |
353 (format " (\"%s\" . \"%s\")\n" ident edt-key))) | |
354 (set-buffer "Directions")) | |
355 ;; bogosity to get next prompt to come up, if the user hits <CR>! | |
356 ;; check periodically to see if this is still needed... | |
357 (t | |
358 (set-buffer "Keys") | |
359 (insert (format " (\"%s\" . \"\" )\n" ident)) | |
360 (set-buffer "Directions"))) | |
361 edt-key) | |
362 | |
363 (fset 'edt-map-key (if edt-x-emacs-p 'edt-lucid-map-key 'edt-gnu-map-key)) | |
364 (set-buffer "Keys") | 355 (set-buffer "Keys") |
365 (insert " | 356 (insert " |
366 ;; | 357 ;; |
367 ;; Arrows | 358 ;; Arrows |
368 ;; | 359 ;; |
492 ;; | 483 ;; |
493 ") | 484 ") |
494 ;;; | 485 ;;; |
495 ;;; Restore function-key-map. | 486 ;;; Restore function-key-map. |
496 ;;; | 487 ;;; |
497 (if (and edt-window-system (not edt-x-emacs-p)) | 488 (if (and edt-window-system (not (featurep 'xemacs))) |
498 (setq function-key-map edt-save-function-key-map)) | 489 (setq function-key-map edt-save-function-key-map)) |
499 (setq EDT-key-name "") | 490 (setq EDT-key-name "") |
500 (while (not | 491 (while (not |
501 (string-equal (setq EDT-key-name (read-string "EDT Key Name: ")) "")) | 492 (string-equal (setq EDT-key-name (read-string "EDT Key Name: ")) "")) |
502 (edt-map-key EDT-key-name "")) | 493 (edt-map-key EDT-key-name "")) |
515 ;;; | 506 ;;; |
516 ;;; | 507 ;;; |
517 ;;; Save the key mapping file | 508 ;;; Save the key mapping file |
518 ;;; | 509 ;;; |
519 (let ((file (concat | 510 (let ((file (concat |
520 "~/.edt-" edt-emacs-variant | 511 "~/.edt-" (if (featurep 'xemacs) "xemacs" "gnu") |
521 (if edt-term (concat "-" edt-term)) | 512 (if edt-term (concat "-" edt-term)) |
522 (if edt-xserver (concat "-" edt-xserver)) | 513 (if edt-xserver (concat "-" edt-xserver)) |
523 (if edt-window-system (concat "-" (upcase (symbol-name edt-window-system)))) | 514 (if edt-window-system (concat "-" (upcase (symbol-name edt-window-system)))) |
524 "-keys"))) | 515 "-keys"))) |
525 (set-visited-file-name | 516 (set-visited-file-name |