1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-04-27 16:51:06 -07:00

* 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.

This commit is contained in:
Adrian Robert 2008-08-07 03:10:08 +00:00
parent c6aecbbd02
commit 55e8d9a557
3 changed files with 59 additions and 93 deletions

View file

@ -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

View file

@ -185,7 +185,7 @@ and VALUE is the value which is given to that frame parameter
(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)

View file

@ -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 @@ The properties returned may include `top', `left', `height', and `width'."
;;;; 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 @@ The properties returned may include `top', `left', `height', and `width'."
(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 @@ this defaults to \"printenv\"."
(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 @@ this defaults to \"printenv\"."
(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 @@ This should be bound to a mouse click event type."
(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 @@ unless the current buffer is a scratch buffer.")
;; 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 @@ unless the current buffer is a scratch buffer.")
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 @@ cursor display. On a text-only terminal, this is not implemented."
(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 @@ See the documentation of `create-fontset-from-fontset-spec for the format.")
(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 @@ See the documentation of `create-fontset-from-fontset-spec for the format.")
(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 @@ See the documentation of `create-fontset-from-fontset-spec for the format.")
(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 @@ Note, tranparency works better on Tiger (10.4) and higher."
(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.")