annotate lisp/term/ns-win.el @ 97042:0ac199626cb9 before-remove-carbon

fix up ns-extended-platform-support-mode
author Adrian Robert <Adrian.B.Robert@gmail.com>
date Sun, 27 Jul 2008 02:28:50 +0000
parents 72d6895432c7
children 68cf271f3d30
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
96699
05aeed7284d3 Fix header format and permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 96684
diff changeset
1 ;;; ns-win.el --- lisp side of interface with NeXT/Open/GNUstep/MacOS X window system
05aeed7284d3 Fix header format and permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 96684
diff changeset
2
96805
f38d566bd19b Add 2007 to copyright years, since was available then.
Glenn Morris <rgm@gnu.org>
parents: 96799
diff changeset
3 ;; Copyright (C) 1993, 1994, 2005, 2006, 2007, 2008
f38d566bd19b Add 2007 to copyright years, since was available then.
Glenn Morris <rgm@gnu.org>
parents: 96799
diff changeset
4 ;; Free Software Foundation, Inc.
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
5
96799
6cfed26789b7 (ns-submit-bug-report): Function removed. Bug
Chong Yidong <cyd@stupidchicken.com>
parents: 96792
diff changeset
6 ;; Authors: Carl Edman, Christian Limpach, Scott Bender,
6cfed26789b7 (ns-submit-bug-report): Function removed. Bug
Chong Yidong <cyd@stupidchicken.com>
parents: 96792
diff changeset
7 ;; Christophe de Dinechin, Adrian Robert
96699
05aeed7284d3 Fix header format and permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 96684
diff changeset
8 ;; Keywords: terminals
05aeed7284d3 Fix header format and permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 96684
diff changeset
9
05aeed7284d3 Fix header format and permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 96684
diff changeset
10 ;; This file is part of GNU Emacs.
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
11
96699
05aeed7284d3 Fix header format and permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 96684
diff changeset
12 ;; GNU Emacs is free software: you can redistribute it and/or modify
05aeed7284d3 Fix header format and permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 96684
diff changeset
13 ;; it under the terms of the GNU General Public License as published by
05aeed7284d3 Fix header format and permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 96684
diff changeset
14 ;; the Free Software Foundation, either version 3 of the License, or
05aeed7284d3 Fix header format and permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 96684
diff changeset
15 ;; (at your option) any later version.
05aeed7284d3 Fix header format and permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 96684
diff changeset
16
05aeed7284d3 Fix header format and permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 96684
diff changeset
17 ;; GNU Emacs is distributed in the hope that it will be useful,
05aeed7284d3 Fix header format and permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 96684
diff changeset
18 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
05aeed7284d3 Fix header format and permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 96684
diff changeset
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
05aeed7284d3 Fix header format and permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 96684
diff changeset
20 ;; GNU General Public License for more details.
05aeed7284d3 Fix header format and permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 96684
diff changeset
21
05aeed7284d3 Fix header format and permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 96684
diff changeset
22 ;; You should have received a copy of the GNU General Public License
05aeed7284d3 Fix header format and permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 96684
diff changeset
23 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
24
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
25 ;;; Commentary:
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
26
96859
2e1af3a60ab7 Standardize references to "Nextstep" in comments, messages, and docstrings.
Chong Yidong <cyd@stupidchicken.com>
parents: 96814
diff changeset
27 ;; ns-win.el: this file is loaded from ../lisp/startup.el when it
2e1af3a60ab7 Standardize references to "Nextstep" in comments, messages, and docstrings.
Chong Yidong <cyd@stupidchicken.com>
parents: 96814
diff changeset
28 ;; recognizes that Nextstep windows are to be used. Command line
2e1af3a60ab7 Standardize references to "Nextstep" in comments, messages, and docstrings.
Chong Yidong <cyd@stupidchicken.com>
parents: 96814
diff changeset
29 ;; switches are parsed and those pertaining to Nextstep are processed
2e1af3a60ab7 Standardize references to "Nextstep" in comments, messages, and docstrings.
Chong Yidong <cyd@stupidchicken.com>
parents: 96814
diff changeset
30 ;; and removed from the command line. The Nextstep display is opened
2e1af3a60ab7 Standardize references to "Nextstep" in comments, messages, and docstrings.
Chong Yidong <cyd@stupidchicken.com>
parents: 96814
diff changeset
31 ;; and hooks are set for popping up the initial window.
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
32
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
33 ;; startup.el will then examine startup files, and eventually call the hooks
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
34 ;; which create the first window (s).
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
35
96859
2e1af3a60ab7 Standardize references to "Nextstep" in comments, messages, and docstrings.
Chong Yidong <cyd@stupidchicken.com>
parents: 96814
diff changeset
36 ;; A number of other Nextstep convenience functions are defined in
2e1af3a60ab7 Standardize references to "Nextstep" in comments, messages, and docstrings.
Chong Yidong <cyd@stupidchicken.com>
parents: 96814
diff changeset
37 ;; this file, which works in close coordination with src/nsfns.m.
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
38
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
39 ;;; Code:
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
40
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
41
96921
72d6895432c7 * term/ns-win.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96912
diff changeset
42 (if (not (featurep 'ns))
96859
2e1af3a60ab7 Standardize references to "Nextstep" in comments, messages, and docstrings.
Chong Yidong <cyd@stupidchicken.com>
parents: 96814
diff changeset
43 (error "%s: Loading ns-win.el but not compiled for GNUStep/MacOS"
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
44 (invocation-name)))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
45
96748
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
46 (eval-when-compile (require 'cl))
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
47
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
48 ;; Documentation-purposes only: actually loaded in loadup.el
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
49 (require 'frame)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
50 (require 'mouse)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
51 (require 'faces)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
52 (require 'easymenu)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
53 (require 'menu-bar)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
54 (require 'fontset)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
55
96748
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
56 ;; Not needed?
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
57 ;;(require 'ispell)
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
58
96699
05aeed7284d3 Fix header format and permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 96684
diff changeset
59 ;; nsterm.m
05aeed7284d3 Fix header format and permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 96684
diff changeset
60 (defvar ns-version-string)
05aeed7284d3 Fix header format and permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 96684
diff changeset
61 (defvar ns-expand-space)
05aeed7284d3 Fix header format and permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 96684
diff changeset
62 (defvar ns-cursor-blink-rate)
05aeed7284d3 Fix header format and permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 96684
diff changeset
63 (defvar ns-alternate-modifier)
05aeed7284d3 Fix header format and permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 96684
diff changeset
64
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
65 ;;;; Command line argument handling.
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
66
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
67 (defvar ns-invocation-args nil)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
68 (defvar ns-command-line-resources nil)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
69
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
70 ;; Handler for switches of the form "-switch value" or "-switch".
96757
18b856a0216f (ns-handle-switch): Simplify. Handle the numeric case.
Glenn Morris <rgm@gnu.org>
parents: 96748
diff changeset
71 (defun ns-handle-switch (switch &optional numeric)
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
72 (let ((aelt (assoc switch command-line-ns-option-alist)))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
73 (if aelt
96757
18b856a0216f (ns-handle-switch): Simplify. Handle the numeric case.
Glenn Morris <rgm@gnu.org>
parents: 96748
diff changeset
74 (setq default-frame-alist
18b856a0216f (ns-handle-switch): Simplify. Handle the numeric case.
Glenn Morris <rgm@gnu.org>
parents: 96748
diff changeset
75 (cons (cons (nth 3 aelt)
18b856a0216f (ns-handle-switch): Simplify. Handle the numeric case.
Glenn Morris <rgm@gnu.org>
parents: 96748
diff changeset
76 (if numeric
18b856a0216f (ns-handle-switch): Simplify. Handle the numeric case.
Glenn Morris <rgm@gnu.org>
parents: 96748
diff changeset
77 (string-to-number (pop ns-invocation-args))
18b856a0216f (ns-handle-switch): Simplify. Handle the numeric case.
Glenn Morris <rgm@gnu.org>
parents: 96748
diff changeset
78 (or (nth 4 aelt) (pop ns-invocation-args))))
18b856a0216f (ns-handle-switch): Simplify. Handle the numeric case.
Glenn Morris <rgm@gnu.org>
parents: 96748
diff changeset
79 default-frame-alist)))))
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
80
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
81 ;; Handler for switches of the form "-switch n"
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
82 (defun ns-handle-numeric-switch (switch)
96757
18b856a0216f (ns-handle-switch): Simplify. Handle the numeric case.
Glenn Morris <rgm@gnu.org>
parents: 96748
diff changeset
83 (ns-handle-switch switch t))
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
84
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
85 ;; Make -iconic apply only to the initial frame!
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
86 (defun ns-handle-iconic (switch)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
87 (setq initial-frame-alist
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
88 (cons '(visibility . icon) initial-frame-alist)))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
89
96799
6cfed26789b7 (ns-submit-bug-report): Function removed. Bug
Chong Yidong <cyd@stupidchicken.com>
parents: 96792
diff changeset
90 ;; Handle the -name option, set the name of the initial frame.
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
91 (defun ns-handle-name-switch (switch)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
92 (or (consp ns-invocation-args)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
93 (error "%s: missing argument to `%s' option" (invocation-name) switch))
96757
18b856a0216f (ns-handle-switch): Simplify. Handle the numeric case.
Glenn Morris <rgm@gnu.org>
parents: 96748
diff changeset
94 (setq initial-frame-alist (cons (cons 'name (pop ns-invocation-args))
18b856a0216f (ns-handle-switch): Simplify. Handle the numeric case.
Glenn Morris <rgm@gnu.org>
parents: 96748
diff changeset
95 initial-frame-alist)))
18b856a0216f (ns-handle-switch): Simplify. Handle the numeric case.
Glenn Morris <rgm@gnu.org>
parents: 96748
diff changeset
96
18b856a0216f (ns-handle-switch): Simplify. Handle the numeric case.
Glenn Morris <rgm@gnu.org>
parents: 96748
diff changeset
97 ;; Set (but not used?) in frame.el.
96870
30f1368d9cf6 * term/ns-win.el: Rename ns- functions/variables to the
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96859
diff changeset
98 (defvar x-display-name nil
96859
2e1af3a60ab7 Standardize references to "Nextstep" in comments, messages, and docstrings.
Chong Yidong <cyd@stupidchicken.com>
parents: 96814
diff changeset
99 "The name of the Nextstep display on which Emacs was started.")
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
100
96699
05aeed7284d3 Fix header format and permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 96684
diff changeset
101 ;; nsterm.m.
05aeed7284d3 Fix header format and permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 96684
diff changeset
102 (defvar ns-input-file)
05aeed7284d3 Fix header format and permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 96684
diff changeset
103
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
104 (defun ns-handle-nxopen (switch)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
105 (setq unread-command-events (append unread-command-events '(ns-open-file))
96757
18b856a0216f (ns-handle-switch): Simplify. Handle the numeric case.
Glenn Morris <rgm@gnu.org>
parents: 96748
diff changeset
106 ns-input-file (append ns-input-file (list (pop ns-invocation-args)))))
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
107
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
108 (defun ns-handle-nxopentemp (switch)
96757
18b856a0216f (ns-handle-switch): Simplify. Handle the numeric case.
Glenn Morris <rgm@gnu.org>
parents: 96748
diff changeset
109 (setq unread-command-events (append unread-command-events
18b856a0216f (ns-handle-switch): Simplify. Handle the numeric case.
Glenn Morris <rgm@gnu.org>
parents: 96748
diff changeset
110 '(ns-open-temp-file))
18b856a0216f (ns-handle-switch): Simplify. Handle the numeric case.
Glenn Morris <rgm@gnu.org>
parents: 96748
diff changeset
111 ns-input-file (append ns-input-file (list (pop ns-invocation-args)))))
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
112
96799
6cfed26789b7 (ns-submit-bug-report): Function removed. Bug
Chong Yidong <cyd@stupidchicken.com>
parents: 96792
diff changeset
113 (defun ns-ignore-0-arg (switch))
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
114 (defun ns-ignore-1-arg (switch)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
115 (setq ns-invocation-args (cdr ns-invocation-args)))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
116 (defun ns-ignore-2-arg (switch)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
117 (setq ns-invocation-args (cddr ns-invocation-args)))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
118
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
119 (defun ns-handle-args (args)
96859
2e1af3a60ab7 Standardize references to "Nextstep" in comments, messages, and docstrings.
Chong Yidong <cyd@stupidchicken.com>
parents: 96814
diff changeset
120 "Process Nextstep-related command line options.
96799
6cfed26789b7 (ns-submit-bug-report): Function removed. Bug
Chong Yidong <cyd@stupidchicken.com>
parents: 96792
diff changeset
121 This is run before the user's startup file is loaded.
96859
2e1af3a60ab7 Standardize references to "Nextstep" in comments, messages, and docstrings.
Chong Yidong <cyd@stupidchicken.com>
parents: 96814
diff changeset
122 The options in ARGS are copied to `ns-invocation-args'.
2e1af3a60ab7 Standardize references to "Nextstep" in comments, messages, and docstrings.
Chong Yidong <cyd@stupidchicken.com>
parents: 96814
diff changeset
123 The Nextstep-related settings are then applied using the handlers
96799
6cfed26789b7 (ns-submit-bug-report): Function removed. Bug
Chong Yidong <cyd@stupidchicken.com>
parents: 96792
diff changeset
124 defined in `command-line-ns-option-alist'.
96859
2e1af3a60ab7 Standardize references to "Nextstep" in comments, messages, and docstrings.
Chong Yidong <cyd@stupidchicken.com>
parents: 96814
diff changeset
125 The return value is ARGS minus the number of arguments processed."
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
126 ;; We use ARGS to accumulate the args that we don't handle here, to return.
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
127 (setq ns-invocation-args args
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
128 args nil)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
129 (while ns-invocation-args
96757
18b856a0216f (ns-handle-switch): Simplify. Handle the numeric case.
Glenn Morris <rgm@gnu.org>
parents: 96748
diff changeset
130 (let* ((this-switch (pop ns-invocation-args))
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
131 (orig-this-switch this-switch)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
132 completion argval aelt handler)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
133 ;; Check for long options with attached arguments
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
134 ;; and separate out the attached option argument into argval.
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
135 (if (string-match "^--[^=]*=" this-switch)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
136 (setq argval (substring this-switch (match-end 0))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
137 this-switch (substring this-switch 0 (1- (match-end 0)))))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
138 ;; Complete names of long options.
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
139 (if (string-match "^--" this-switch)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
140 (progn
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
141 (setq completion (try-completion this-switch
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
142 command-line-ns-option-alist))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
143 (if (eq completion t)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
144 ;; Exact match for long option.
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
145 nil
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
146 (if (stringp completion)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
147 (let ((elt (assoc completion command-line-ns-option-alist)))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
148 ;; Check for abbreviated long option.
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
149 (or elt
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
150 (error "Option `%s' is ambiguous" this-switch))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
151 (setq this-switch completion))))))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
152 (setq aelt (assoc this-switch command-line-ns-option-alist))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
153 (if aelt (setq handler (nth 2 aelt)))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
154 (if handler
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
155 (if argval
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
156 (let ((ns-invocation-args
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
157 (cons argval ns-invocation-args)))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
158 (funcall handler this-switch))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
159 (funcall handler this-switch))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
160 (setq args (cons orig-this-switch args)))))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
161 (nreverse args))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
162
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
163 (defun x-parse-geometry (geom)
96859
2e1af3a60ab7 Standardize references to "Nextstep" in comments, messages, and docstrings.
Chong Yidong <cyd@stupidchicken.com>
parents: 96814
diff changeset
164 "Parse a Nextstep-style geometry string STRING.
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
165 Returns an alist of the form ((top . TOP), (left . LEFT) ... ).
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
166 The properties returned may include `top', `left', `height', and `width'."
96859
2e1af3a60ab7 Standardize references to "Nextstep" in comments, messages, and docstrings.
Chong Yidong <cyd@stupidchicken.com>
parents: 96814
diff changeset
167 (when (string-match "\\([0-9]+\\)\\( \\([0-9]+\\)\\( \\([0-9]+\\)\
2e1af3a60ab7 Standardize references to "Nextstep" in comments, messages, and docstrings.
Chong Yidong <cyd@stupidchicken.com>
parents: 96814
diff changeset
168 \\( \\([0-9]+\\) ?\\)?\\)?\\)?"
2e1af3a60ab7 Standardize references to "Nextstep" in comments, messages, and docstrings.
Chong Yidong <cyd@stupidchicken.com>
parents: 96814
diff changeset
169 geom)
2e1af3a60ab7 Standardize references to "Nextstep" in comments, messages, and docstrings.
Chong Yidong <cyd@stupidchicken.com>
parents: 96814
diff changeset
170 (apply
2e1af3a60ab7 Standardize references to "Nextstep" in comments, messages, and docstrings.
Chong Yidong <cyd@stupidchicken.com>
parents: 96814
diff changeset
171 'append
2e1af3a60ab7 Standardize references to "Nextstep" in comments, messages, and docstrings.
Chong Yidong <cyd@stupidchicken.com>
parents: 96814
diff changeset
172 (list
2e1af3a60ab7 Standardize references to "Nextstep" in comments, messages, and docstrings.
Chong Yidong <cyd@stupidchicken.com>
parents: 96814
diff changeset
173 (list (cons 'top (string-to-number (match-string 1 geom))))
2e1af3a60ab7 Standardize references to "Nextstep" in comments, messages, and docstrings.
Chong Yidong <cyd@stupidchicken.com>
parents: 96814
diff changeset
174 (if (match-string 3 geom)
2e1af3a60ab7 Standardize references to "Nextstep" in comments, messages, and docstrings.
Chong Yidong <cyd@stupidchicken.com>
parents: 96814
diff changeset
175 (list (cons 'left (string-to-number (match-string 3 geom)))))
2e1af3a60ab7 Standardize references to "Nextstep" in comments, messages, and docstrings.
Chong Yidong <cyd@stupidchicken.com>
parents: 96814
diff changeset
176 (if (match-string 5 geom)
2e1af3a60ab7 Standardize references to "Nextstep" in comments, messages, and docstrings.
Chong Yidong <cyd@stupidchicken.com>
parents: 96814
diff changeset
177 (list (cons 'height (string-to-number (match-string 5 geom)))))
2e1af3a60ab7 Standardize references to "Nextstep" in comments, messages, and docstrings.
Chong Yidong <cyd@stupidchicken.com>
parents: 96814
diff changeset
178 (if (match-string 7 geom)
2e1af3a60ab7 Standardize references to "Nextstep" in comments, messages, and docstrings.
Chong Yidong <cyd@stupidchicken.com>
parents: 96814
diff changeset
179 (list (cons 'width (string-to-number (match-string 7 geom)))))))))
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
180
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
181 ;;;; Keyboard mapping.
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
182
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
183 ;; These tell read-char how to convert
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
184 ;; these special chars to ASCII.
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
185 (put 'backspace 'ascii-character 127)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
186 (put 'delete 'ascii-character 127)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
187 (put 'tab 'ascii-character ?\t)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
188 (put 'S-tab 'ascii-character (logior 16 ?\t))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
189 (put 'linefeed 'ascii-character ?\n)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
190 (put 'clear 'ascii-character 12)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
191 (put 'return 'ascii-character 13)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
192 (put 'escape 'ascii-character ?\e)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
193
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
194 ;; Map certain keypad keys into ASCII characters
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
195 ;; that people usually expect.
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
196 (define-key function-key-map [backspace] [127])
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
197 (define-key function-key-map [delete] [127])
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
198 (define-key function-key-map [tab] [?\t])
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
199 (define-key function-key-map [S-tab] [25])
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
200 (define-key function-key-map [linefeed] [?\n])
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
201 (define-key function-key-map [clear] [11])
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
202 (define-key function-key-map [return] [13])
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
203 (define-key function-key-map [escape] [?\e])
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
204 (define-key function-key-map [M-backspace] [?\M-\d])
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
205 (define-key function-key-map [M-delete] [?\M-\d])
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
206 (define-key function-key-map [M-tab] [?\M-\t])
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
207 (define-key function-key-map [M-linefeed] [?\M-\n])
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
208 (define-key function-key-map [M-clear] [?\M-\013])
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
209 (define-key function-key-map [M-return] [?\M-\015])
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
210 (define-key function-key-map [M-escape] [?\M-\e])
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
211
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
212
96859
2e1af3a60ab7 Standardize references to "Nextstep" in comments, messages, and docstrings.
Chong Yidong <cyd@stupidchicken.com>
parents: 96814
diff changeset
213 ;; Here are some Nextstep-like bindings for command key sequences.
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
214 (define-key global-map [?\s-,] 'ns-popup-prefs-panel)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
215 (define-key global-map [?\s-'] 'next-multiframe-window)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
216 (define-key global-map [?\s-`] 'other-frame)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
217 (define-key global-map [?\s--] 'center-line)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
218 (define-key global-map [?\s-:] 'ispell)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
219 (define-key global-map [?\s-\;] 'ispell-next)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
220 (define-key global-map [?\s-?] 'info)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
221 (define-key global-map [?\s-^] 'kill-some-buffers)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
222 (define-key global-map [?\s-&] 'kill-this-buffer)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
223 (define-key global-map [?\s-C] 'ns-popup-color-panel)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
224 (define-key global-map [?\s-D] 'dired)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
225 (define-key global-map [?\s-E] 'edit-abbrevs)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
226 (define-key global-map [?\s-L] 'shell-command)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
227 (define-key global-map [?\s-M] 'manual-entry)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
228 (define-key global-map [?\s-S] 'ns-write-file-using-panel)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
229 (define-key global-map [?\s-a] 'mark-whole-buffer)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
230 (define-key global-map [?\s-c] 'ns-copy-including-secondary)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
231 (define-key global-map [?\s-d] 'isearch-repeat-backward)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
232 (define-key global-map [?\s-e] 'isearch-yank-kill)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
233 (define-key global-map [?\s-f] 'isearch-forward)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
234 (define-key global-map [?\s-g] 'isearch-repeat-forward)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
235 (define-key global-map [?\s-h] 'ns-do-hide-emacs)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
236 (define-key global-map [?\s-H] 'ns-do-hide-others)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
237 (define-key global-map [?\s-j] 'exchange-point-and-mark)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
238 (define-key global-map [?\s-k] 'kill-this-buffer)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
239 (define-key global-map [?\s-l] 'goto-line)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
240 (define-key global-map [?\s-m] 'iconify-frame)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
241 (define-key global-map [?\s-n] 'make-frame)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
242 (define-key global-map [?\s-o] 'ns-open-file-using-panel)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
243 (define-key global-map [?\s-p] 'ns-print-buffer)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
244 (define-key global-map [?\s-q] 'save-buffers-kill-emacs)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
245 (define-key global-map [?\s-s] 'save-buffer)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
246 (define-key global-map [?\s-t] 'ns-popup-font-panel)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
247 (define-key global-map [?\s-u] 'revert-buffer)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
248 (define-key global-map [?\s-v] 'yank)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
249 (define-key global-map [?\s-w] 'delete-frame)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
250 (define-key global-map [?\s-x] 'kill-region)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
251 (define-key global-map [?\s-y] 'ns-paste-secondary)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
252 (define-key global-map [?\s-z] 'undo)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
253 (define-key global-map [?\s-|] 'shell-command-on-region)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
254 (define-key global-map [s-kp-bar] 'shell-command-on-region)
96748
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
255 ;; (as in Terminal.app)
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
256 (define-key global-map [s-right] 'ns-next-frame)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
257 (define-key global-map [s-left] 'ns-prev-frame)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
258
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
259 (define-key global-map [home] 'beginning-of-buffer)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
260 (define-key global-map [end] 'end-of-buffer)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
261 (define-key global-map [kp-home] 'beginning-of-buffer)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
262 (define-key global-map [kp-end] 'end-of-buffer)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
263 (define-key global-map [kp-prior] 'scroll-down)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
264 (define-key global-map [kp-next] 'scroll-up)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
265
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
266
96859
2e1af3a60ab7 Standardize references to "Nextstep" in comments, messages, and docstrings.
Chong Yidong <cyd@stupidchicken.com>
parents: 96814
diff changeset
267 ;; Special Nextstep-generated events are converted to function keys. Here
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
268 ;; are the bindings for them.
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
269 (define-key global-map [ns-power-off]
96748
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
270 (lambda () (interactive) (save-buffers-kill-emacs t)))
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
271 (define-key global-map [ns-open-file] 'ns-find-file)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
272 (define-key global-map [ns-open-temp-file] [ns-open-file])
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
273 (define-key global-map [ns-drag-file] 'ns-insert-file)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
274 (define-key global-map [ns-drag-color] 'ns-set-foreground-at-mouse)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
275 (define-key global-map [S-ns-drag-color] 'ns-set-background-at-mouse)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
276 (define-key global-map [ns-drag-text] 'ns-insert-text)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
277 (define-key global-map [ns-change-font] 'ns-respond-to-change-font)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
278 (define-key global-map [ns-open-file-line] 'ns-open-file-select-line)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
279 (define-key global-map [ns-insert-working-text] 'ns-insert-working-text)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
280 (define-key global-map [ns-delete-working-text] 'ns-delete-working-text)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
281 (define-key global-map [ns-spi-service-call] 'ns-spi-service-call)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
282
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
283
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
284
96792
50bfb208e018 Contents of ns-grabenv.el moved here.
Chong Yidong <cyd@stupidchicken.com>
parents: 96788
diff changeset
285 ;; Functions to set environment variables by running a subshell.
96859
2e1af3a60ab7 Standardize references to "Nextstep" in comments, messages, and docstrings.
Chong Yidong <cyd@stupidchicken.com>
parents: 96814
diff changeset
286 ;;; Idea based on Nextstep 4.2 distribution, this version of code
2e1af3a60ab7 Standardize references to "Nextstep" in comments, messages, and docstrings.
Chong Yidong <cyd@stupidchicken.com>
parents: 96814
diff changeset
287 ;;; based on mac-read-environment-vars-from-shell () by David Reitter.
96792
50bfb208e018 Contents of ns-grabenv.el moved here.
Chong Yidong <cyd@stupidchicken.com>
parents: 96788
diff changeset
288 ;;; Mostly used only under ns-extended-platform-support-mode.
50bfb208e018 Contents of ns-grabenv.el moved here.
Chong Yidong <cyd@stupidchicken.com>
parents: 96788
diff changeset
289
50bfb208e018 Contents of ns-grabenv.el moved here.
Chong Yidong <cyd@stupidchicken.com>
parents: 96788
diff changeset
290 (defun ns-make-command-string (cmdlist)
96805
f38d566bd19b Add 2007 to copyright years, since was available then.
Glenn Morris <rgm@gnu.org>
parents: 96799
diff changeset
291 (mapconcat 'identity cmdlist " ; "))
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
292
96792
50bfb208e018 Contents of ns-grabenv.el moved here.
Chong Yidong <cyd@stupidchicken.com>
parents: 96788
diff changeset
293 ;;;###autoload
50bfb208e018 Contents of ns-grabenv.el moved here.
Chong Yidong <cyd@stupidchicken.com>
parents: 96788
diff changeset
294 (defun ns-grabenv (&optional shell-path startup)
50bfb208e018 Contents of ns-grabenv.el moved here.
Chong Yidong <cyd@stupidchicken.com>
parents: 96788
diff changeset
295 "Set the Emacs environment using the output of a shell command.
50bfb208e018 Contents of ns-grabenv.el moved here.
Chong Yidong <cyd@stupidchicken.com>
parents: 96788
diff changeset
296 This runs a shell subprocess, and interpret its output as a
50bfb208e018 Contents of ns-grabenv.el moved here.
Chong Yidong <cyd@stupidchicken.com>
parents: 96788
diff changeset
297 series of environment variables to insert into the emacs
50bfb208e018 Contents of ns-grabenv.el moved here.
Chong Yidong <cyd@stupidchicken.com>
parents: 96788
diff changeset
298 environment.
50bfb208e018 Contents of ns-grabenv.el moved here.
Chong Yidong <cyd@stupidchicken.com>
parents: 96788
diff changeset
299 SHELL-PATH gives the path to the shell; if nil, this defaults to
50bfb208e018 Contents of ns-grabenv.el moved here.
Chong Yidong <cyd@stupidchicken.com>
parents: 96788
diff changeset
300 the current setting of `shell-file-name'.
50bfb208e018 Contents of ns-grabenv.el moved here.
Chong Yidong <cyd@stupidchicken.com>
parents: 96788
diff changeset
301 STARTUP is a list of commands for the shell to execute; if nil,
50bfb208e018 Contents of ns-grabenv.el moved here.
Chong Yidong <cyd@stupidchicken.com>
parents: 96788
diff changeset
302 this defaults to \"printenv\"."
50bfb208e018 Contents of ns-grabenv.el moved here.
Chong Yidong <cyd@stupidchicken.com>
parents: 96788
diff changeset
303 (interactive)
50bfb208e018 Contents of ns-grabenv.el moved here.
Chong Yidong <cyd@stupidchicken.com>
parents: 96788
diff changeset
304 (with-temp-buffer
50bfb208e018 Contents of ns-grabenv.el moved here.
Chong Yidong <cyd@stupidchicken.com>
parents: 96788
diff changeset
305 (let ((shell-file-name (if shell-path shell-path shell-file-name))
50bfb208e018 Contents of ns-grabenv.el moved here.
Chong Yidong <cyd@stupidchicken.com>
parents: 96788
diff changeset
306 (cmd (ns-make-command-string (if startup startup '("printenv")))))
50bfb208e018 Contents of ns-grabenv.el moved here.
Chong Yidong <cyd@stupidchicken.com>
parents: 96788
diff changeset
307 (shell-command cmd t)
50bfb208e018 Contents of ns-grabenv.el moved here.
Chong Yidong <cyd@stupidchicken.com>
parents: 96788
diff changeset
308 (while (search-forward-regexp "^\\([A-Za-z_0-9]+\\)=\\(.*\\)$" nil t)
50bfb208e018 Contents of ns-grabenv.el moved here.
Chong Yidong <cyd@stupidchicken.com>
parents: 96788
diff changeset
309 (setenv (match-string 1)
50bfb208e018 Contents of ns-grabenv.el moved here.
Chong Yidong <cyd@stupidchicken.com>
parents: 96788
diff changeset
310 (if (equal (match-string 1) "PATH")
50bfb208e018 Contents of ns-grabenv.el moved here.
Chong Yidong <cyd@stupidchicken.com>
parents: 96788
diff changeset
311 (concat (getenv "PATH") ":" (match-string 2))
50bfb208e018 Contents of ns-grabenv.el moved here.
Chong Yidong <cyd@stupidchicken.com>
parents: 96788
diff changeset
312 (match-string 2)))))))
96788
c4b6acf322cc Contents of ns-carbon-compat.el moved here.
Chong Yidong <cyd@stupidchicken.com>
parents: 96767
diff changeset
313
c4b6acf322cc Contents of ns-carbon-compat.el moved here.
Chong Yidong <cyd@stupidchicken.com>
parents: 96767
diff changeset
314 ;; Set up a number of aliases and other layers to pretend we're using
c4b6acf322cc Contents of ns-carbon-compat.el moved here.
Chong Yidong <cyd@stupidchicken.com>
parents: 96767
diff changeset
315 ;; the Choi/Mitsuharu Carbon port.
c4b6acf322cc Contents of ns-carbon-compat.el moved here.
Chong Yidong <cyd@stupidchicken.com>
parents: 96767
diff changeset
316
c4b6acf322cc Contents of ns-carbon-compat.el moved here.
Chong Yidong <cyd@stupidchicken.com>
parents: 96767
diff changeset
317 (defvaralias 'mac-allow-anti-aliasing 'ns-antialias-text)
c4b6acf322cc Contents of ns-carbon-compat.el moved here.
Chong Yidong <cyd@stupidchicken.com>
parents: 96767
diff changeset
318 (defvaralias 'mac-command-modifier 'ns-command-modifier)
c4b6acf322cc Contents of ns-carbon-compat.el moved here.
Chong Yidong <cyd@stupidchicken.com>
parents: 96767
diff changeset
319 (defvaralias 'mac-control-modifier 'ns-control-modifier)
c4b6acf322cc Contents of ns-carbon-compat.el moved here.
Chong Yidong <cyd@stupidchicken.com>
parents: 96767
diff changeset
320 (defvaralias 'mac-option-modifier 'ns-option-modifier)
c4b6acf322cc Contents of ns-carbon-compat.el moved here.
Chong Yidong <cyd@stupidchicken.com>
parents: 96767
diff changeset
321 (defvaralias 'mac-function-modifier 'ns-function-modifier)
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
322
96699
05aeed7284d3 Fix header format and permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 96684
diff changeset
323 (defvar menu-bar-ns-file-menu) ; below
05aeed7284d3 Fix header format and permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 96684
diff changeset
324
96859
2e1af3a60ab7 Standardize references to "Nextstep" in comments, messages, and docstrings.
Chong Yidong <cyd@stupidchicken.com>
parents: 96814
diff changeset
325 ;; Toggle some additional Nextstep-like features that may interfere
2e1af3a60ab7 Standardize references to "Nextstep" in comments, messages, and docstrings.
Chong Yidong <cyd@stupidchicken.com>
parents: 96814
diff changeset
326 ;; with users' expectations coming from emacs on other platforms.
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
327 (define-minor-mode ns-extended-platform-support-mode
96859
2e1af3a60ab7 Standardize references to "Nextstep" in comments, messages, and docstrings.
Chong Yidong <cyd@stupidchicken.com>
parents: 96814
diff changeset
328 "Toggle Nextstep extended platform support features.
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
329 When this mode is active (no modeline indicator):
96707
e2bc3521cdab remove easy-mmode from loadup.el before ns-win; correct docs in ns-win
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 96699
diff changeset
330 - File menu is altered slightly in keeping with conventions.
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
331 - Meta-up, meta-down are bound to scroll window up and down one line.
96707
e2bc3521cdab remove easy-mmode from loadup.el before ns-win; correct docs in ns-win
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 96699
diff changeset
332 - Screen position is preserved in scrolling.
e2bc3521cdab remove easy-mmode from loadup.el before ns-win; correct docs in ns-win
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 96699
diff changeset
333 - Transient mark mode is activated"
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
334 :init-value nil
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
335 :global t
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
336 :group 'ns
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
337 (if ns-extended-platform-support-mode
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
338 (progn
97042
0ac199626cb9 fix up ns-extended-platform-support-mode
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 96921
diff changeset
339 (defun ns-show-manual () "Show Emacs.app manual" (interactive) (info "ns-emacs"))
0ac199626cb9 fix up ns-extended-platform-support-mode
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 96921
diff changeset
340 (setq where-is-preferred-modifier 'super)
96748
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
341 (setq scroll-preserve-screen-position t)
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
342 (transient-mark-mode 1)
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
343
96859
2e1af3a60ab7 Standardize references to "Nextstep" in comments, messages, and docstrings.
Chong Yidong <cyd@stupidchicken.com>
parents: 96814
diff changeset
344 ;; Change file menu to simplify and add a couple of
2e1af3a60ab7 Standardize references to "Nextstep" in comments, messages, and docstrings.
Chong Yidong <cyd@stupidchicken.com>
parents: 96814
diff changeset
345 ;; Nextstep-specific items
96748
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
346 (easy-menu-remove-item global-map '("menu-bar") 'file)
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
347 (easy-menu-add-item global-map '(menu-bar)
97042
0ac199626cb9 fix up ns-extended-platform-support-mode
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 96921
diff changeset
348 (cons "File" menu-bar-ns-file-menu) 'edit)
0ac199626cb9 fix up ns-extended-platform-support-mode
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 96921
diff changeset
349 (define-key menu-bar-help-menu [ns-manual]
0ac199626cb9 fix up ns-extended-platform-support-mode
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 96921
diff changeset
350 '(menu-item "Emacs.app Manual" ns-show-manual)))
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
351 (progn
96748
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
352 ;; Undo everything above.
97042
0ac199626cb9 fix up ns-extended-platform-support-mode
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 96921
diff changeset
353 (fmakunbound 'ns-show-manual)
0ac199626cb9 fix up ns-extended-platform-support-mode
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 96921
diff changeset
354 (setq where-is-preferred-modifier 'nil)
96748
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
355 (setq scroll-preserve-screen-position nil)
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
356 (transient-mark-mode 0)
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
357 (easy-menu-remove-item global-map '("menu-bar") 'file)
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
358 (easy-menu-add-item global-map '(menu-bar)
97042
0ac199626cb9 fix up ns-extended-platform-support-mode
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 96921
diff changeset
359 (cons "File" menu-bar-file-menu) 'edit)
0ac199626cb9 fix up ns-extended-platform-support-mode
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 96921
diff changeset
360 (easy-menu-remove-item global-map '("menu-bar" "help-menu") 'ns-manual)
0ac199626cb9 fix up ns-extended-platform-support-mode
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 96921
diff changeset
361 )))
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
362
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
363
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
364 (defun x-setup-function-keys (frame)
96859
2e1af3a60ab7 Standardize references to "Nextstep" in comments, messages, and docstrings.
Chong Yidong <cyd@stupidchicken.com>
parents: 96814
diff changeset
365 "Set up function Keys for Nextstep for frame FRAME."
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
366 (unless (terminal-parameter frame 'x-setup-function-keys)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
367 (with-selected-frame frame
96870
30f1368d9cf6 * term/ns-win.el: Rename ns- functions/variables to the
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96859
diff changeset
368 (setq interprogram-cut-function 'x-select-text
30f1368d9cf6 * term/ns-win.el: Rename ns- functions/variables to the
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96859
diff changeset
369 interprogram-paste-function 'x-cut-buffer-or-selection-value)
96748
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
370 ;; (let ((map (copy-keymap x-alternatives-map)))
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
371 ;; (set-keymap-parent map (keymap-parent local-function-key-map))
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
372 ;; (set-keymap-parent local-function-key-map map))
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
373 (setq system-key-alist
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
374 (list
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
375 (cons (logior (lsh 0 16) 1) 'ns-power-off)
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
376 (cons (logior (lsh 0 16) 2) 'ns-open-file)
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
377 (cons (logior (lsh 0 16) 3) 'ns-open-temp-file)
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
378 (cons (logior (lsh 0 16) 4) 'ns-drag-file)
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
379 (cons (logior (lsh 0 16) 5) 'ns-drag-color)
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
380 (cons (logior (lsh 0 16) 6) 'ns-drag-text)
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
381 (cons (logior (lsh 0 16) 7) 'ns-change-font)
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
382 (cons (logior (lsh 0 16) 8) 'ns-open-file-line)
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
383 (cons (logior (lsh 0 16) 9) 'ns-insert-working-text)
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
384 (cons (logior (lsh 0 16) 10) 'ns-delete-working-text)
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
385 (cons (logior (lsh 0 16) 11) 'ns-spi-service-call)
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
386 (cons (logior (lsh 1 16) 32) 'f1)
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
387 (cons (logior (lsh 1 16) 33) 'f2)
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
388 (cons (logior (lsh 1 16) 34) 'f3)
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
389 (cons (logior (lsh 1 16) 35) 'f4)
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
390 (cons (logior (lsh 1 16) 36) 'f5)
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
391 (cons (logior (lsh 1 16) 37) 'f6)
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
392 (cons (logior (lsh 1 16) 38) 'f7)
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
393 (cons (logior (lsh 1 16) 39) 'f8)
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
394 (cons (logior (lsh 1 16) 40) 'f9)
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
395 (cons (logior (lsh 1 16) 41) 'f10)
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
396 (cons (logior (lsh 1 16) 42) 'f11)
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
397 (cons (logior (lsh 1 16) 43) 'f12)
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
398 (cons (logior (lsh 1 16) 44) 'kp-insert)
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
399 (cons (logior (lsh 1 16) 45) 'kp-delete)
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
400 (cons (logior (lsh 1 16) 46) 'kp-home)
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
401 (cons (logior (lsh 1 16) 47) 'kp-end)
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
402 (cons (logior (lsh 1 16) 48) 'kp-prior)
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
403 (cons (logior (lsh 1 16) 49) 'kp-next)
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
404 (cons (logior (lsh 1 16) 50) 'print-screen)
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
405 (cons (logior (lsh 1 16) 51) 'scroll-lock)
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
406 (cons (logior (lsh 1 16) 52) 'pause)
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
407 (cons (logior (lsh 1 16) 53) 'system)
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
408 (cons (logior (lsh 1 16) 54) 'break)
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
409 (cons (logior (lsh 1 16) 56) 'please-tell-carl-what-this-key-is-called-56)
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
410 (cons (logior (lsh 1 16) 61) 'please-tell-carl-what-this-key-is-called-61)
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
411 (cons (logior (lsh 1 16) 62) 'please-tell-carl-what-this-key-is-called-62)
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
412 (cons (logior (lsh 1 16) 63) 'please-tell-carl-what-this-key-is-called-63)
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
413 (cons (logior (lsh 1 16) 64) 'please-tell-carl-what-this-key-is-called-64)
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
414 (cons (logior (lsh 1 16) 69) 'please-tell-carl-what-this-key-is-called-69)
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
415 (cons (logior (lsh 1 16) 70) 'please-tell-carl-what-this-key-is-called-70)
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
416 (cons (logior (lsh 1 16) 71) 'please-tell-carl-what-this-key-is-called-71)
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
417 (cons (logior (lsh 1 16) 72) 'please-tell-carl-what-this-key-is-called-72)
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
418 (cons (logior (lsh 1 16) 73) 'please-tell-carl-what-this-key-is-called-73)
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
419 (cons (logior (lsh 2 16) 3) 'kp-enter)
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
420 (cons (logior (lsh 2 16) 9) 'kp-tab)
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
421 (cons (logior (lsh 2 16) 28) 'kp-quit)
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
422 (cons (logior (lsh 2 16) 35) 'kp-hash)
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
423 (cons (logior (lsh 2 16) 42) 'kp-multiply)
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
424 (cons (logior (lsh 2 16) 43) 'kp-add)
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
425 (cons (logior (lsh 2 16) 44) 'kp-separator)
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
426 (cons (logior (lsh 2 16) 45) 'kp-subtract)
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
427 (cons (logior (lsh 2 16) 46) 'kp-decimal)
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
428 (cons (logior (lsh 2 16) 47) 'kp-divide)
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
429 (cons (logior (lsh 2 16) 48) 'kp-0)
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
430 (cons (logior (lsh 2 16) 49) 'kp-1)
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
431 (cons (logior (lsh 2 16) 50) 'kp-2)
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
432 (cons (logior (lsh 2 16) 51) 'kp-3)
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
433 (cons (logior (lsh 2 16) 52) 'kp-4)
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
434 (cons (logior (lsh 2 16) 53) 'kp-5)
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
435 (cons (logior (lsh 2 16) 54) 'kp-6)
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
436 (cons (logior (lsh 2 16) 55) 'kp-7)
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
437 (cons (logior (lsh 2 16) 56) 'kp-8)
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
438 (cons (logior (lsh 2 16) 57) 'kp-9)
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
439 (cons (logior (lsh 2 16) 60) 'kp-less)
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
440 (cons (logior (lsh 2 16) 61) 'kp-equal)
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
441 (cons (logior (lsh 2 16) 62) 'kp-more)
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
442 (cons (logior (lsh 2 16) 64) 'kp-at)
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
443 (cons (logior (lsh 2 16) 92) 'kp-backslash)
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
444 (cons (logior (lsh 2 16) 96) 'kp-backtick)
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
445 (cons (logior (lsh 2 16) 124) 'kp-bar)
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
446 (cons (logior (lsh 2 16) 126) 'kp-tilde)
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
447 (cons (logior (lsh 2 16) 157) 'kp-mu)
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
448 (cons (logior (lsh 2 16) 165) 'kp-yen)
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
449 (cons (logior (lsh 2 16) 167) 'kp-paragraph)
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
450 (cons (logior (lsh 2 16) 172) 'left)
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
451 (cons (logior (lsh 2 16) 173) 'up)
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
452 (cons (logior (lsh 2 16) 174) 'right)
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
453 (cons (logior (lsh 2 16) 175) 'down)
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
454 (cons (logior (lsh 2 16) 176) 'kp-ring)
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
455 (cons (logior (lsh 2 16) 201) 'kp-square)
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
456 (cons (logior (lsh 2 16) 204) 'kp-cube)
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
457 (cons (logior (lsh 3 16) 8) 'backspace)
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
458 (cons (logior (lsh 3 16) 9) 'tab)
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
459 (cons (logior (lsh 3 16) 10) 'linefeed)
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
460 (cons (logior (lsh 3 16) 11) 'clear)
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
461 (cons (logior (lsh 3 16) 13) 'return)
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
462 (cons (logior (lsh 3 16) 18) 'pause)
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
463 (cons (logior (lsh 3 16) 25) 'S-tab)
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
464 (cons (logior (lsh 3 16) 27) 'escape)
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
465 (cons (logior (lsh 3 16) 127) 'delete)
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
466 ))
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
467 (set-terminal-parameter frame 'x-setup-function-keys t))))
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
468
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
469
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
470
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
471 ;;;; Miscellaneous mouse bindings.
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
472
96859
2e1af3a60ab7 Standardize references to "Nextstep" in comments, messages, and docstrings.
Chong Yidong <cyd@stupidchicken.com>
parents: 96814
diff changeset
473 ;;; Allow shift-clicks to work just like under Nextstep
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
474 (defun mouse-extend-region (event)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
475 "Move point or mark so as to extend region.
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
476 This should be bound to a mouse click event type."
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
477 (interactive "e")
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
478 (mouse-minibuffer-check event)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
479 (let ((posn (event-end event)))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
480 (if (not (windowp (posn-window posn)))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
481 (error "Cursor not in text area of window"))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
482 (select-window (posn-window posn))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
483 (cond
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
484 ((not (numberp (posn-point posn))))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
485 ((or (not mark-active) (> (abs (- (posn-point posn) (point)))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
486 (abs (- (posn-point posn) (mark)))))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
487 (let ((point-save (point)))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
488 (unwind-protect
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
489 (progn
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
490 (goto-char (posn-point posn))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
491 (push-mark nil t t)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
492 (or transient-mark-mode
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
493 (sit-for 1)))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
494 (goto-char point-save))))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
495 (t
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
496 (goto-char (posn-point posn))))))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
497
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
498 (define-key global-map [S-mouse-1] 'mouse-extend-region)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
499 (global-unset-key [S-down-mouse-1])
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
500
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
501
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
502
96748
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
503 ;; Must come after keybindings.
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
504
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
505 (fmakunbound 'clipboard-yank)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
506 (fmakunbound 'clipboard-kill-ring-save)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
507 (fmakunbound 'clipboard-kill-region)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
508 (fmakunbound 'menu-bar-enable-clipboard)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
509
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
510 ;; Add a couple of menus and rearrange some others; easiest just to redo toplvl
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
511 ;; Note keymap defns must be given last-to-first
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
512 (define-key global-map [menu-bar] (make-sparse-keymap "menu-bar"))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
513
96748
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
514 (setq menu-bar-final-items
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
515 (cond ((eq system-type 'darwin)
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
516 '(buffer windows services help-menu))
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
517 ;; Otherwise, GNUstep.
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
518 (t
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
519 '(buffer windows services hide-app quit))))
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
520
96748
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
521 ;; Add standard top-level items to GNUstep menu.
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
522 (unless (eq system-type 'darwin)
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
523 (define-key global-map [menu-bar quit] '("Quit" . save-buffers-kill-emacs))
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
524 (define-key global-map [menu-bar hide-app] '("Hide" . ns-do-hide-emacs)))
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
525
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
526 (define-key global-map [menu-bar services]
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
527 (cons "Services" (make-sparse-keymap "Services")))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
528 (define-key global-map [menu-bar windows] (make-sparse-keymap "Windows"))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
529 (define-key global-map [menu-bar buffer]
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
530 (cons "Buffers" global-buffers-menu-map))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
531 ;; (cons "Buffers" (make-sparse-keymap "Buffers")))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
532 (define-key global-map [menu-bar tools] (cons "Tools" menu-bar-tools-menu))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
533 (define-key global-map [menu-bar options] (cons "Options" menu-bar-options-menu))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
534 (define-key global-map [menu-bar edit] (cons "Edit" menu-bar-edit-menu))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
535 (define-key global-map [menu-bar file] (cons "File" menu-bar-file-menu))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
536
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
537 ;; If running under GNUstep, rename "Help" to "Info"
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
538 (cond ((eq system-type 'darwin)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
539 (define-key global-map [menu-bar help-menu]
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
540 (cons "Help" menu-bar-help-menu)))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
541 (t
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
542 (let ((contents (reverse (cdr menu-bar-help-menu))))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
543 (setq menu-bar-help-menu
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
544 (append (list 'keymap) (cdr contents) (list "Info"))))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
545 (define-key global-map [menu-bar help-menu]
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
546 (cons "Info" menu-bar-help-menu))))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
547
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
548 (if (not (eq system-type 'darwin))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
549 ;; in OS X it's in the app menu already
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
550 (define-key menu-bar-help-menu [info-panel]
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
551 '("About Emacs..." . ns-do-emacs-info-panel)))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
552
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
553
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
554 ;;;; File menu, replaces standard under ns-extended-platform-support
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
555 (defvar menu-bar-ns-file-menu (make-sparse-keymap "File"))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
556 (define-key menu-bar-ns-file-menu [one-window]
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
557 '("Remove Splits" . delete-other-windows))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
558 (define-key menu-bar-ns-file-menu [split-window]
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
559 '("Split Window" . split-window-vertically))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
560
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
561 (define-key menu-bar-ns-file-menu [separator-print] '("--"))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
562
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
563 (defvar ns-ps-print-menu-map (make-sparse-keymap "Postscript Print"))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
564 (define-key ns-ps-print-menu-map [ps-print-region]
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
565 '("Region (B+W)" . ps-print-region))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
566 (define-key ns-ps-print-menu-map [ps-print-buffer]
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
567 '("Buffer (B+W)" . ps-print-buffer))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
568 (define-key ns-ps-print-menu-map [ps-print-region-faces]
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
569 '("Region" . ps-print-region-with-faces))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
570 (define-key ns-ps-print-menu-map [ps-print-buffer-faces]
96814
2ae5159088f5 fix typo ns-ps-print-buffer-with-faces pointed out by Vinicius Jose Latorre
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 96805
diff changeset
571 '("Buffer" . ps-print-buffer-with-faces))
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
572 (define-key menu-bar-ns-file-menu [postscript-print]
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
573 (cons "Postscript Print" ns-ps-print-menu-map))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
574
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
575 (define-key menu-bar-ns-file-menu [print-region]
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
576 '("Print Region" . print-region))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
577 (define-key menu-bar-ns-file-menu [print-buffer]
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
578 '("Print Buffer" . ns-print-buffer))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
579
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
580 (define-key menu-bar-ns-file-menu [separator-save] '("--"))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
581
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
582 (define-key menu-bar-ns-file-menu [recover-session]
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
583 '("Recover Crashed Session" . recover-session))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
584 (define-key menu-bar-ns-file-menu [revert-buffer]
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
585 '("Revert Buffer" . revert-buffer))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
586 (define-key menu-bar-ns-file-menu [write-file]
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
587 '("Save Buffer As..." . ns-write-file-using-panel))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
588 (define-key menu-bar-ns-file-menu [save-buffer] '("Save Buffer" . save-buffer))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
589
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
590 (define-key menu-bar-ns-file-menu [kill-buffer]
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
591 '("Kill Current Buffer" . kill-this-buffer))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
592 (define-key menu-bar-ns-file-menu [delete-this-frame]
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
593 '("Close Frame" . delete-frame))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
594
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
595 (define-key menu-bar-ns-file-menu [separator-open] '("--"))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
596
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
597 (define-key menu-bar-ns-file-menu [insert-file]
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
598 '("Insert File..." . insert-file))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
599 (define-key menu-bar-ns-file-menu [dired]
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
600 '("Open Directory..." . ns-open-file-using-panel))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
601 (define-key menu-bar-ns-file-menu [open-file]
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
602 '("Open File..." . ns-open-file-using-panel))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
603 (define-key menu-bar-ns-file-menu [make-frame]
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
604 '("New Frame" . make-frame))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
605
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
606
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
607 ;;;; Edit menu: Modify slightly
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
608
96748
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
609 ;; Substitute a Copy function that works better under X (for GNUstep).
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
610 (easy-menu-remove-item global-map '("menu-bar" "edit") 'copy)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
611 (define-key-after menu-bar-edit-menu [copy]
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
612 '(menu-item "Copy" ns-copy-including-secondary
96748
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
613 :enable mark-active
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
614 :help "Copy text in region between mark and current position")
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
615 'cut)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
616
96748
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
617 ;; Change to same precondition as select-and-paste, as we don't have
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
618 ;; `x-selection-exists-p'.
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
619 (easy-menu-remove-item global-map '("menu-bar" "edit") 'paste)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
620 (define-key-after menu-bar-edit-menu [paste]
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
621 '(menu-item "Paste" yank
96748
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
622 :enable (and (cdr yank-menu) (not buffer-read-only))
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
623 :help "Paste (yank) text most recently cut/copied")
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
624 'copy)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
625
96748
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
626 ;; Change text to be more consistent with surrounding menu items `paste', etc.
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
627 (easy-menu-remove-item global-map '("menu-bar" "edit") 'paste-from-menu)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
628 (define-key-after menu-bar-edit-menu [select-paste]
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
629 '(menu-item "Select and Paste" yank-menu
96748
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
630 :enable (and (cdr yank-menu) (not buffer-read-only))
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
631 :help "Choose a string from the kill ring and paste it")
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
632 'paste)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
633
96748
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
634 ;; Separate undo from cut/paste section, add spell for platform consistency.
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
635 (define-key-after menu-bar-edit-menu [separator-undo] '("--") 'undo)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
636 (define-key-after menu-bar-edit-menu [spell] '("Spell" . ispell-menu-map) 'fill)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
637
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
638
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
639 ;;;; Windows menu
96757
18b856a0216f (ns-handle-switch): Simplify. Handle the numeric case.
Glenn Morris <rgm@gnu.org>
parents: 96748
diff changeset
640 (defun menu-bar-select-frame (&optional frame)
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
641 (interactive)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
642 (make-frame-visible last-command-event)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
643 (raise-frame last-command-event)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
644 (select-frame last-command-event))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
645
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
646 (defun menu-bar-update-frames ()
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
647 ;; If user discards the Windows item, play along.
96748
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
648 (when (lookup-key (current-global-map) [menu-bar windows])
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
649 (let ((frames (frame-list))
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
650 (frames-menu (make-sparse-keymap "Select Frame")))
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
651 (setcdr frames-menu
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
652 (nconc
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
653 (mapcar (lambda (frame)
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
654 (list* frame
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
655 (cdr (assq 'name (frame-parameters frame)))
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
656 'menu-bar-select-frame))
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
657 frames)
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
658 (cdr frames-menu)))
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
659 (define-key frames-menu [separator-frames] '("--"))
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
660 (define-key frames-menu [popup-color-panel]
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
661 '("Colors..." . ns-popup-color-panel))
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
662 (define-key frames-menu [popup-font-panel]
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
663 '("Font Panel..." . ns-popup-font-panel))
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
664 (define-key frames-menu [separator-arrange] '("--"))
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
665 (define-key frames-menu [arrange-all-frames]
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
666 '("Arrange All Frames" . ns-arrange-all-frames))
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
667 (define-key frames-menu [arrange-visible-frames]
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
668 '("Arrange Visible Frames" . ns-arrange-visible-frames))
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
669 ;; Don't use delete-frame as event name
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
670 ;; because that is a special event.
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
671 (define-key (current-global-map) [menu-bar windows]
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
672 (cons "Windows" frames-menu)))))
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
673
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
674 (defun force-menu-bar-update-buffers ()
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
675 ;; This is a hack to get around fact that we already checked
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
676 ;; frame-or-buffer-changed-p and reset it, so menu-bar-update-buffers
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
677 ;; does not pick up any change.
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
678 (menu-bar-update-buffers t))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
679
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
680 (add-hook 'menu-bar-update-fab-hook 'menu-bar-update-frames)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
681 (add-hook 'menu-bar-update-fab-hook 'force-menu-bar-update-buffers)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
682
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
683 (defun menu-bar-update-frames-and-buffers ()
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
684 (if (frame-or-buffer-changed-p)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
685 (run-hooks 'menu-bar-update-fab-hook)))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
686
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
687 (setq menu-bar-update-hook
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
688 (delq 'menu-bar-update-buffers menu-bar-update-hook))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
689 (add-hook 'menu-bar-update-hook 'menu-bar-update-frames-and-buffers)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
690
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
691 (menu-bar-update-frames-and-buffers)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
692
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
693
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
694 ;; ns-arrange functions contributed
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
695 ;; by Eberhard Mandler <mandler@dbag.ulm.DaimlerBenz.COM>
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
696 (defun ns-arrange-all-frames ()
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
697 "Arranges all frames according to topline"
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
698 (interactive)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
699 (ns-arrange-frames t))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
700
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
701 (defun ns-arrange-visible-frames ()
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
702 "Arranges all visible frames according to topline"
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
703 (interactive)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
704 (ns-arrange-frames nil))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
705
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
706 (defun ns-arrange-frames ( vis)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
707 (let ((frame (next-frame))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
708 (end-frame (selected-frame))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
709 (inc-x 20) ;relative position of frames
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
710 (inc-y 22)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
711 (x-pos 100) ;start position
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
712 (y-pos 40)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
713 (done nil))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
714 (while (not done) ;cycle through all frames
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
715 (if (not (or vis (eq (frame-visible-p frame) t)))
96748
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
716 (setq x-pos x-pos); do nothing; true case
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
717 (set-frame-position frame x-pos y-pos)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
718 (setq x-pos (+ x-pos inc-x))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
719 (setq y-pos (+ y-pos inc-y))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
720 (raise-frame frame))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
721 (select-frame frame)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
722 (setq frame (next-frame))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
723 (setq done (equal frame end-frame)))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
724 (set-frame-position end-frame x-pos y-pos)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
725 (raise-frame frame)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
726 (select-frame frame)))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
727
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
728
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
729 ;;;; Services
96757
18b856a0216f (ns-handle-switch): Simplify. Handle the numeric case.
Glenn Morris <rgm@gnu.org>
parents: 96748
diff changeset
730 (declare-function ns-perform-service "nsfns.m" (service send))
18b856a0216f (ns-handle-switch): Simplify. Handle the numeric case.
Glenn Morris <rgm@gnu.org>
parents: 96748
diff changeset
731
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
732 (defun ns-define-service (path)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
733 (let ((mapping [menu-bar services])
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
734 (service (mapconcat 'identity path "/"))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
735 (name (intern
96748
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
736 (subst-char-in-string
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
737 ?\s ?-
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
738 (mapconcat 'identity (cons "ns-service" path) "-")))))
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
739 ;; This defines the function.
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
740 (defalias name
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
741 (lexical-let ((service service))
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
742 (lambda (arg)
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
743 (interactive "p")
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
744 (let* ((in-string
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
745 (cond ((stringp arg) arg)
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
746 (mark-active
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
747 (buffer-substring (region-beginning) (region-end)))))
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
748 (out-string (ns-perform-service service in-string)))
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
749 (cond
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
750 ((stringp arg) out-string)
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
751 ((and out-string (or (not in-string)
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
752 (not (string= in-string out-string))))
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
753 (if mark-active (delete-region (region-beginning) (region-end)))
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
754 (insert out-string)
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
755 (setq deactivate-mark nil)))))))
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
756 (cond
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
757 ((lookup-key global-map mapping)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
758 (while (cdr path)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
759 (setq mapping (vconcat mapping (list (intern (car path)))))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
760 (if (not (keymapp (lookup-key global-map mapping)))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
761 (define-key global-map mapping
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
762 (cons (car path) (make-sparse-keymap (car path)))))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
763 (setq path (cdr path)))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
764 (setq mapping (vconcat mapping (list (intern (car path)))))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
765 (define-key global-map mapping (cons (car path) name))))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
766 name))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
767
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
768 (precompute-menubar-bindings)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
769
96699
05aeed7284d3 Fix header format and permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 96684
diff changeset
770 ;; nsterm.m
05aeed7284d3 Fix header format and permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 96684
diff changeset
771 (defvar ns-input-spi-name)
05aeed7284d3 Fix header format and permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 96684
diff changeset
772 (defvar ns-input-spi-arg)
05aeed7284d3 Fix header format and permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 96684
diff changeset
773
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
774 (defun ns-spi-service-call ()
96799
6cfed26789b7 (ns-submit-bug-report): Function removed. Bug
Chong Yidong <cyd@stupidchicken.com>
parents: 96792
diff changeset
775 "Respond to a service request."
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
776 (interactive)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
777 (cond ((string-equal ns-input-spi-name "open-selection")
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
778 (switch-to-buffer (generate-new-buffer "*untitled*"))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
779 (insert ns-input-spi-arg))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
780 ((string-equal ns-input-spi-name "open-file")
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
781 (dnd-open-file ns-input-spi-arg nil))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
782 ((string-equal ns-input-spi-name "mail-selection")
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
783 (compose-mail)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
784 (rfc822-goto-eoh)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
785 (forward-line 1)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
786 (insert ns-input-spi-arg))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
787 ((string-equal ns-input-spi-name "mail-to")
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
788 (compose-mail ns-input-spi-arg))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
789 (t (error (concat "Service " ns-input-spi-name " not recognized")))))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
790
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
791
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
792 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
793
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
794
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
795
96859
2e1af3a60ab7 Standardize references to "Nextstep" in comments, messages, and docstrings.
Chong Yidong <cyd@stupidchicken.com>
parents: 96814
diff changeset
796 ;;;; Composed key sequence handling for Nextstep system input methods.
2e1af3a60ab7 Standardize references to "Nextstep" in comments, messages, and docstrings.
Chong Yidong <cyd@stupidchicken.com>
parents: 96814
diff changeset
797 ;;;; (On Nextstep systems, input methods are provided for CJK
2e1af3a60ab7 Standardize references to "Nextstep" in comments, messages, and docstrings.
Chong Yidong <cyd@stupidchicken.com>
parents: 96814
diff changeset
798 ;;;; characters, etc. which require multiple keystrokes, and during
2e1af3a60ab7 Standardize references to "Nextstep" in comments, messages, and docstrings.
Chong Yidong <cyd@stupidchicken.com>
parents: 96814
diff changeset
799 ;;;; entry a partial ("working") result is typically shown in the
2e1af3a60ab7 Standardize references to "Nextstep" in comments, messages, and docstrings.
Chong Yidong <cyd@stupidchicken.com>
parents: 96814
diff changeset
800 ;;;; editing window.)
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
801
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
802 (defface ns-working-text-face
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
803 '((t :underline t))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
804 "Face used to highlight working text during compose sequence insert."
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
805 :group 'ns)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
806
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
807 (defvar ns-working-overlay nil
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
808 "Overlay used to highlight working text during compose sequence insert.")
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
809 (make-variable-buffer-local 'ns-working-overlay)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
810 (defvar ns-working-overlay-len 0
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
811 "Length of working text during compose sequence insert.")
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
812 (make-variable-buffer-local 'ns-working-overlay-len)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
813
96748
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
814 ;; Based on mac-win.el 2007/08/26 unicode-2. This will fail if called
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
815 ;; from an "interactive" function.
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
816 (defun ns-in-echo-area ()
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
817 "Whether, for purposes of inserting working composition text, the minibuffer
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
818 is currently being used."
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
819 (or isearch-mode
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
820 (and cursor-in-echo-area (current-message))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
821 ;; Overlay strings are not shown in some cases.
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
822 (get-char-property (point) 'invisible)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
823 (and (not (bobp))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
824 (or (and (get-char-property (point) 'display)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
825 (eq (get-char-property (1- (point)) 'display)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
826 (get-char-property (point) 'display)))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
827 (and (get-char-property (point) 'composition)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
828 (eq (get-char-property (1- (point)) 'composition)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
829 (get-char-property (point) 'composition)))))))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
830
96748
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
831 ;; Currently not used, doesn't work because the 'interactive' here stays
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
832 ;; for subinvocations.
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
833 (defun ns-insert-working-text ()
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
834 (interactive)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
835 (if (ns-in-echo-area) (ns-echo-working-text) (ns-put-working-text)))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
836
96699
05aeed7284d3 Fix header format and permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 96684
diff changeset
837 (defvar ns-working-text) ; nsterm.m
05aeed7284d3 Fix header format and permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 96684
diff changeset
838
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
839 (defun ns-put-working-text ()
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
840 "Insert contents of ns-working-text as UTF8 string and mark with
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
841 ns-working-overlay. Any previously existing working text is cleared first.
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
842 The overlay is assigned the face ns-working-text-face."
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
843 (interactive)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
844 (if ns-working-overlay (ns-delete-working-text))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
845 (let ((start (point)))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
846 (insert ns-working-text)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
847 (overlay-put (setq ns-working-overlay (make-overlay start (point)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
848 (current-buffer) nil t))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
849 'face 'ns-working-text-face)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
850 (setq ns-working-overlay-len (+ ns-working-overlay-len (- (point) start)))))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
851
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
852 (defun ns-echo-working-text ()
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
853 "Echo contents of ns-working-text in message display area.
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
854 See ns-insert-working-text."
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
855 (if ns-working-overlay (ns-unecho-working-text))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
856 (let* ((msg (current-message))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
857 (msglen (length msg))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
858 message-log-max)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
859 (setq ns-working-overlay-len (length ns-working-text))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
860 (setq msg (concat msg ns-working-text))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
861 (put-text-property msglen (+ msglen ns-working-overlay-len) 'face 'ns-working-text-face msg)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
862 (message "%s" msg)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
863 (setq ns-working-overlay t)))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
864
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
865 (defun ns-delete-working-text()
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
866 "Delete working text and clear ns-working-overlay."
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
867 (interactive)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
868 (delete-backward-char ns-working-overlay-len)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
869 (setq ns-working-overlay-len 0)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
870 (delete-overlay ns-working-overlay))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
871
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
872 (defun ns-unecho-working-text()
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
873 "Delete working text from echo area and clear ns-working-overlay."
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
874 (let ((msg (current-message))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
875 message-log-max)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
876 (setq msg (substring msg 0 (- (length msg) ns-working-overlay-len)))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
877 (setq ns-working-overlay-len 0)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
878 (setq ns-working-overlay nil)))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
879
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
880
96699
05aeed7284d3 Fix header format and permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 96684
diff changeset
881 (declare-function ns-convert-utf8-nfd-to-nfc "nsfns.m" (str))
05aeed7284d3 Fix header format and permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 96684
diff changeset
882
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
883 ;;;; OS X file system Unicode UTF-8 NFD (decomposed form) support
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
884 ;; Lisp code based on utf-8m.el, by Seiji Zenitani, Eiji Honjoh, and
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
885 ;; Carsten Bormann.
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
886 (if (eq system-type 'darwin)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
887 (progn
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
888
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
889 (defun ns-utf8-nfd-post-read-conversion (length)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
890 "Calls ns-convert-utf8-nfd-to-nfc to compose char sequences."
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
891 (save-excursion
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
892 (save-restriction
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
893 (narrow-to-region (point) (+ (point) length))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
894 (let ((str (buffer-string)))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
895 (delete-region (point-min) (point-max))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
896 (insert (ns-convert-utf8-nfd-to-nfc str))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
897 (- (point-max) (point-min))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
898 ))))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
899
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
900 (define-coding-system 'utf-8-nfd
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
901 "UTF-8 NFD (decomposed) encoding."
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
902 :coding-type 'utf-8
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
903 :mnemonic ?U
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
904 :charset-list '(unicode)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
905 :post-read-conversion 'ns-utf8-nfd-post-read-conversion)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
906 (set-file-name-coding-system 'utf-8-nfd)))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
907
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
908 ;; PENDING: disable composition-based display for Indic scripts as it
96859
2e1af3a60ab7 Standardize references to "Nextstep" in comments, messages, and docstrings.
Chong Yidong <cyd@stupidchicken.com>
parents: 96814
diff changeset
909 ;; is not working well under Nextstep for some reason
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
910 (set-char-table-range composition-function-table
96748
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
911 '(#x0900 . #x0DFF) nil)
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
912
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
913
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
914 ;;;; Inter-app communications support.
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
915
96699
05aeed7284d3 Fix header format and permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 96684
diff changeset
916 (defvar ns-input-text) ; nsterm.m
05aeed7284d3 Fix header format and permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 96684
diff changeset
917
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
918 (defun ns-insert-text ()
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
919 "Insert contents of ns-input-text at point."
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
920 (interactive)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
921 (insert ns-input-text)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
922 (setq ns-input-text nil))
96699
05aeed7284d3 Fix header format and permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 96684
diff changeset
923
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
924 (defun ns-insert-file ()
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
925 "Insert contents of file ns-input-file like insert-file but with less
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
926 prompting. If file is a directory perform a find-file on it."
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
927 (interactive)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
928 (let ((f))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
929 (setq f (car ns-input-file))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
930 (setq ns-input-file (cdr ns-input-file))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
931 (if (file-directory-p f)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
932 (find-file f)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
933 (push-mark (+ (point) (car (cdr (insert-file-contents f))))))))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
934
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
935 (defvar ns-select-overlay nil
96859
2e1af3a60ab7 Standardize references to "Nextstep" in comments, messages, and docstrings.
Chong Yidong <cyd@stupidchicken.com>
parents: 96814
diff changeset
936 "Overlay used to highlight areas in files requested by Nextstep apps.")
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
937 (make-variable-buffer-local 'ns-select-overlay)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
938
96699
05aeed7284d3 Fix header format and permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 96684
diff changeset
939 (defvar ns-input-line) ; nsterm.m
05aeed7284d3 Fix header format and permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 96684
diff changeset
940
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
941 (defun ns-open-file-select-line ()
96792
50bfb208e018 Contents of ns-grabenv.el moved here.
Chong Yidong <cyd@stupidchicken.com>
parents: 96788
diff changeset
942 "Open a buffer containing the file `ns-input-file'.
50bfb208e018 Contents of ns-grabenv.el moved here.
Chong Yidong <cyd@stupidchicken.com>
parents: 96788
diff changeset
943 Lines are highlighted according to `ns-input-line'."
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
944 (interactive)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
945 (ns-find-file)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
946 (cond
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
947 ((and ns-input-line (buffer-modified-p))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
948 (if ns-select-overlay
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
949 (setq ns-select-overlay (delete-overlay ns-select-overlay)))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
950 (deactivate-mark)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
951 (goto-line (if (consp ns-input-line)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
952 (min (car ns-input-line) (cdr ns-input-line))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
953 ns-input-line)))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
954 (ns-input-line
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
955 (if (not ns-select-overlay)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
956 (overlay-put (setq ns-select-overlay (make-overlay (point-min) (point-min)))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
957 'face 'highlight))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
958 (let ((beg (save-excursion
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
959 (goto-line (if (consp ns-input-line)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
960 (min (car ns-input-line) (cdr ns-input-line))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
961 ns-input-line))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
962 (point)))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
963 (end (save-excursion
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
964 (goto-line (+ 1 (if (consp ns-input-line)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
965 (max (car ns-input-line) (cdr ns-input-line))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
966 ns-input-line)))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
967 (point))))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
968 (move-overlay ns-select-overlay beg end)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
969 (deactivate-mark)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
970 (goto-char beg)))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
971 (t
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
972 (if ns-select-overlay
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
973 (setq ns-select-overlay (delete-overlay ns-select-overlay))))))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
974
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
975 (defun ns-unselect-line ()
96859
2e1af3a60ab7 Standardize references to "Nextstep" in comments, messages, and docstrings.
Chong Yidong <cyd@stupidchicken.com>
parents: 96814
diff changeset
976 "Removes any Nextstep highlight a buffer may contain."
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
977 (if ns-select-overlay
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
978 (setq ns-select-overlay (delete-overlay ns-select-overlay))))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
979
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
980 (add-hook 'first-change-hook 'ns-unselect-line)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
981
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
982
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
983
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
984 ;;;; Preferences handling.
96699
05aeed7284d3 Fix header format and permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 96684
diff changeset
985 (declare-function ns-get-resource "nsfns.m" (owner name))
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
986
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
987 (defun get-lisp-resource (arg1 arg2)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
988 (let ((res (ns-get-resource arg1 arg2)))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
989 (cond
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
990 ((not res) 'unbound)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
991 ((string-equal (upcase res) "YES") t)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
992 ((string-equal (upcase res) "NO") nil)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
993 (t (read res)))))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
994
96699
05aeed7284d3 Fix header format and permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 96684
diff changeset
995 ;; nsterm.m
05aeed7284d3 Fix header format and permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 96684
diff changeset
996 (defvar ns-command-modifier)
05aeed7284d3 Fix header format and permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 96684
diff changeset
997 (defvar ns-control-modifier)
05aeed7284d3 Fix header format and permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 96684
diff changeset
998 (defvar ns-function-modifier)
05aeed7284d3 Fix header format and permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 96684
diff changeset
999 (defvar ns-antialias-text)
05aeed7284d3 Fix header format and permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 96684
diff changeset
1000 (defvar ns-use-qd-smoothing)
05aeed7284d3 Fix header format and permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 96684
diff changeset
1001 (defvar ns-use-system-highlight-color)
05aeed7284d3 Fix header format and permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 96684
diff changeset
1002
05aeed7284d3 Fix header format and permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 96684
diff changeset
1003 (declare-function ns-set-resource "nsfns.m" (owner name value))
05aeed7284d3 Fix header format and permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 96684
diff changeset
1004 (declare-function ns-font-name "nsfns.m" (name))
05aeed7284d3 Fix header format and permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 96684
diff changeset
1005 (declare-function ns-read-file-name "nsfns.m"
05aeed7284d3 Fix header format and permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 96684
diff changeset
1006 (prompt &optional dir isLoad init))
05aeed7284d3 Fix header format and permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 96684
diff changeset
1007
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1008 (defun ns-save-preferences ()
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1009 "Set all the defaults."
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1010 (interactive)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1011 ;; Global preferences
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1012 (ns-set-resource nil "AlternateModifier" (symbol-name ns-alternate-modifier))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1013 (ns-set-resource nil "CommandModifier" (symbol-name ns-command-modifier))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1014 (ns-set-resource nil "ControlModifier" (symbol-name ns-control-modifier))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1015 (ns-set-resource nil "FunctionModifier" (symbol-name ns-function-modifier))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1016 (ns-set-resource nil "CursorBlinkRate"
96748
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
1017 (if ns-cursor-blink-rate
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
1018 (number-to-string ns-cursor-blink-rate)
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
1019 "NO"))
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1020 (ns-set-resource nil "ExpandSpace"
96748
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
1021 (if ns-expand-space
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
1022 (number-to-string ns-expand-space)
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
1023 "NO"))
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1024 (ns-set-resource nil "GSFontAntiAlias" (if ns-antialias-text "YES" "NO"))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1025 (ns-set-resource nil "UseQuickdrawSmoothing"
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1026 (if ns-use-qd-smoothing "YES" "NO"))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1027 (ns-set-resource nil "UseSystemHighlightColor"
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1028 (if ns-use-system-highlight-color "YES" "NO"))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1029 ;; Default frame parameters
96757
18b856a0216f (ns-handle-switch): Simplify. Handle the numeric case.
Glenn Morris <rgm@gnu.org>
parents: 96748
diff changeset
1030 (let ((p (frame-parameters))
18b856a0216f (ns-handle-switch): Simplify. Handle the numeric case.
Glenn Morris <rgm@gnu.org>
parents: 96748
diff changeset
1031 v)
18b856a0216f (ns-handle-switch): Simplify. Handle the numeric case.
Glenn Morris <rgm@gnu.org>
parents: 96748
diff changeset
1032 (if (setq v (assq 'font p))
18b856a0216f (ns-handle-switch): Simplify. Handle the numeric case.
Glenn Morris <rgm@gnu.org>
parents: 96748
diff changeset
1033 (ns-set-resource nil "Font" (ns-font-name (cdr v))))
18b856a0216f (ns-handle-switch): Simplify. Handle the numeric case.
Glenn Morris <rgm@gnu.org>
parents: 96748
diff changeset
1034 (if (setq v (assq 'fontsize p))
18b856a0216f (ns-handle-switch): Simplify. Handle the numeric case.
Glenn Morris <rgm@gnu.org>
parents: 96748
diff changeset
1035 (ns-set-resource nil "FontSize" (number-to-string (cdr v))))
18b856a0216f (ns-handle-switch): Simplify. Handle the numeric case.
Glenn Morris <rgm@gnu.org>
parents: 96748
diff changeset
1036 (if (setq v (assq 'foreground-color p))
18b856a0216f (ns-handle-switch): Simplify. Handle the numeric case.
Glenn Morris <rgm@gnu.org>
parents: 96748
diff changeset
1037 (ns-set-resource nil "Foreground" (cdr v)))
18b856a0216f (ns-handle-switch): Simplify. Handle the numeric case.
Glenn Morris <rgm@gnu.org>
parents: 96748
diff changeset
1038 (if (setq v (assq 'background-color p))
18b856a0216f (ns-handle-switch): Simplify. Handle the numeric case.
Glenn Morris <rgm@gnu.org>
parents: 96748
diff changeset
1039 (ns-set-resource nil "Background" (cdr v)))
18b856a0216f (ns-handle-switch): Simplify. Handle the numeric case.
Glenn Morris <rgm@gnu.org>
parents: 96748
diff changeset
1040 (if (setq v (assq 'cursor-color p))
18b856a0216f (ns-handle-switch): Simplify. Handle the numeric case.
Glenn Morris <rgm@gnu.org>
parents: 96748
diff changeset
1041 (ns-set-resource nil "CursorColor" (cdr v)))
18b856a0216f (ns-handle-switch): Simplify. Handle the numeric case.
Glenn Morris <rgm@gnu.org>
parents: 96748
diff changeset
1042 (if (setq v (assq 'cursor-type p))
18b856a0216f (ns-handle-switch): Simplify. Handle the numeric case.
Glenn Morris <rgm@gnu.org>
parents: 96748
diff changeset
1043 (ns-set-resource nil "CursorType" (if (symbolp (cdr v))
18b856a0216f (ns-handle-switch): Simplify. Handle the numeric case.
Glenn Morris <rgm@gnu.org>
parents: 96748
diff changeset
1044 (symbol-name (cdr v))
18b856a0216f (ns-handle-switch): Simplify. Handle the numeric case.
Glenn Morris <rgm@gnu.org>
parents: 96748
diff changeset
1045 (cdr v))))
18b856a0216f (ns-handle-switch): Simplify. Handle the numeric case.
Glenn Morris <rgm@gnu.org>
parents: 96748
diff changeset
1046 (if (setq v (assq 'underline p))
18b856a0216f (ns-handle-switch): Simplify. Handle the numeric case.
Glenn Morris <rgm@gnu.org>
parents: 96748
diff changeset
1047 (ns-set-resource nil "Underline"
18b856a0216f (ns-handle-switch): Simplify. Handle the numeric case.
Glenn Morris <rgm@gnu.org>
parents: 96748
diff changeset
1048 (case (cdr v)
18b856a0216f (ns-handle-switch): Simplify. Handle the numeric case.
Glenn Morris <rgm@gnu.org>
parents: 96748
diff changeset
1049 ((t) "YES")
18b856a0216f (ns-handle-switch): Simplify. Handle the numeric case.
Glenn Morris <rgm@gnu.org>
parents: 96748
diff changeset
1050 ((nil) "NO")
18b856a0216f (ns-handle-switch): Simplify. Handle the numeric case.
Glenn Morris <rgm@gnu.org>
parents: 96748
diff changeset
1051 (t (cdr v)))))
18b856a0216f (ns-handle-switch): Simplify. Handle the numeric case.
Glenn Morris <rgm@gnu.org>
parents: 96748
diff changeset
1052 (if (setq v (assq 'internal-border-width p))
18b856a0216f (ns-handle-switch): Simplify. Handle the numeric case.
Glenn Morris <rgm@gnu.org>
parents: 96748
diff changeset
1053 (ns-set-resource nil "InternalBorderWidth"
96805
f38d566bd19b Add 2007 to copyright years, since was available then.
Glenn Morris <rgm@gnu.org>
parents: 96799
diff changeset
1054 (number-to-string (cdr v))))
96757
18b856a0216f (ns-handle-switch): Simplify. Handle the numeric case.
Glenn Morris <rgm@gnu.org>
parents: 96748
diff changeset
1055 (if (setq v (assq 'vertical-scroll-bars p))
18b856a0216f (ns-handle-switch): Simplify. Handle the numeric case.
Glenn Morris <rgm@gnu.org>
parents: 96748
diff changeset
1056 (ns-set-resource nil "VerticalScrollBars"
18b856a0216f (ns-handle-switch): Simplify. Handle the numeric case.
Glenn Morris <rgm@gnu.org>
parents: 96748
diff changeset
1057 (case (cdr v)
18b856a0216f (ns-handle-switch): Simplify. Handle the numeric case.
Glenn Morris <rgm@gnu.org>
parents: 96748
diff changeset
1058 ((t) "YES")
18b856a0216f (ns-handle-switch): Simplify. Handle the numeric case.
Glenn Morris <rgm@gnu.org>
parents: 96748
diff changeset
1059 ((nil) "NO")
18b856a0216f (ns-handle-switch): Simplify. Handle the numeric case.
Glenn Morris <rgm@gnu.org>
parents: 96748
diff changeset
1060 ((left) "left")
18b856a0216f (ns-handle-switch): Simplify. Handle the numeric case.
Glenn Morris <rgm@gnu.org>
parents: 96748
diff changeset
1061 ((right) "right")
18b856a0216f (ns-handle-switch): Simplify. Handle the numeric case.
Glenn Morris <rgm@gnu.org>
parents: 96748
diff changeset
1062 (t nil))))
18b856a0216f (ns-handle-switch): Simplify. Handle the numeric case.
Glenn Morris <rgm@gnu.org>
parents: 96748
diff changeset
1063 (if (setq v (assq 'height p))
18b856a0216f (ns-handle-switch): Simplify. Handle the numeric case.
Glenn Morris <rgm@gnu.org>
parents: 96748
diff changeset
1064 (ns-set-resource nil "Height" (number-to-string (cdr v))))
18b856a0216f (ns-handle-switch): Simplify. Handle the numeric case.
Glenn Morris <rgm@gnu.org>
parents: 96748
diff changeset
1065 (if (setq v (assq 'width p))
18b856a0216f (ns-handle-switch): Simplify. Handle the numeric case.
Glenn Morris <rgm@gnu.org>
parents: 96748
diff changeset
1066 (ns-set-resource nil "Width" (number-to-string (cdr v))))
18b856a0216f (ns-handle-switch): Simplify. Handle the numeric case.
Glenn Morris <rgm@gnu.org>
parents: 96748
diff changeset
1067 (if (setq v (assq 'top p))
18b856a0216f (ns-handle-switch): Simplify. Handle the numeric case.
Glenn Morris <rgm@gnu.org>
parents: 96748
diff changeset
1068 (ns-set-resource nil "Top" (number-to-string (cdr v))))
18b856a0216f (ns-handle-switch): Simplify. Handle the numeric case.
Glenn Morris <rgm@gnu.org>
parents: 96748
diff changeset
1069 (if (setq v (assq 'left p))
18b856a0216f (ns-handle-switch): Simplify. Handle the numeric case.
Glenn Morris <rgm@gnu.org>
parents: 96748
diff changeset
1070 (ns-set-resource nil "Left" (number-to-string (cdr v))))
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1071 ;; These not fully supported
96757
18b856a0216f (ns-handle-switch): Simplify. Handle the numeric case.
Glenn Morris <rgm@gnu.org>
parents: 96748
diff changeset
1072 (if (setq v (assq 'auto-raise p))
18b856a0216f (ns-handle-switch): Simplify. Handle the numeric case.
Glenn Morris <rgm@gnu.org>
parents: 96748
diff changeset
1073 (ns-set-resource nil "AutoRaise" (if (cdr v) "YES" "NO")))
18b856a0216f (ns-handle-switch): Simplify. Handle the numeric case.
Glenn Morris <rgm@gnu.org>
parents: 96748
diff changeset
1074 (if (setq v (assq 'auto-lower p))
18b856a0216f (ns-handle-switch): Simplify. Handle the numeric case.
Glenn Morris <rgm@gnu.org>
parents: 96748
diff changeset
1075 (ns-set-resource nil "AutoLower" (if (cdr v) "YES" "NO")))
18b856a0216f (ns-handle-switch): Simplify. Handle the numeric case.
Glenn Morris <rgm@gnu.org>
parents: 96748
diff changeset
1076 (if (setq v (assq 'menu-bar-lines p))
18b856a0216f (ns-handle-switch): Simplify. Handle the numeric case.
Glenn Morris <rgm@gnu.org>
parents: 96748
diff changeset
1077 (ns-set-resource nil "Menus" (if (cdr v) "YES" "NO")))
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1078 )
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1079 (let ((fl (face-list)))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1080 (while (consp fl)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1081 (or (eq 'default (car fl))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1082 ;; dont save Default* since it causes all created faces to
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1083 ;; inherit its values. The properties of the default face
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1084 ;; have already been saved from the frame-parameters anyway.
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1085 (let* ((name (symbol-name (car fl)))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1086 (font (face-font (car fl)))
96748
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
1087 ;; (fontsize (face-fontsize (car fl)))
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1088 (foreground (face-foreground (car fl)))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1089 (background (face-background (car fl)))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1090 (underline (face-underline-p (car fl)))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1091 (italic (face-italic-p (car fl)))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1092 (bold (face-bold-p (car fl)))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1093 (stipple (face-stipple (car fl))))
96748
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
1094 ;; (ns-set-resource nil (concat name ".attributeFont")
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
1095 ;; (if font font nil))
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
1096 ;; (ns-set-resource nil (concat name ".attributeFontSize")
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
1097 ;; (if fontsize (number-to-string fontsize) nil))
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1098 (ns-set-resource nil (concat name ".attributeForeground")
96748
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
1099 (if foreground foreground nil))
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1100 (ns-set-resource nil (concat name ".attributeBackground")
96748
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
1101 (if background background nil))
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1102 (ns-set-resource nil (concat name ".attributeUnderline")
96748
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
1103 (if underline "YES" nil))
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1104 (ns-set-resource nil (concat name ".attributeItalic")
96748
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
1105 (if italic "YES" nil))
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1106 (ns-set-resource nil (concat name ".attributeBold")
96748
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
1107 (if bold "YES" nil))
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1108 (and stipple
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1109 (or (stringp stipple)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1110 (setq stipple (prin1-to-string stipple))))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1111 (ns-set-resource nil (concat name ".attributeStipple")
96748
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
1112 (if stipple stipple nil))))
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1113 (setq fl (cdr fl)))))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1114
96699
05aeed7284d3 Fix header format and permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 96684
diff changeset
1115 (declare-function menu-bar-options-save-orig "ns-win" () t)
05aeed7284d3 Fix header format and permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 96684
diff changeset
1116
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1117 ;; call ns-save-preferences when menu-bar-options-save is called
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1118 (fset 'menu-bar-options-save-orig (symbol-function 'menu-bar-options-save))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1119 (defun ns-save-options ()
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1120 (interactive)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1121 (menu-bar-options-save-orig)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1122 (ns-save-preferences))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1123 (fset 'menu-bar-options-save (symbol-function 'ns-save-options))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1124
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1125
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1126 ;;;; File handling.
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1127
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1128 (defun ns-open-file-using-panel ()
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1129 "Pop up open-file panel, and load the result in a buffer."
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1130 (interactive)
96748
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
1131 ;; Prompt dir defaultName isLoad initial.
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1132 (setq ns-input-file (ns-read-file-name "Select File to Load" nil t nil))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1133 (if ns-input-file
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1134 (and (setq ns-input-file (list ns-input-file)) (ns-find-file))))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1135
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1136 (defun ns-write-file-using-panel ()
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1137 "Pop up save-file panel, and save buffer in resulting name."
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1138 (interactive)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1139 (let (ns-output-file)
96748
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
1140 ;; Prompt dir defaultName isLoad initial.
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1141 (setq ns-output-file (ns-read-file-name "Save As" nil nil nil))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1142 (message ns-output-file)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1143 (if ns-output-file (write-file ns-output-file))))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1144
96699
05aeed7284d3 Fix header format and permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 96684
diff changeset
1145 (defvar ns-pop-up-frames 'fresh
05aeed7284d3 Fix header format and permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 96684
diff changeset
1146 "*Non-nil means open files upon request from the Workspace in a new frame.
05aeed7284d3 Fix header format and permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 96684
diff changeset
1147 If t, always do so. Any other non-nil value means open a new frame
05aeed7284d3 Fix header format and permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 96684
diff changeset
1148 unless the current buffer is a scratch buffer.")
05aeed7284d3 Fix header format and permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 96684
diff changeset
1149
05aeed7284d3 Fix header format and permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 96684
diff changeset
1150 (declare-function ns-hide-emacs "nsfns.m" (on))
05aeed7284d3 Fix header format and permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 96684
diff changeset
1151
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1152 (defun ns-find-file ()
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1153 "Do a find-file with the ns-input-file as argument."
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1154 (interactive)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1155 (let ((f) (file) (bufwin1) (bufwin2))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1156 (setq f (file-truename (car ns-input-file)))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1157 (setq ns-input-file (cdr ns-input-file))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1158 (setq file (find-file-noselect f))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1159 (setq bufwin1 (get-buffer-window file 'visible))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1160 (setq bufwin2 (get-buffer-window "*scratch*" 'visibile))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1161 (cond
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1162 (bufwin1
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1163 (select-frame (window-frame bufwin1))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1164 (raise-frame (window-frame bufwin1))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1165 (select-window bufwin1))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1166 ((and (eq ns-pop-up-frames 'fresh) bufwin2)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1167 (ns-hide-emacs 'activate)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1168 (select-frame (window-frame bufwin2))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1169 (raise-frame (window-frame bufwin2))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1170 (select-window bufwin2)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1171 (find-file f))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1172 (ns-pop-up-frames
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1173 (ns-hide-emacs 'activate)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1174 (let ((pop-up-frames t)) (pop-to-buffer file nil)))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1175 (t
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1176 (ns-hide-emacs 'activate)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1177 (find-file f)))))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1178
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1179
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1180
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1181 ;;;; Frame-related functions.
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1182
96859
2e1af3a60ab7 Standardize references to "Nextstep" in comments, messages, and docstrings.
Chong Yidong <cyd@stupidchicken.com>
parents: 96814
diff changeset
1183 ;; Don't show the frame name; that's redundant with Nextstep.
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1184 (setq-default mode-line-frame-identification '(" "))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1185
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1186 ;; You say tomAYto, I say tomAHto..
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1187 (defvaralias 'ns-option-modifier 'ns-alternate-modifier)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1188
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1189 (defun ns-do-hide-emacs ()
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1190 (interactive)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1191 (ns-hide-emacs t))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1192
96699
05aeed7284d3 Fix header format and permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 96684
diff changeset
1193 (declare-function ns-hide-others "nsfns.m" ())
05aeed7284d3 Fix header format and permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 96684
diff changeset
1194
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1195 (defun ns-do-hide-others ()
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1196 (interactive)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1197 (ns-hide-others))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1198
96699
05aeed7284d3 Fix header format and permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 96684
diff changeset
1199 (declare-function ns-emacs-info-panel "nsfns.m" ())
05aeed7284d3 Fix header format and permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 96684
diff changeset
1200
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1201 (defun ns-do-emacs-info-panel ()
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1202 (interactive)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1203 (ns-emacs-info-panel))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1204
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1205 (defun ns-next-frame ()
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1206 "Switch to next visible frame."
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1207 (interactive)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1208 (other-frame 1))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1209 (defun ns-prev-frame ()
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1210 "Switch to previous visible frame."
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1211 (interactive)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1212 (other-frame -1))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1213
96748
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
1214 ;; If no position specified, make new frame offset by 25 from current.
96767
970848353475 (parameters): Declare for compiler.
Glenn Morris <rgm@gnu.org>
parents: 96757
diff changeset
1215 (defvar parameters) ; dynamically bound in make-frame
970848353475 (parameters): Declare for compiler.
Glenn Morris <rgm@gnu.org>
parents: 96757
diff changeset
1216
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1217 (add-hook 'before-make-frame-hook
96748
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
1218 (lambda ()
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
1219 (let ((left (cdr (assq 'left (frame-parameters))))
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
1220 (top (cdr (assq 'top (frame-parameters)))))
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
1221 (if (consp left) (setq left (cadr left)))
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
1222 (if (consp top) (setq top (cadr top)))
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
1223 (cond
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
1224 ((or (assq 'top parameters) (assq 'left parameters)))
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
1225 ((or (not left) (not top)))
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
1226 (t
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
1227 (setq parameters (cons (cons 'left (+ left 25))
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
1228 (cons (cons 'top (+ top 25))
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
1229 parameters))))))))
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1230
96748
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
1231 ;; frame will be focused anyway, so select it
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1232 (add-hook 'after-make-frame-functions 'select-frame)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1233
96748
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
1234 ;; (defun ns-win-suspend-error ()
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
1235 ;; (error "Suspending an emacs running under *Step/OS X makes no sense"))
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
1236 ;; (add-hook 'suspend-hook 'ns-win-suspend-error)
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
1237 ;; (substitute-key-definition 'suspend-emacs 'iconify-or-deiconify-frame
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
1238 ;; global-map)
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1239
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1240 ;; Based on a function by David Reitter <dreitter@inf.ed.ac.uk> ;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1241 ;; see http://lists.gnu.org/archive/html/emacs-devel/2005-09/msg00681.html .
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1242 (defun ns-toggle-toolbar (&optional frame)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1243 "Switches the tool bar on and off in frame FRAME.
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1244 If FRAME is nil, the change applies to the selected frame."
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1245 (interactive)
96748
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
1246 (modify-frame-parameters
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
1247 frame (list (cons 'tool-bar-lines
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1248 (if (> (or (frame-parameter frame 'tool-bar-lines) 0) 0)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1249 0 1)) ))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1250 (if (not tool-bar-mode) (tool-bar-mode t)))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1251
96699
05aeed7284d3 Fix header format and permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 96684
diff changeset
1252 (defvar ns-cursor-blink-mode) ; nsterm.m
05aeed7284d3 Fix header format and permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 96684
diff changeset
1253
96748
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
1254 ;; Redefine from frame.el.
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1255 (define-minor-mode blink-cursor-mode
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1256 "Toggle blinking cursor mode.
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1257 With a numeric argument, turn blinking cursor mode on if ARG is positive,
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1258 otherwise turn it off. When blinking cursor mode is enabled, the
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1259 cursor of the selected window blinks.
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1260
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1261 Note that this command is effective only when Emacs
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1262 displays through a window system, because then Emacs does its own
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1263 cursor display. On a text-only terminal, this is not implemented."
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1264 :init-value (not (or noninteractive
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1265 no-blinking-cursor
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1266 (eq ns-cursor-blink-rate nil)))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1267 :initialize 'custom-initialize-safe-default
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1268 :group 'cursor
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1269 :global t
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1270 (if blink-cursor-mode
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1271 (setq ns-cursor-blink-mode t)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1272 (setq ns-cursor-blink-mode nil)))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1273
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1274
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1275
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1276 ;;;; Dialog-related functions.
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1277
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1278 ;; Ask user for confirm before printing. Due to Kevin Rodgers.
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1279 (defun ns-print-buffer ()
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1280 "Interactive front-end to `print-buffer': asks for user confirmation first."
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1281 (interactive)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1282 (if (and (interactive-p)
96748
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
1283 (or (listp last-nonmenu-event)
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
1284 (and (char-or-string-p (event-basic-type last-command-event))
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
1285 (memq 'super (event-modifiers last-command-event)))))
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
1286 (let ((last-nonmenu-event (if (listp last-nonmenu-event)
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
1287 last-nonmenu-event
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
1288 ;; Fake it:
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
1289 `(mouse-1 POSITION 1))))
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
1290 (if (y-or-n-p (format "Print buffer %s? " (buffer-name)))
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
1291 (print-buffer)
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1292 (error "Cancelled")))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1293 (print-buffer)))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1294
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1295 (defun ns-yes-or-no-p (prompt)
96859
2e1af3a60ab7 Standardize references to "Nextstep" in comments, messages, and docstrings.
Chong Yidong <cyd@stupidchicken.com>
parents: 96814
diff changeset
1296 "Ask user a \"yes or no\" question using a Nextstep graphical panel.
2e1af3a60ab7 Standardize references to "Nextstep" in comments, messages, and docstrings.
Chong Yidong <cyd@stupidchicken.com>
parents: 96814
diff changeset
1297 PROMPT is the prompt string."
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1298 (interactive)
96748
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
1299 (setq last-nonmenu-event nil)
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
1300 (yes-or-no-p prompt))
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1301
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1302
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1303 ;;;; Font support.
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1304
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1305 ;; Needed for font listing functions under both backend and normal
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1306 (setq scalable-fonts-allowed t)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1307
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1308 ;; Set to use font panel instead
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1309 (defalias 'generate-fontset-menu 'ns-popup-font-panel)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1310 (defalias 'mouse-set-font 'ns-popup-font-panel)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1311
96699
05aeed7284d3 Fix header format and permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 96684
diff changeset
1312 ;; nsterm.m
05aeed7284d3 Fix header format and permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 96684
diff changeset
1313 (defvar ns-input-font)
05aeed7284d3 Fix header format and permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 96684
diff changeset
1314 (defvar ns-input-fontsize)
05aeed7284d3 Fix header format and permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 96684
diff changeset
1315
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1316 (defun ns-respond-to-change-font ()
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1317 "Respond to changeFont: event, expecting ns-input-font and\n\
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1318 ns-input-fontsize of new font."
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1319 (interactive)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1320 (modify-frame-parameters (selected-frame)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1321 (list (cons 'font ns-input-font)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1322 (cons 'fontsize ns-input-fontsize)))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1323 (set-frame-font ns-input-font))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1324
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1325
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1326 ;; Default fontset for Mac OS X. This is mainly here to show how a fontset
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1327 ;; can be set up manually. Ordinarily, fontsets are auto-created whenever
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1328 ;; a font is chosen by
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1329 (defvar ns-standard-fontset-spec
96748
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
1330 ;; Only some code supports this so far, so use uglier XLFD version
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
1331 ;; "-ns-*-*-*-*-*-10-*-*-*-*-*-fontset-standard,latin:Courier,han:Kai"
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
1332 (mapconcat 'identity
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
1333 '("-ns-*-*-*-*-*-10-*-*-*-*-*-fontset-standard"
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
1334 "latin:-*-Courier-*-*-*-*-10-*-*-*-*-*-iso10646-1"
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
1335 "han:-*-Kai-*-*-*-*-10-*-*-*-*-*-iso10646-1"
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
1336 "cyrillic:-*-Trebuchet$MS-*-*-*-*-10-*-*-*-*-*-iso10646-1")
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
1337 ",")
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
1338 "String of fontset spec of the standard fontset.
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1339 This defines a fontset consisting of the Courier and other fonts that
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1340 come with OS X\".
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1341 See the documentation of `create-fontset-from-fontset-spec for the format.")
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1342
96748
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
1343 ;; Conditional on new-fontset so bootstrapping works on non-GUI compiles.
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1344 (if (fboundp 'new-fontset)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1345 (progn
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1346 ;; Setup the default fontset.
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1347 (setup-default-fontset)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1348 ;; Create the standard fontset.
96748
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
1349 (create-fontset-from-fontset-spec ns-standard-fontset-spec t)))
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1350
96748
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
1351 ;;(push (cons 'font "-ns-*-*-*-*-*-10-*-*-*-*-*-fontset-standard")
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
1352 ;; default-frame-alist)
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1353
96748
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
1354 ;; Add some additional scripts to var we use for fontset generation.
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1355 (setq script-representative-chars
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1356 (cons '(kana #xff8a)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1357 (cons '(symbol #x2295 #x2287 #x25a1)
96748
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
1358 script-representative-chars)))
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1359
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1360
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1361 ;;;; Pasteboard support.
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1362
96699
05aeed7284d3 Fix header format and permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 96684
diff changeset
1363 (declare-function ns-get-cut-buffer-internal "nsselect.m" (buffer))
05aeed7284d3 Fix header format and permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 96684
diff changeset
1364
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1365 (defun ns-get-pasteboard ()
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1366 "Returns the value of the pasteboard."
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1367 (ns-get-cut-buffer-internal 'PRIMARY))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1368
96699
05aeed7284d3 Fix header format and permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 96684
diff changeset
1369 (declare-function ns-store-cut-buffer-internal "nsselect.m" (buffer string))
05aeed7284d3 Fix header format and permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 96684
diff changeset
1370
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1371 (defun ns-set-pasteboard (string)
96859
2e1af3a60ab7 Standardize references to "Nextstep" in comments, messages, and docstrings.
Chong Yidong <cyd@stupidchicken.com>
parents: 96814
diff changeset
1372 "Store STRING into the pasteboard of the Nextstep display server."
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1373 ;; Check the data type of STRING.
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1374 (if (not (stringp string)) (error "Nonstring given to pasteboard"))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1375 (ns-store-cut-buffer-internal 'PRIMARY string))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1376
96748
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
1377 ;; We keep track of the last text selected here, so we can check the
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
1378 ;; current selection against it, and avoid passing back our own text
96870
30f1368d9cf6 * term/ns-win.el: Rename ns- functions/variables to the
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96859
diff changeset
1379 ;; from x-cut-buffer-or-selection-value.
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1380 (defvar ns-last-selected-text nil)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1381
96870
30f1368d9cf6 * term/ns-win.el: Rename ns- functions/variables to the
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96859
diff changeset
1382 (defun x-select-text (text &optional push)
96748
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
1383 "Put TEXT, a string, on the pasteboard."
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1384 ;; Don't send the pasteboard too much text.
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1385 ;; It becomes slow, and if really big it causes errors.
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1386 (ns-set-pasteboard text)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1387 (setq ns-last-selected-text text))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1388
96859
2e1af3a60ab7 Standardize references to "Nextstep" in comments, messages, and docstrings.
Chong Yidong <cyd@stupidchicken.com>
parents: 96814
diff changeset
1389 ;; Return the value of the current Nextstep selection. For
2e1af3a60ab7 Standardize references to "Nextstep" in comments, messages, and docstrings.
Chong Yidong <cyd@stupidchicken.com>
parents: 96814
diff changeset
1390 ;; compatibility with older Nextstep applications, this checks cut
2e1af3a60ab7 Standardize references to "Nextstep" in comments, messages, and docstrings.
Chong Yidong <cyd@stupidchicken.com>
parents: 96814
diff changeset
1391 ;; buffer 0 before retrieving the value of the primary selection.
96870
30f1368d9cf6 * term/ns-win.el: Rename ns- functions/variables to the
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96859
diff changeset
1392 (defun x-cut-buffer-or-selection-value ()
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1393 (let (text)
96757
18b856a0216f (ns-handle-switch): Simplify. Handle the numeric case.
Glenn Morris <rgm@gnu.org>
parents: 96748
diff changeset
1394
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1395 ;; Consult the selection, then the cut buffer. Treat empty strings
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1396 ;; as if they were unset.
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1397 (or text (setq text (ns-get-pasteboard)))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1398 (if (string= text "") (setq text nil))
96757
18b856a0216f (ns-handle-switch): Simplify. Handle the numeric case.
Glenn Morris <rgm@gnu.org>
parents: 96748
diff changeset
1399
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1400 (cond
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1401 ((not text) nil)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1402 ((eq text ns-last-selected-text) nil)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1403 ((string= text ns-last-selected-text)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1404 ;; Record the newer string, so subsequent calls can use the `eq' test.
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1405 (setq ns-last-selected-text text)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1406 nil)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1407 (t
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1408 (setq ns-last-selected-text text)))))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1409
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1410 (defun ns-copy-including-secondary ()
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1411 (interactive)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1412 (call-interactively 'kill-ring-save)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1413 (ns-store-cut-buffer-internal 'SECONDARY
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1414 (buffer-substring (point) (mark t))))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1415 (defun ns-paste-secondary ()
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1416 (interactive)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1417 (insert (ns-get-cut-buffer-internal 'SECONDARY)))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1418
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1419 ;; PENDING: not sure what to do here.. for now interprog- are set in
96748
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
1420 ;; init-fn-keys, and unsure whether these x- settings have an effect.
96870
30f1368d9cf6 * term/ns-win.el: Rename ns- functions/variables to the
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96859
diff changeset
1421 ;;(setq interprogram-cut-function 'x-select-text
30f1368d9cf6 * term/ns-win.el: Rename ns- functions/variables to the
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96859
diff changeset
1422 ;; interprogram-paste-function 'x-cut-buffer-or-selection-value)
96748
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
1423 ;; These only needed if above not working.
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1424
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1425 (set-face-background 'region "ns_selection_color")
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1426
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1427
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1428
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1429 ;;;; Scrollbar handling.
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1430
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1431 (global-set-key [vertical-scroll-bar down-mouse-1] 'ns-handle-scroll-bar-event)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1432 (global-unset-key [vertical-scroll-bar mouse-1])
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1433 (global-unset-key [vertical-scroll-bar drag-mouse-1])
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1434
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1435 (defun ns-scroll-bar-move (event)
96859
2e1af3a60ab7 Standardize references to "Nextstep" in comments, messages, and docstrings.
Chong Yidong <cyd@stupidchicken.com>
parents: 96814
diff changeset
1436 "Scroll the frame according to an Nextstep scroller event."
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1437 (interactive "e")
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1438 (let* ((pos (event-end event))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1439 (window (nth 0 pos))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1440 (scale (nth 2 pos)))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1441 (save-excursion
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1442 (set-buffer (window-buffer window))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1443 (cond
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1444 ((eq (car scale) (cdr scale))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1445 (goto-char (point-max)))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1446 ((= (car scale) 0)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1447 (goto-char (point-min)))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1448 (t
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1449 (goto-char (+ (point-min) 1
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1450 (scroll-bar-scale scale (- (point-max) (point-min)))))))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1451 (beginning-of-line)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1452 (set-window-start window (point))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1453 (vertical-motion (/ (window-height window) 2) window))))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1454
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1455 (defun ns-handle-scroll-bar-event (event)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1456 "Handle scroll bar EVENT to emulate Mac Toolbox style scrolling."
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1457 (interactive "e")
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1458 (let* ((position (event-start event))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1459 (bar-part (nth 4 position))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1460 (window (nth 0 position))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1461 (old-window (selected-window)))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1462 (cond
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1463 ((eq bar-part 'ratio)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1464 (ns-scroll-bar-move event))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1465 ((eq bar-part 'handle)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1466 (if (eq window (selected-window))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1467 (track-mouse (ns-scroll-bar-move event))
96748
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
1468 ;; track-mouse faster for selected window, slower for unselected.
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1469 (ns-scroll-bar-move event)))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1470 (t
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1471 (select-window window)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1472 (cond
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1473 ((eq bar-part 'up)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1474 (goto-char (window-start window))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1475 (scroll-down 1))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1476 ((eq bar-part 'above-handle)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1477 (scroll-down))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1478 ((eq bar-part 'below-handle)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1479 (scroll-up))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1480 ((eq bar-part 'down)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1481 (goto-char (window-start window))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1482 (scroll-up 1)))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1483 (select-window old-window)))))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1484
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1485
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1486 ;;;; Color support.
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1487
96699
05aeed7284d3 Fix header format and permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 96684
diff changeset
1488 (declare-function ns-list-colors "nsfns.m" (&optional frame))
05aeed7284d3 Fix header format and permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 96684
diff changeset
1489
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1490 (defvar x-colors (ns-list-colors)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1491 "The list of colors defined in non-PANTONE color files.")
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1492 (defvar colors x-colors
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1493 "The list of colors defined in non-PANTONE color files.")
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1494
96870
30f1368d9cf6 * term/ns-win.el: Rename ns- functions/variables to the
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96859
diff changeset
1495 (defun xw-defined-colors (&optional frame)
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1496 "Return a list of colors supported for a particular frame.
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1497 The argument FRAME specifies which frame to try.
96859
2e1af3a60ab7 Standardize references to "Nextstep" in comments, messages, and docstrings.
Chong Yidong <cyd@stupidchicken.com>
parents: 96814
diff changeset
1498 The value may be different for frames on different Nextstep displays."
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1499 (or frame (setq frame (selected-frame)))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1500 (let ((all-colors x-colors)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1501 (this-color nil)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1502 (defined-colors nil))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1503 (while all-colors
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1504 (setq this-color (car all-colors)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1505 all-colors (cdr all-colors))
96748
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
1506 ;; (and (face-color-supported-p frame this-color t)
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
1507 (setq defined-colors (cons this-color defined-colors))) ;;)
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1508 defined-colors))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1509
96699
05aeed7284d3 Fix header format and permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 96684
diff changeset
1510 (declare-function ns-set-alpha "nsfns.m" (color alpha))
05aeed7284d3 Fix header format and permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 96684
diff changeset
1511
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1512 ;; Convenience and work-around for fact that set color fns now require named.
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1513 (defun ns-set-background-alpha (alpha)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1514 "Sets alpha (opacity) of background.
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1515 Set from 0.0 (fully transparent) to 1.0 (fully opaque; default).
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1516 Note, tranparency works better on Tiger (10.4) and higher."
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1517 (interactive "nSet background alpha to: ")
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1518 (let ((bgcolor (cdr (assq 'background-color (frame-parameters)))))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1519 (set-frame-parameter (selected-frame)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1520 'background-color (ns-set-alpha bgcolor alpha))))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1521
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1522 ;; Functions for color panel + drag
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1523 (defun ns-face-at-pos (pos)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1524 (let* ((frame (car pos))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1525 (frame-pos (cons (cadr pos) (cddr pos)))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1526 (window (window-at (car frame-pos) (cdr frame-pos) frame))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1527 (window-pos (coordinates-in-window-p frame-pos window))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1528 (buffer (window-buffer window))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1529 (edges (window-edges window)))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1530 (cond
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1531 ((not window-pos)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1532 nil)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1533 ((eq window-pos 'mode-line)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1534 'modeline)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1535 ((eq window-pos 'vertical-line)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1536 'default)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1537 ((consp window-pos)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1538 (save-excursion
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1539 (set-buffer buffer)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1540 (let ((p (car (compute-motion (window-start window)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1541 (cons (nth 0 edges) (nth 1 edges))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1542 (window-end window)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1543 frame-pos
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1544 (- (window-width window) 1)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1545 nil
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1546 window))))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1547 (cond
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1548 ((eq p (window-point window))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1549 'cursor)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1550 ((and mark-active (< (region-beginning) p) (< p (region-end)))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1551 'region)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1552 (t
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1553 (let ((faces (get-char-property p 'face window)))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1554 (if (consp faces) (car faces) faces)))))))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1555 (t
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1556 nil))))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1557
96699
05aeed7284d3 Fix header format and permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 96684
diff changeset
1558 (defvar ns-input-color) ; nsterm.m
05aeed7284d3 Fix header format and permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 96684
diff changeset
1559
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1560 (defun ns-set-foreground-at-mouse ()
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1561 "Set the foreground color at the mouse location to ns-input-color."
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1562 (interactive)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1563 (let* ((pos (mouse-position))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1564 (frame (car pos))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1565 (face (ns-face-at-pos pos)))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1566 (cond
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1567 ((eq face 'cursor)
96699
05aeed7284d3 Fix header format and permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 96684
diff changeset
1568 (modify-frame-parameters frame (list (cons 'cursor-color
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1569 ns-input-color))))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1570 ((not face)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1571 (modify-frame-parameters frame (list (cons 'foreground-color
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1572 ns-input-color))))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1573 (t
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1574 (set-face-foreground face ns-input-color frame)))))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1575
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1576 (defun ns-set-background-at-mouse ()
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1577 "Set the background color at the mouse location to ns-input-color."
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1578 (interactive)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1579 (let* ((pos (mouse-position))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1580 (frame (car pos))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1581 (face (ns-face-at-pos pos)))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1582 (cond
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1583 ((eq face 'cursor)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1584 (modify-frame-parameters frame (list (cons 'cursor-color
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1585 ns-input-color))))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1586 ((not face)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1587 (modify-frame-parameters frame (list (cons 'background-color
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1588 ns-input-color))))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1589 (t
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1590 (set-face-background face ns-input-color frame)))))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1591
96859
2e1af3a60ab7 Standardize references to "Nextstep" in comments, messages, and docstrings.
Chong Yidong <cyd@stupidchicken.com>
parents: 96814
diff changeset
1592 ;; Set some options to be as Nextstep-like as possible.
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1593 (setq frame-title-format t
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1594 icon-title-format t)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1595
96748
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
1596 ;; Set up browser connectivity.
96699
05aeed7284d3 Fix header format and permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 96684
diff changeset
1597 (defvar browse-url-generic-program)
05aeed7284d3 Fix header format and permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 96684
diff changeset
1598
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1599 (setq browse-url-browser-function 'browse-url-generic)
96748
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
1600 (setq browse-url-generic-program
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
1601 (cond ((eq system-type 'darwin) "open")
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
1602 ;; Otherwise, GNUstep.
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
1603 (t "gopen")))
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1604
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1605
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1606 (defvar ns-initialized nil
96859
2e1af3a60ab7 Standardize references to "Nextstep" in comments, messages, and docstrings.
Chong Yidong <cyd@stupidchicken.com>
parents: 96814
diff changeset
1607 "Non-nil if Nextstep windowing has been initialized.")
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1608
96699
05aeed7284d3 Fix header format and permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 96684
diff changeset
1609 (declare-function ns-list-services "nsfns.m" ())
05aeed7284d3 Fix header format and permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 96684
diff changeset
1610
96859
2e1af3a60ab7 Standardize references to "Nextstep" in comments, messages, and docstrings.
Chong Yidong <cyd@stupidchicken.com>
parents: 96814
diff changeset
1611 ;; Do the actual Nextstep Windows setup here; the above code just
2e1af3a60ab7 Standardize references to "Nextstep" in comments, messages, and docstrings.
Chong Yidong <cyd@stupidchicken.com>
parents: 96814
diff changeset
1612 ;; defines functions and variables that we use now.
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1613 (defun ns-initialize-window-system ()
96859
2e1af3a60ab7 Standardize references to "Nextstep" in comments, messages, and docstrings.
Chong Yidong <cyd@stupidchicken.com>
parents: 96814
diff changeset
1614 "Initialize Emacs for Nextstep (Cocoa / GNUstep) windowing."
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1615
96748
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
1616 ;; PENDING: not needed?
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1617 (setq command-line-args (ns-handle-args command-line-args))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1618
96870
30f1368d9cf6 * term/ns-win.el: Rename ns- functions/variables to the
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96859
diff changeset
1619 (x-open-connection (system-name) nil t)
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1620
96748
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
1621 (dolist (service (ns-list-services))
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
1622 (if (eq (car service) 'undefined)
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
1623 (ns-define-service (cdr service))
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
1624 (define-key global-map (vector (car service))
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
1625 (ns-define-service (cdr service)))))
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1626
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1627 (if (and (eq (get-lisp-resource nil "NXAutoLaunch") t)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1628 (eq (get-lisp-resource nil "HideOnAutoLaunch") t))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1629 (add-hook 'after-init-hook 'ns-do-hide-emacs))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1630
96748
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
1631 ;; FIXME: This will surely lead to "MODIFIED OUTSIDE CUSTOM" warnings.
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1632 (menu-bar-mode (if (get-lisp-resource nil "Menus") 1 -1))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1633 (mouse-wheel-mode 1)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1634
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1635 (setq ns-initialized t))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1636
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1637 (add-to-list 'handle-args-function-alist '(ns . ns-handle-args))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1638 (add-to-list 'frame-creation-function-alist '(ns . x-create-frame-with-faces))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1639 (add-to-list 'window-system-initialization-alist '(ns . ns-initialize-window-system))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1640
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1641
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1642 (provide 'ns-win)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1643
96684
9a85c163883d Add arch tagline
Miles Bader <miles@gnu.org>
parents: 96675
diff changeset
1644 ;; arch-tag: eb138a45-4e2e-4d68-b1c9-a39665731644
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1645 ;;; ns-win.el ends here