mirror of
git://git.sv.gnu.org/emacs.git
synced 2025-12-15 18:40:39 -08:00
Unify shutdown handling under NS, via ns-power-off key event (where appropriate) and save-buffers-kill-emacs.
remove NS-specific preferences window that used to show NS-specific preferences. Integrate preferences in Lisp accessible customization system where possible. Remove ns-expand-space, because it can be set only during fontloading (i.e. not at runtime), and because of redundancy with line-spacing frame parameter. Remove loading of most and saving of all NS resources (from org.gnu.Emacs.plist). nsterm.m (ns_shutdown_properly, -terminate): remove global state variable as it was never reset (ns_term_init): remove initialization of Lisp-settable defaults and ns_expand_space (-setPanelFromDefaultValues): remove ns_expand_space. (-showPreferencesWindow): send new KEY_NS_SHOW_PREFS key. nsfont.m (nsfont_open): remove ns_expand_space, assume -0.5 i.e. no additional spacing, similar to Carbon port. nsterm.h: define KEY_NS_SHOW_PREFS key. nsfns.m (ns-popup-prefs-panel): remove. term/ns-win.el (ns-expand-space): remove. (ns-show-prefs event): run `customize'. (ns-power-off): run `save-buffers-kill-emacs', but ask user whether to save files (as is standard) (clipboard-yank, clipboard-kill-ring-save, clipboard-kill-region) (menu-bar-enable-clipboard): do not undefine these. (ns-save-preferences,ns-save-options,ns-show-preferences-help): remove.
This commit is contained in:
parent
b769f3daad
commit
c6c62e780c
7 changed files with 75 additions and 487 deletions
|
|
@ -1,3 +1,13 @@
|
|||
2009-03-14 David Reitter <david.reitter@gmail.com>
|
||||
|
||||
* term/ns-win.el (ns-expand-space): remove.
|
||||
(ns-show-prefs event): run `customize'.
|
||||
(ns-power-off): run `save-buffers-kill-emacs', but ask user
|
||||
whether to save files (as is standard)
|
||||
(clipboard-yank, clipboard-kill-ring-save, clipboard-kill-region)
|
||||
(menu-bar-enable-clipboard): do not undefine these.
|
||||
(ns-save-preferences,ns-save-options,ns-show-preferences-help): remove.
|
||||
|
||||
2009-03-14 Glenn Morris <rgm@gnu.org>
|
||||
|
||||
* mail/sendmail.el (mail-interactive): Doc fix.
|
||||
|
|
|
|||
|
|
@ -283,8 +283,7 @@ The properties returned may include `top', `left', `height', and `width'."
|
|||
|
||||
;; Special Nextstep-generated events are converted to function keys. Here
|
||||
;; are the bindings for them.
|
||||
(define-key global-map [ns-power-off]
|
||||
(lambda () (interactive) (save-buffers-kill-emacs t)))
|
||||
(define-key global-map [ns-power-off] 'save-buffers-kill-emacs)
|
||||
(define-key global-map [ns-open-file] 'ns-find-file)
|
||||
(define-key global-map [ns-open-temp-file] [ns-open-file])
|
||||
(define-key global-map [ns-drag-file] 'ns-insert-file)
|
||||
|
|
@ -296,7 +295,7 @@ The properties returned may include `top', `left', `height', and `width'."
|
|||
(define-key global-map [ns-spi-service-call] 'ns-spi-service-call)
|
||||
(define-key global-map [ns-new-frame] 'make-frame)
|
||||
(define-key global-map [ns-toggle-toolbar] 'ns-toggle-toolbar)
|
||||
(define-key global-map [ns-info-prefs] 'ns-show-preferences-help)
|
||||
(define-key global-map [ns-show-prefs] 'customize)
|
||||
|
||||
|
||||
;; Functions to set environment variables by running a subshell.
|
||||
|
|
@ -406,7 +405,7 @@ this defaults to \"printenv\"."
|
|||
(cons (logior (lsh 0 16) 11) 'ns-spi-service-call)
|
||||
(cons (logior (lsh 0 16) 12) 'ns-new-frame)
|
||||
(cons (logior (lsh 0 16) 13) 'ns-toggle-toolbar)
|
||||
(cons (logior (lsh 0 16) 14) 'ns-info-prefs)
|
||||
(cons (logior (lsh 0 16) 14) 'ns-show-prefs)
|
||||
(cons (logior (lsh 1 16) 32) 'f1)
|
||||
(cons (logior (lsh 1 16) 33) 'f2)
|
||||
(cons (logior (lsh 1 16) 34) 'f3)
|
||||
|
|
@ -494,10 +493,10 @@ this defaults to \"printenv\"."
|
|||
|
||||
;; Must come after keybindings.
|
||||
|
||||
(fmakunbound 'clipboard-yank)
|
||||
(fmakunbound 'clipboard-kill-ring-save)
|
||||
(fmakunbound 'clipboard-kill-region)
|
||||
(fmakunbound 'menu-bar-enable-clipboard)
|
||||
;; (fmakunbound 'clipboard-yank)
|
||||
;; (fmakunbound 'clipboard-kill-ring-save)
|
||||
;; (fmakunbound 'clipboard-kill-region)
|
||||
;; (fmakunbound 'menu-bar-enable-clipboard)
|
||||
|
||||
;; Add a couple of menus and rearrange some others; easiest just to redo toplvl
|
||||
;; Note keymap defns must be given last-to-first
|
||||
|
|
@ -985,135 +984,10 @@ Lines are highlighted according to `ns-input-line'."
|
|||
(t (read res)))))
|
||||
|
||||
;; nsterm.m
|
||||
(defvar ns-command-modifier)
|
||||
(defvar ns-control-modifier)
|
||||
(defvar ns-function-modifier)
|
||||
(defvar ns-antialias-text)
|
||||
(defvar ns-use-qd-smoothing)
|
||||
(defvar ns-use-system-highlight-color)
|
||||
(defvar ns-confirm-quit)
|
||||
|
||||
(declare-function ns-set-resource "nsfns.m" (owner name value))
|
||||
(declare-function ns-font-name "nsfns.m" (name))
|
||||
(declare-function ns-read-file-name "nsfns.m"
|
||||
(prompt &optional dir isLoad init))
|
||||
|
||||
(defun ns-save-preferences ()
|
||||
"Set all the defaults."
|
||||
(interactive)
|
||||
;; Global preferences
|
||||
(ns-set-resource nil "AlternateModifier" (symbol-name ns-alternate-modifier))
|
||||
(ns-set-resource nil "CommandModifier" (symbol-name ns-command-modifier))
|
||||
(ns-set-resource nil "ControlModifier" (symbol-name ns-control-modifier))
|
||||
(ns-set-resource nil "FunctionModifier" (symbol-name ns-function-modifier))
|
||||
(ns-set-resource nil "ExpandSpace"
|
||||
(if ns-expand-space
|
||||
(number-to-string ns-expand-space)
|
||||
"NO"))
|
||||
(ns-set-resource nil "GSFontAntiAlias" (if ns-antialias-text "YES" "NO"))
|
||||
(ns-set-resource nil "UseQuickdrawSmoothing"
|
||||
(if ns-use-qd-smoothing "YES" "NO"))
|
||||
(ns-set-resource nil "UseSystemHighlightColor"
|
||||
(if ns-use-system-highlight-color "YES" "NO"))
|
||||
(ns-set-resource nil "ConfirmQuit"
|
||||
(if ns-confirm-quit "YES" "NO"))
|
||||
;; Default frame parameters
|
||||
(let ((p (frame-parameters))
|
||||
v)
|
||||
(if (setq v (assq 'font p))
|
||||
(ns-set-resource nil "Font" (ns-font-name (cdr v))))
|
||||
(if (setq v (assq 'fontsize p))
|
||||
(ns-set-resource nil "FontSize" (number-to-string (cdr v))))
|
||||
(if (setq v (assq 'foreground-color p))
|
||||
(ns-set-resource nil "Foreground" (cdr v)))
|
||||
(if (setq v (assq 'background-color p))
|
||||
(ns-set-resource nil "Background" (cdr v)))
|
||||
(if (setq v (assq 'cursor-color p))
|
||||
(ns-set-resource nil "CursorColor" (cdr v)))
|
||||
(if (setq v (assq 'cursor-type p))
|
||||
(ns-set-resource nil "CursorType" (if (symbolp (cdr v))
|
||||
(symbol-name (cdr v))
|
||||
(cdr v))))
|
||||
(if (setq v (assq 'underline p))
|
||||
(ns-set-resource nil "Underline"
|
||||
(case (cdr v)
|
||||
((t) "YES")
|
||||
((nil) "NO")
|
||||
(t (cdr v)))))
|
||||
(if (setq v (assq 'internal-border-width p))
|
||||
(ns-set-resource nil "InternalBorderWidth"
|
||||
(number-to-string (cdr v))))
|
||||
(if (setq v (assq 'vertical-scroll-bars p))
|
||||
(ns-set-resource nil "VerticalScrollBars"
|
||||
(case (cdr v)
|
||||
((t) "YES")
|
||||
((nil) "NO")
|
||||
((left) "left")
|
||||
((right) "right")
|
||||
(t nil))))
|
||||
(if (setq v (assq 'height p))
|
||||
(ns-set-resource nil "Height" (number-to-string (cdr v))))
|
||||
(if (setq v (assq 'width p))
|
||||
(ns-set-resource nil "Width" (number-to-string (cdr v))))
|
||||
(if (setq v (assq 'top p))
|
||||
(ns-set-resource nil "Top" (number-to-string (cdr v))))
|
||||
(if (setq v (assq 'left p))
|
||||
(ns-set-resource nil "Left" (number-to-string (cdr v))))
|
||||
;; These not fully supported
|
||||
(if (setq v (assq 'auto-raise p))
|
||||
(ns-set-resource nil "AutoRaise" (if (cdr v) "YES" "NO")))
|
||||
(if (setq v (assq 'auto-lower p))
|
||||
(ns-set-resource nil "AutoLower" (if (cdr v) "YES" "NO")))
|
||||
(if (setq v (assq 'menu-bar-lines p))
|
||||
(ns-set-resource nil "Menus" (if (cdr v) "YES" "NO")))
|
||||
)
|
||||
(let ((fl (face-list)))
|
||||
(while (consp fl)
|
||||
(or (eq 'default (car fl))
|
||||
;; dont save Default* since it causes all created faces to
|
||||
;; inherit its values. The properties of the default face
|
||||
;; have already been saved from the frame-parameters anyway.
|
||||
(let* ((name (symbol-name (car fl)))
|
||||
(font (face-font (car fl)))
|
||||
;; (fontsize (face-fontsize (car fl)))
|
||||
(foreground (face-foreground (car fl)))
|
||||
(background (face-background (car fl)))
|
||||
(underline (face-underline-p (car fl)))
|
||||
(italic (face-italic-p (car fl)))
|
||||
(bold (face-bold-p (car fl)))
|
||||
(stipple (face-stipple (car fl))))
|
||||
;; (ns-set-resource nil (concat name ".attributeFont")
|
||||
;; (if font font nil))
|
||||
;; (ns-set-resource nil (concat name ".attributeFontSize")
|
||||
;; (if fontsize (number-to-string fontsize) nil))
|
||||
(ns-set-resource nil (concat name ".attributeForeground")
|
||||
(if foreground foreground nil))
|
||||
(ns-set-resource nil (concat name ".attributeBackground")
|
||||
(if background background nil))
|
||||
(ns-set-resource nil (concat name ".attributeUnderline")
|
||||
(if underline "YES" nil))
|
||||
(ns-set-resource nil (concat name ".attributeItalic")
|
||||
(if italic "YES" nil))
|
||||
(ns-set-resource nil (concat name ".attributeBold")
|
||||
(if bold "YES" nil))
|
||||
(and stipple
|
||||
(or (stringp stipple)
|
||||
(setq stipple (prin1-to-string stipple))))
|
||||
(ns-set-resource nil (concat name ".attributeStipple")
|
||||
(if stipple stipple nil))))
|
||||
(setq fl (cdr fl)))))
|
||||
|
||||
(declare-function menu-bar-options-save-orig "ns-win" () t)
|
||||
|
||||
;; call ns-save-preferences when menu-bar-options-save is called
|
||||
(fset 'menu-bar-options-save-orig (symbol-function 'menu-bar-options-save))
|
||||
(defun ns-save-options ()
|
||||
(interactive)
|
||||
(menu-bar-options-save-orig)
|
||||
(ns-save-preferences))
|
||||
(fset 'menu-bar-options-save (symbol-function 'ns-save-options))
|
||||
|
||||
|
||||
;;;; File handling.
|
||||
|
||||
(defun ns-open-file-using-panel ()
|
||||
|
|
@ -1242,11 +1116,6 @@ unless the current buffer is a scratch buffer.")
|
|||
;;;; Dialog-related functions.
|
||||
|
||||
|
||||
(defun ns-show-preferences-help ()
|
||||
"Show NS Preferences panel section in the Emacs manual"
|
||||
(interactive)
|
||||
(info "(emacs)Mac / GNUstep Customization"))
|
||||
|
||||
;; Ask user for confirm before printing. Due to Kevin Rodgers.
|
||||
(defun ns-print-buffer ()
|
||||
"Interactive front-end to `print-buffer': asks for user confirmation first."
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue