changeset 97348:bf45b2dcafff

* 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.
author Adrian Robert <Adrian.B.Robert@gmail.com>
date Thu, 07 Aug 2008 03:10:08 +0000
parents bf6fca3efaf5
children 71b3b925a155
files lisp/ChangeLog lisp/startup.el lisp/term/ns-win.el
diffstat 3 files changed, 60 insertions(+), 94 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/ChangeLog	Thu Aug 07 01:54:06 2008 +0000
+++ b/lisp/ChangeLog	Thu Aug 07 03:10:08 2008 +0000
@@ -1,3 +1,18 @@
+2008-08-06  Adrian Robert  <Adrian.B.Robert@gmail.com>
+
+	* 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.
+
 2008-08-06  Joakim Verona  <joakim@verona.se>
 
 	* thingatpt.el (thing-at-point-url-path-regexp): Allow parenthesis
--- a/lisp/startup.el	Thu Aug 07 01:54:06 2008 +0000
+++ b/lisp/startup.el	Thu Aug 07 03:10:08 2008 +0000
@@ -185,7 +185,7 @@
 (defconst command-line-ns-option-alist
   '(("-NSAutoLaunch" 1 ns-ignore-1-arg)
     ("-NXAutoLaunch" 1 ns-ignore-1-arg)
-    ("-macosx" 0 ns-ignore-0-arg)
+    ("-macosx" 0 ignore)
     ("-NSHost" 1 ns-ignore-1-arg)
     ("-_NSMachLaunch" 1 ns-ignore-1-arg)
     ("-MachLaunch" 1 ns-ignore-1-arg)
--- a/lisp/term/ns-win.el	Thu Aug 07 01:54:06 2008 +0000
+++ b/lisp/term/ns-win.el	Thu Aug 07 03:10:08 2008 +0000
@@ -110,7 +110,6 @@
 				      '(ns-open-temp-file))
         ns-input-file (append ns-input-file (list (pop ns-invocation-args)))))
 
-(defun ns-ignore-0-arg (switch))
 (defun ns-ignore-1-arg (switch)
   (setq ns-invocation-args (cdr ns-invocation-args)))
 (defun ns-ignore-2-arg (switch)
@@ -180,35 +179,41 @@
 
 ;;;; Keyboard mapping.
 
+;;TODO: all terms have these, but they don't seem necessary.
+;;      Remove if no problems for some time after 2008-08-06.
 ;; These tell read-char how to convert
 ;; these special chars to ASCII.
-(put 'backspace 'ascii-character 127)
-(put 'delete 'ascii-character 127)
-(put 'tab 'ascii-character ?\t)
-(put 'S-tab 'ascii-character (logior 16 ?\t))
-(put 'linefeed 'ascii-character ?\n)
-(put 'clear 'ascii-character 12)
-(put 'return 'ascii-character 13)
-(put 'escape 'ascii-character ?\e)
+;;(put 'backspace 'ascii-character 127)
+;;(put 'delete 'ascii-character 127)
+;;(put 'tab 'ascii-character ?\t)
+;;(put 'S-tab 'ascii-character (logior 16 ?\t))
+;;(put 'linefeed 'ascii-character ?\n)
+;;(put 'clear 'ascii-character 12)
+;;(put 'return 'ascii-character 13)
+;;(put 'escape 'ascii-character ?\e)
+
 
-;; Map certain keypad keys into ASCII characters
-;; that people usually expect.
-(define-key function-key-map [backspace] [127])
-(define-key function-key-map [delete] [127])
-(define-key function-key-map [tab] [?\t])
-(define-key function-key-map [S-tab] [25])
-(define-key function-key-map [linefeed] [?\n])
-(define-key function-key-map [clear] [11])
-(define-key function-key-map [return] [13])
-(define-key function-key-map [escape] [?\e])
-(define-key function-key-map [M-backspace] [?\M-\d])
-(define-key function-key-map [M-delete] [?\M-\d])
-(define-key function-key-map [M-tab] [?\M-\t])
-(define-key function-key-map [M-linefeed] [?\M-\n])
-(define-key function-key-map [M-clear] [?\M-\013])
-(define-key function-key-map [M-return] [?\M-\015])
-(define-key function-key-map [M-escape] [?\M-\e])
-
+(defvar ns-alternatives-map
+  (let ((map (make-sparse-keymap)))
+    ;; Map certain keypad keys into ASCII characters
+    ;; that people usually expect.
+    (define-key map [backspace] [?\d])
+    (define-key map [delete] [?\d])
+    (define-key map [tab] [?\t])
+    (define-key map [S-tab] [25])
+    (define-key map [linefeed] [?\n])
+    (define-key map [clear] [?\C-l])
+    (define-key map [return] [?\C-m])
+    (define-key map [escape] [?\e])
+    (define-key map [M-backspace] [?\M-\d])
+    (define-key map [M-delete] [?\M-\d])
+    (define-key map [M-tab] [?\M-\t])
+    (define-key map [M-linefeed] [?\M-\n])
+    (define-key map [M-clear] [?\M-\C-l])
+    (define-key map [M-return] [?\M-\C-m])
+    (define-key map [M-escape] [?\M-\e])
+    map)
+  "Keymap of alternative meanings for some keys under NS.")
 
 ;; Here are some Nextstep-like bindings for command key sequences.
 (define-key global-map [?\s-,] 'ns-popup-prefs-panel)
@@ -263,6 +268,10 @@
 (define-key global-map [kp-prior] 'scroll-down)
 (define-key global-map [kp-next] 'scroll-up)
 
+;;; Allow shift-clicks to work similarly to under Nextstep
+(define-key global-map [S-mouse-1] 'mouse-save-then-kill)
+(global-unset-key [S-down-mouse-1])
+
 
 ;; Special Nextstep-generated events are converted to function keys.  Here
 ;; are the bindings for them.
@@ -369,9 +378,9 @@
     (with-selected-frame frame
       (setq interprogram-cut-function 'x-select-text
 	    interprogram-paste-function 'x-cut-buffer-or-selection-value)
-      ;; (let ((map (copy-keymap x-alternatives-map)))
-      ;;   (set-keymap-parent map (keymap-parent local-function-key-map))
-      ;;   (set-keymap-parent local-function-key-map map))
+      (let ((map (copy-keymap ns-alternatives-map)))
+	(set-keymap-parent map (keymap-parent local-function-key-map))
+	(set-keymap-parent local-function-key-map map))
       (setq system-key-alist
             (list
              (cons (logior (lsh 0 16)   1) 'ns-power-off)
@@ -466,40 +475,8 @@
              (cons (logior (lsh 3 16)  25) 'S-tab)
              (cons (logior (lsh 3 16)  27) 'escape)
              (cons (logior (lsh 3 16) 127) 'delete)
-             ))
-      (set-terminal-parameter frame 'x-setup-function-keys t))))
-
-
-
-;;;; Miscellaneous mouse bindings.
-
-;;; Allow shift-clicks to work just like under Nextstep
-(defun mouse-extend-region (event)
-  "Move point or mark so as to extend region.
-This should be bound to a mouse click event type."
-  (interactive "e")
-  (mouse-minibuffer-check event)
-  (let ((posn (event-end event)))
-    (if (not (windowp (posn-window posn)))
-        (error "Cursor not in text area of window"))
-    (select-window (posn-window posn))
-    (cond
-     ((not (numberp (posn-point posn))))
-     ((or (not mark-active) (> (abs (- (posn-point posn) (point)))
-                               (abs (- (posn-point posn) (mark)))))
-      (let ((point-save (point)))
-        (unwind-protect
-            (progn
-              (goto-char (posn-point posn))
-              (push-mark nil t t)
-              (or transient-mark-mode
-                  (sit-for 1)))
-          (goto-char point-save))))
-     (t
-      (goto-char (posn-point posn))))))
-
-(define-key global-map [S-mouse-1] 'mouse-extend-region)
-(global-unset-key [S-down-mouse-1])
+             )))
+    (set-terminal-parameter frame 'x-setup-function-keys t)))
 
 
 
@@ -768,8 +745,6 @@
       (define-key global-map mapping (cons (car path) name))))
     name))
 
-(precompute-menubar-bindings)
-
 ;; nsterm.m
 (defvar ns-input-spi-name)
 (defvar ns-input-spi-arg)
@@ -1216,7 +1191,6 @@
 
 ;; If no position specified, make new frame offset by 25 from current.
 (defvar parameters)		     ; dynamically bound in make-frame
-
 (add-hook 'before-make-frame-hook
           (lambda ()
             (let ((left (cdr (assq 'left (frame-parameters))))
@@ -1232,14 +1206,9 @@
                                              parameters))))))))
 
 ;; frame will be focused anyway, so select it
+;; (if this is not done, modeline is dimmed until first interaction)
 (add-hook 'after-make-frame-functions 'select-frame)
 
-;; (defun ns-win-suspend-error ()
-;;   (error "Suspending an emacs running under *Step/OS X makes no sense"))
-;; (add-hook 'suspend-hook 'ns-win-suspend-error)
-;; (substitute-key-definition 'suspend-emacs 'iconify-or-deiconify-frame
-;; 			   global-map)
-
 ;; Based on a function by David Reitter <dreitter@inf.ed.ac.uk> ;
 ;; see http://lists.gnu.org/archive/html/emacs-devel/2005-09/msg00681.html .
 (defun ns-toggle-toolbar (&optional frame)
@@ -1295,13 +1264,6 @@
 	  (error "Cancelled")))
     (print-buffer)))
 
-(defun ns-yes-or-no-p (prompt)
-  "Ask user a \"yes or no\" question using a Nextstep graphical panel.
-PROMPT is the prompt string."
-  (interactive)
-  (setq last-nonmenu-event nil)
-  (yes-or-no-p prompt))
-
 
 ;;;; Font support.
 
@@ -1436,7 +1398,7 @@
 (global-unset-key [vertical-scroll-bar drag-mouse-1])
 
 (defun ns-scroll-bar-move (event)
-  "Scroll the frame according to an Nextstep scroller event."
+  "Scroll the frame according to a Nextstep scroller event."
   (interactive "e")
   (let* ((pos (event-end event))
          (window (nth 0 pos))
@@ -1456,7 +1418,7 @@
       (vertical-motion (/ (window-height window) 2) window))))
 
 (defun ns-handle-scroll-bar-event (event)
-  "Handle scroll bar EVENT to emulate Mac Toolbox style scrolling."
+  "Handle scroll bar EVENT to emulate Nextstep style scrolling."
   (interactive "e")
   (let* ((position (event-start event))
 	 (bar-part (nth 4 position))
@@ -1492,8 +1454,6 @@
 
 (defvar x-colors (ns-list-colors)
   "The list of colors defined in non-PANTONE color files.")
-(defvar colors x-colors
-  "The list of colors defined in non-PANTONE color files.")
 
 (defun xw-defined-colors (&optional frame)
   "Return a list of colors supported for a particular frame.
@@ -1596,15 +1556,6 @@
 (setq frame-title-format t
       icon-title-format t)
 
-;; Set up browser connectivity.
-(defvar browse-url-generic-program)
-
-(setq browse-url-browser-function 'browse-url-generic)
-(setq browse-url-generic-program
-      (cond ((eq system-type 'darwin) "open")
-            ;; Otherwise, GNUstep.
-            (t "gopen")))
-
 
 (defvar ns-initialized nil
   "Non-nil if Nextstep windowing has been initialized.")