aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdrian Robert2008-08-07 03:10:08 +0000
committerAdrian Robert2008-08-07 03:10:08 +0000
commit55e8d9a5577d89d3dd866e43da6cd38149b62f2e (patch)
tree0c5ec10f8ee9881b167d6429dd3bd5ab527b6317
parentc6aecbbd026dbdf263b2da00b4f351556bbd8042 (diff)
downloademacs-55e8d9a5577d89d3dd866e43da6cd38149b62f2e.tar.gz
emacs-55e8d9a5577d89d3dd866e43da6cd38149b62f2e.zip
* startup.el (command-line-ns-option-alist): Use ignore instead of ns-ignore-0-arg. * term/ns-win.el (ns-ignore-0-arg, mouse-extend-region) (ns-win-suspend-error, ns-yes-or-no-p, colors): Drop. (ns-alternatives-map): New variable. (x-set-up-function-keys): Use it. (global): Comment out 'put backspace ascii-character...' and friends. Move function-key-map into ns-alternatives-map. Don't call precompute-menubar-bindings. Don't set anything connected with browse-url. (after-make-frame-functions): Clarify comment why a hook is added.
-rw-r--r--lisp/ChangeLog15
-rw-r--r--lisp/startup.el2
-rw-r--r--lisp/term/ns-win.el139
3 files changed, 61 insertions, 95 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 134504c38f0..8727b6d9a34 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,18 @@
12008-08-06 Adrian Robert <Adrian.B.Robert@gmail.com>
2
3 * startup.el (command-line-ns-option-alist): Use ignore instead of
4 ns-ignore-0-arg.
5
6 * term/ns-win.el (ns-ignore-0-arg, mouse-extend-region)
7 (ns-win-suspend-error, ns-yes-or-no-p, colors): Drop.
8 (ns-alternatives-map): New variable.
9 (x-set-up-function-keys): Use it.
10 (global): Comment out "put backspace ascii-character..." and friends.
11 Move function-key-map into ns-alternatives-map. Don't call
12 precompute-menubar-bindings. Don't set anything connected with
13 browse-url.
14 (after-make-frame-functions): Clarify comment why a hook is added.
15
12008-08-06 Joakim Verona <joakim@verona.se> 162008-08-06 Joakim Verona <joakim@verona.se>
2 17
3 * thingatpt.el (thing-at-point-url-path-regexp): Allow parenthesis 18 * thingatpt.el (thing-at-point-url-path-regexp): Allow parenthesis
diff --git a/lisp/startup.el b/lisp/startup.el
index dd387672091..2663b8dd83c 100644
--- a/lisp/startup.el
+++ b/lisp/startup.el
@@ -185,7 +185,7 @@ and VALUE is the value which is given to that frame parameter
185(defconst command-line-ns-option-alist 185(defconst command-line-ns-option-alist
186 '(("-NSAutoLaunch" 1 ns-ignore-1-arg) 186 '(("-NSAutoLaunch" 1 ns-ignore-1-arg)
187 ("-NXAutoLaunch" 1 ns-ignore-1-arg) 187 ("-NXAutoLaunch" 1 ns-ignore-1-arg)
188 ("-macosx" 0 ns-ignore-0-arg) 188 ("-macosx" 0 ignore)
189 ("-NSHost" 1 ns-ignore-1-arg) 189 ("-NSHost" 1 ns-ignore-1-arg)
190 ("-_NSMachLaunch" 1 ns-ignore-1-arg) 190 ("-_NSMachLaunch" 1 ns-ignore-1-arg)
191 ("-MachLaunch" 1 ns-ignore-1-arg) 191 ("-MachLaunch" 1 ns-ignore-1-arg)
diff --git a/lisp/term/ns-win.el b/lisp/term/ns-win.el
index b3f52c4a21a..f11b34a7abf 100644
--- a/lisp/term/ns-win.el
+++ b/lisp/term/ns-win.el
@@ -110,7 +110,6 @@
110 '(ns-open-temp-file)) 110 '(ns-open-temp-file))
111 ns-input-file (append ns-input-file (list (pop ns-invocation-args))))) 111 ns-input-file (append ns-input-file (list (pop ns-invocation-args)))))
112 112
113(defun ns-ignore-0-arg (switch))
114(defun ns-ignore-1-arg (switch) 113(defun ns-ignore-1-arg (switch)
115 (setq ns-invocation-args (cdr ns-invocation-args))) 114 (setq ns-invocation-args (cdr ns-invocation-args)))
116(defun ns-ignore-2-arg (switch) 115(defun ns-ignore-2-arg (switch)
@@ -180,35 +179,41 @@ The properties returned may include `top', `left', `height', and `width'."
180 179
181;;;; Keyboard mapping. 180;;;; Keyboard mapping.
182 181
182;;TODO: all terms have these, but they don't seem necessary.
183;; Remove if no problems for some time after 2008-08-06.
183;; These tell read-char how to convert 184;; These tell read-char how to convert
184;; these special chars to ASCII. 185;; these special chars to ASCII.
185(put 'backspace 'ascii-character 127) 186;;(put 'backspace 'ascii-character 127)
186(put 'delete 'ascii-character 127) 187;;(put 'delete 'ascii-character 127)
187(put 'tab 'ascii-character ?\t) 188;;(put 'tab 'ascii-character ?\t)
188(put 'S-tab 'ascii-character (logior 16 ?\t)) 189;;(put 'S-tab 'ascii-character (logior 16 ?\t))
189(put 'linefeed 'ascii-character ?\n) 190;;(put 'linefeed 'ascii-character ?\n)
190(put 'clear 'ascii-character 12) 191;;(put 'clear 'ascii-character 12)
191(put 'return 'ascii-character 13) 192;;(put 'return 'ascii-character 13)
192(put 'escape 'ascii-character ?\e) 193;;(put 'escape 'ascii-character ?\e)
193 194
194;; Map certain keypad keys into ASCII characters 195
195;; that people usually expect. 196(defvar ns-alternatives-map
196(define-key function-key-map [backspace] [127]) 197 (let ((map (make-sparse-keymap)))
197(define-key function-key-map [delete] [127]) 198 ;; Map certain keypad keys into ASCII characters
198(define-key function-key-map [tab] [?\t]) 199 ;; that people usually expect.
199(define-key function-key-map [S-tab] [25]) 200 (define-key map [backspace] [?\d])
200(define-key function-key-map [linefeed] [?\n]) 201 (define-key map [delete] [?\d])
201(define-key function-key-map [clear] [11]) 202 (define-key map [tab] [?\t])
202(define-key function-key-map [return] [13]) 203 (define-key map [S-tab] [25])
203(define-key function-key-map [escape] [?\e]) 204 (define-key map [linefeed] [?\n])
204(define-key function-key-map [M-backspace] [?\M-\d]) 205 (define-key map [clear] [?\C-l])
205(define-key function-key-map [M-delete] [?\M-\d]) 206 (define-key map [return] [?\C-m])
206(define-key function-key-map [M-tab] [?\M-\t]) 207 (define-key map [escape] [?\e])
207(define-key function-key-map [M-linefeed] [?\M-\n]) 208 (define-key map [M-backspace] [?\M-\d])
208(define-key function-key-map [M-clear] [?\M-\013]) 209 (define-key map [M-delete] [?\M-\d])
209(define-key function-key-map [M-return] [?\M-\015]) 210 (define-key map [M-tab] [?\M-\t])
210(define-key function-key-map [M-escape] [?\M-\e]) 211 (define-key map [M-linefeed] [?\M-\n])
211 212 (define-key map [M-clear] [?\M-\C-l])
213 (define-key map [M-return] [?\M-\C-m])
214 (define-key map [M-escape] [?\M-\e])
215 map)
216 "Keymap of alternative meanings for some keys under NS.")
212 217
213;; Here are some Nextstep-like bindings for command key sequences. 218;; Here are some Nextstep-like bindings for command key sequences.
214(define-key global-map [?\s-,] 'ns-popup-prefs-panel) 219(define-key global-map [?\s-,] 'ns-popup-prefs-panel)
@@ -263,6 +268,10 @@ The properties returned may include `top', `left', `height', and `width'."
263(define-key global-map [kp-prior] 'scroll-down) 268(define-key global-map [kp-prior] 'scroll-down)
264(define-key global-map [kp-next] 'scroll-up) 269(define-key global-map [kp-next] 'scroll-up)
265 270
271;;; Allow shift-clicks to work similarly to under Nextstep
272(define-key global-map [S-mouse-1] 'mouse-save-then-kill)
273(global-unset-key [S-down-mouse-1])
274
266 275
267;; Special Nextstep-generated events are converted to function keys. Here 276;; Special Nextstep-generated events are converted to function keys. Here
268;; are the bindings for them. 277;; are the bindings for them.
@@ -369,9 +378,9 @@ this defaults to \"printenv\"."
369 (with-selected-frame frame 378 (with-selected-frame frame
370 (setq interprogram-cut-function 'x-select-text 379 (setq interprogram-cut-function 'x-select-text
371 interprogram-paste-function 'x-cut-buffer-or-selection-value) 380 interprogram-paste-function 'x-cut-buffer-or-selection-value)
372 ;; (let ((map (copy-keymap x-alternatives-map))) 381 (let ((map (copy-keymap ns-alternatives-map)))
373 ;; (set-keymap-parent map (keymap-parent local-function-key-map)) 382 (set-keymap-parent map (keymap-parent local-function-key-map))
374 ;; (set-keymap-parent local-function-key-map map)) 383 (set-keymap-parent local-function-key-map map))
375 (setq system-key-alist 384 (setq system-key-alist
376 (list 385 (list
377 (cons (logior (lsh 0 16) 1) 'ns-power-off) 386 (cons (logior (lsh 0 16) 1) 'ns-power-off)
@@ -466,40 +475,8 @@ this defaults to \"printenv\"."
466 (cons (logior (lsh 3 16) 25) 'S-tab) 475 (cons (logior (lsh 3 16) 25) 'S-tab)
467 (cons (logior (lsh 3 16) 27) 'escape) 476 (cons (logior (lsh 3 16) 27) 'escape)
468 (cons (logior (lsh 3 16) 127) 'delete) 477 (cons (logior (lsh 3 16) 127) 'delete)
469 )) 478 )))
470 (set-terminal-parameter frame 'x-setup-function-keys t)))) 479 (set-terminal-parameter frame 'x-setup-function-keys t)))
471
472
473
474;;;; Miscellaneous mouse bindings.
475
476;;; Allow shift-clicks to work just like under Nextstep
477(defun mouse-extend-region (event)
478 "Move point or mark so as to extend region.
479This should be bound to a mouse click event type."
480 (interactive "e")
481 (mouse-minibuffer-check event)
482 (let ((posn (event-end event)))
483 (if (not (windowp (posn-window posn)))
484 (error "Cursor not in text area of window"))
485 (select-window (posn-window posn))
486 (cond
487 ((not (numberp (posn-point posn))))
488 ((or (not mark-active) (> (abs (- (posn-point posn) (point)))
489 (abs (- (posn-point posn) (mark)))))
490 (let ((point-save (point)))
491 (unwind-protect
492 (progn
493 (goto-char (posn-point posn))
494 (push-mark nil t t)
495 (or transient-mark-mode
496 (sit-for 1)))
497 (goto-char point-save))))
498 (t
499 (goto-char (posn-point posn))))))
500
501(define-key global-map [S-mouse-1] 'mouse-extend-region)
502(global-unset-key [S-down-mouse-1])
503 480
504 481
505 482
@@ -768,8 +745,6 @@ This should be bound to a mouse click event type."
768 (define-key global-map mapping (cons (car path) name)))) 745 (define-key global-map mapping (cons (car path) name))))
769 name)) 746 name))
770 747
771(precompute-menubar-bindings)
772
773;; nsterm.m 748;; nsterm.m
774(defvar ns-input-spi-name) 749(defvar ns-input-spi-name)
775(defvar ns-input-spi-arg) 750(defvar ns-input-spi-arg)
@@ -1216,7 +1191,6 @@ unless the current buffer is a scratch buffer.")
1216 1191
1217;; If no position specified, make new frame offset by 25 from current. 1192;; If no position specified, make new frame offset by 25 from current.
1218(defvar parameters) ; dynamically bound in make-frame 1193(defvar parameters) ; dynamically bound in make-frame
1219
1220(add-hook 'before-make-frame-hook 1194(add-hook 'before-make-frame-hook
1221 (lambda () 1195 (lambda ()
1222 (let ((left (cdr (assq 'left (frame-parameters)))) 1196 (let ((left (cdr (assq 'left (frame-parameters))))
@@ -1232,14 +1206,9 @@ unless the current buffer is a scratch buffer.")
1232 parameters)))))))) 1206 parameters))))))))
1233 1207
1234;; frame will be focused anyway, so select it 1208;; frame will be focused anyway, so select it
1209;; (if this is not done, modeline is dimmed until first interaction)
1235(add-hook 'after-make-frame-functions 'select-frame) 1210(add-hook 'after-make-frame-functions 'select-frame)
1236 1211
1237;; (defun ns-win-suspend-error ()
1238;; (error "Suspending an emacs running under *Step/OS X makes no sense"))
1239;; (add-hook 'suspend-hook 'ns-win-suspend-error)
1240;; (substitute-key-definition 'suspend-emacs 'iconify-or-deiconify-frame
1241;; global-map)
1242
1243;; Based on a function by David Reitter <dreitter@inf.ed.ac.uk> ; 1212;; Based on a function by David Reitter <dreitter@inf.ed.ac.uk> ;
1244;; see http://lists.gnu.org/archive/html/emacs-devel/2005-09/msg00681.html . 1213;; see http://lists.gnu.org/archive/html/emacs-devel/2005-09/msg00681.html .
1245(defun ns-toggle-toolbar (&optional frame) 1214(defun ns-toggle-toolbar (&optional frame)
@@ -1295,13 +1264,6 @@ cursor display. On a text-only terminal, this is not implemented."
1295 (error "Cancelled"))) 1264 (error "Cancelled")))
1296 (print-buffer))) 1265 (print-buffer)))
1297 1266
1298(defun ns-yes-or-no-p (prompt)
1299 "Ask user a \"yes or no\" question using a Nextstep graphical panel.
1300PROMPT is the prompt string."
1301 (interactive)
1302 (setq last-nonmenu-event nil)
1303 (yes-or-no-p prompt))
1304
1305 1267
1306;;;; Font support. 1268;;;; Font support.
1307 1269
@@ -1436,7 +1398,7 @@ See the documentation of `create-fontset-from-fontset-spec for the format.")
1436(global-unset-key [vertical-scroll-bar drag-mouse-1]) 1398(global-unset-key [vertical-scroll-bar drag-mouse-1])
1437 1399
1438(defun ns-scroll-bar-move (event) 1400(defun ns-scroll-bar-move (event)
1439 "Scroll the frame according to an Nextstep scroller event." 1401 "Scroll the frame according to a Nextstep scroller event."
1440 (interactive "e") 1402 (interactive "e")
1441 (let* ((pos (event-end event)) 1403 (let* ((pos (event-end event))
1442 (window (nth 0 pos)) 1404 (window (nth 0 pos))
@@ -1456,7 +1418,7 @@ See the documentation of `create-fontset-from-fontset-spec for the format.")
1456 (vertical-motion (/ (window-height window) 2) window)))) 1418 (vertical-motion (/ (window-height window) 2) window))))
1457 1419
1458(defun ns-handle-scroll-bar-event (event) 1420(defun ns-handle-scroll-bar-event (event)
1459 "Handle scroll bar EVENT to emulate Mac Toolbox style scrolling." 1421 "Handle scroll bar EVENT to emulate Nextstep style scrolling."
1460 (interactive "e") 1422 (interactive "e")
1461 (let* ((position (event-start event)) 1423 (let* ((position (event-start event))
1462 (bar-part (nth 4 position)) 1424 (bar-part (nth 4 position))
@@ -1492,8 +1454,6 @@ See the documentation of `create-fontset-from-fontset-spec for the format.")
1492 1454
1493(defvar x-colors (ns-list-colors) 1455(defvar x-colors (ns-list-colors)
1494 "The list of colors defined in non-PANTONE color files.") 1456 "The list of colors defined in non-PANTONE color files.")
1495(defvar colors x-colors
1496 "The list of colors defined in non-PANTONE color files.")
1497 1457
1498(defun xw-defined-colors (&optional frame) 1458(defun xw-defined-colors (&optional frame)
1499 "Return a list of colors supported for a particular frame. 1459 "Return a list of colors supported for a particular frame.
@@ -1596,15 +1556,6 @@ Note, tranparency works better on Tiger (10.4) and higher."
1596(setq frame-title-format t 1556(setq frame-title-format t
1597 icon-title-format t) 1557 icon-title-format t)
1598 1558
1599;; Set up browser connectivity.
1600(defvar browse-url-generic-program)
1601
1602(setq browse-url-browser-function 'browse-url-generic)
1603(setq browse-url-generic-program
1604 (cond ((eq system-type 'darwin) "open")
1605 ;; Otherwise, GNUstep.
1606 (t "gopen")))
1607
1608 1559
1609(defvar ns-initialized nil 1560(defvar ns-initialized nil
1610 "Non-nil if Nextstep windowing has been initialized.") 1561 "Non-nil if Nextstep windowing has been initialized.")