annotate lisp/term/ns-win.el @ 111602:f44b93254721

Fix some ls-lisp oddness. * lisp/ls-lisp.el (ls-lisp-dired-ignore-case): Make it an obsolete alias.
author Glenn Morris <rgm@gnu.org>
date Wed, 10 Nov 2010 19:48:46 -0800
parents b6cf32bb07a1
children 2316b868d5be 376148b31b5e
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
106815
1d1d5d9bd884 Add 2010 to copyright years.
Glenn Morris <rgm@gnu.org>
parents: 105829
diff changeset
3 ;; Copyright (C) 1993, 1994, 2005, 2006, 2007, 2008, 2009, 2010
96805
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
101087
ffd82d2cb8ec Comments (minor fixes of some header conventions).
Glenn Morris <rgm@gnu.org>
parents: 100908
diff changeset
6 ;; Authors: Carl Edman
ffd82d2cb8ec Comments (minor fixes of some header conventions).
Glenn Morris <rgm@gnu.org>
parents: 100908
diff changeset
7 ;; Christian Limpach
ffd82d2cb8ec Comments (minor fixes of some header conventions).
Glenn Morris <rgm@gnu.org>
parents: 100908
diff changeset
8 ;; Scott Bender
ffd82d2cb8ec Comments (minor fixes of some header conventions).
Glenn Morris <rgm@gnu.org>
parents: 100908
diff changeset
9 ;; Christophe de Dinechin
ffd82d2cb8ec Comments (minor fixes of some header conventions).
Glenn Morris <rgm@gnu.org>
parents: 100908
diff changeset
10 ;; Adrian Robert
96699
05aeed7284d3 Fix header format and permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 96684
diff changeset
11 ;; Keywords: terminals
05aeed7284d3 Fix header format and permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 96684
diff changeset
12
05aeed7284d3 Fix header format and permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 96684
diff changeset
13 ;; This file is part of GNU Emacs.
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
14
96699
05aeed7284d3 Fix header format and permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 96684
diff changeset
15 ;; 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
16 ;; 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
17 ;; 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
18 ;; (at your option) any later version.
05aeed7284d3 Fix header format and permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 96684
diff changeset
19
05aeed7284d3 Fix header format and permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 96684
diff changeset
20 ;; 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
21 ;; 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
22 ;; 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
23 ;; GNU General Public License for more details.
05aeed7284d3 Fix header format and permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 96684
diff changeset
24
05aeed7284d3 Fix header format and permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 96684
diff changeset
25 ;; 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
26 ;; 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
27
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
28 ;;; Commentary:
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
29
96859
2e1af3a60ab7 Standardize references to "Nextstep" in comments, messages, and docstrings.
Chong Yidong <cyd@stupidchicken.com>
parents: 96814
diff changeset
30 ;; 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
31 ;; 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
32 ;; 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
33 ;; 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
34 ;; 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
35
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
36 ;; 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
37 ;; which create the first window (s).
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
38
96859
2e1af3a60ab7 Standardize references to "Nextstep" in comments, messages, and docstrings.
Chong Yidong <cyd@stupidchicken.com>
parents: 96814
diff changeset
39 ;; 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
40 ;; 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
41
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
42 ;;; Code:
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
43
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
44
96921
72d6895432c7 * term/ns-win.el:
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96912
diff changeset
45 (if (not (featurep 'ns))
98512
7d9a5b179102 Fix case of "GNUstep".
Glenn Morris <rgm@gnu.org>
parents: 97583
diff changeset
46 (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
47 (invocation-name)))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
48
96748
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
49 (eval-when-compile (require 'cl))
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
50
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
51 ;; Documentation-purposes only: actually loaded in loadup.el
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
52 (require 'frame)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
53 (require 'mouse)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
54 (require 'faces)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
55 (require 'easymenu)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
56 (require 'menu-bar)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
57 (require 'fontset)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
58
96748
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
59 ;; Not needed?
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
60 ;;(require 'ispell)
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
61
101783
9f9c03710f3b (ns): Define as a custom group.
Glenn Morris <rgm@gnu.org>
parents: 101741
diff changeset
62 (defgroup ns nil
9f9c03710f3b (ns): Define as a custom group.
Glenn Morris <rgm@gnu.org>
parents: 101741
diff changeset
63 "GNUstep/Mac OS X specific features."
9f9c03710f3b (ns): Define as a custom group.
Glenn Morris <rgm@gnu.org>
parents: 101741
diff changeset
64 :group 'environment)
9f9c03710f3b (ns): Define as a custom group.
Glenn Morris <rgm@gnu.org>
parents: 101741
diff changeset
65
96699
05aeed7284d3 Fix header format and permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 96684
diff changeset
66 ;; nsterm.m
05aeed7284d3 Fix header format and permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 96684
diff changeset
67 (defvar ns-version-string)
05aeed7284d3 Fix header format and permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 96684
diff changeset
68 (defvar ns-alternate-modifier)
110930
b6cf32bb07a1 Bug#7150: Distinguishing between left and right Alt keys on NextStep/OSX.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
69 (defvar ns-right-alternate-modifier)
96699
05aeed7284d3 Fix header format and permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 96684
diff changeset
70
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
71 ;;;; Command line argument handling.
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
72
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
73 (defvar ns-invocation-args nil)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
74 (defvar ns-command-line-resources nil)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
75
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
76 ;; 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
77 (defun ns-handle-switch (switch &optional numeric)
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
78 (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
79 (if aelt
96757
18b856a0216f (ns-handle-switch): Simplify. Handle the numeric case.
Glenn Morris <rgm@gnu.org>
parents: 96748
diff changeset
80 (setq default-frame-alist
18b856a0216f (ns-handle-switch): Simplify. Handle the numeric case.
Glenn Morris <rgm@gnu.org>
parents: 96748
diff changeset
81 (cons (cons (nth 3 aelt)
18b856a0216f (ns-handle-switch): Simplify. Handle the numeric case.
Glenn Morris <rgm@gnu.org>
parents: 96748
diff changeset
82 (if numeric
18b856a0216f (ns-handle-switch): Simplify. Handle the numeric case.
Glenn Morris <rgm@gnu.org>
parents: 96748
diff changeset
83 (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
84 (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
85 default-frame-alist)))))
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
86
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
87 ;; Handler for switches of the form "-switch n"
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
88 (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
89 (ns-handle-switch switch t))
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
90
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
91 ;; Make -iconic apply only to the initial frame!
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
92 (defun ns-handle-iconic (switch)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
93 (setq initial-frame-alist
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
94 (cons '(visibility . icon) initial-frame-alist)))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
95
96799
6cfed26789b7 (ns-submit-bug-report): Function removed. Bug
Chong Yidong <cyd@stupidchicken.com>
parents: 96792
diff changeset
96 ;; 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
97 (defun ns-handle-name-switch (switch)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
98 (or (consp ns-invocation-args)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
99 (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
100 (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
101 initial-frame-alist)))
18b856a0216f (ns-handle-switch): Simplify. Handle the numeric case.
Glenn Morris <rgm@gnu.org>
parents: 96748
diff changeset
102
18b856a0216f (ns-handle-switch): Simplify. Handle the numeric case.
Glenn Morris <rgm@gnu.org>
parents: 96748
diff changeset
103 ;; 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
104 (defvar x-display-name nil
104934
05d4f1d2bf6c (x-display-name, x-setup-function-keys): Unify doc-strings with X versions.
Glenn Morris <rgm@gnu.org>
parents: 104774
diff changeset
105 "The name of the window display on which Emacs was started.
05d4f1d2bf6c (x-display-name, x-setup-function-keys): Unify doc-strings with X versions.
Glenn Morris <rgm@gnu.org>
parents: 104774
diff changeset
106 On X, the display name of individual X frames is recorded in the
05d4f1d2bf6c (x-display-name, x-setup-function-keys): Unify doc-strings with X versions.
Glenn Morris <rgm@gnu.org>
parents: 104774
diff changeset
107 `display' frame parameter.")
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
108
96699
05aeed7284d3 Fix header format and permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 96684
diff changeset
109 ;; nsterm.m.
05aeed7284d3 Fix header format and permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 96684
diff changeset
110 (defvar ns-input-file)
05aeed7284d3 Fix header format and permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 96684
diff changeset
111
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
112 (defun ns-handle-nxopen (switch)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
113 (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
114 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
115
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
116 (defun ns-handle-nxopentemp (switch)
96757
18b856a0216f (ns-handle-switch): Simplify. Handle the numeric case.
Glenn Morris <rgm@gnu.org>
parents: 96748
diff changeset
117 (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
118 '(ns-open-temp-file))
18b856a0216f (ns-handle-switch): Simplify. Handle the numeric case.
Glenn Morris <rgm@gnu.org>
parents: 96748
diff changeset
119 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
120
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
121 (defun ns-ignore-1-arg (switch)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
122 (setq ns-invocation-args (cdr ns-invocation-args)))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
123 (defun ns-ignore-2-arg (switch)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
124 (setq ns-invocation-args (cddr ns-invocation-args)))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
125
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
126 (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
127 "Process Nextstep-related command line options.
96799
6cfed26789b7 (ns-submit-bug-report): Function removed. Bug
Chong Yidong <cyd@stupidchicken.com>
parents: 96792
diff changeset
128 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
129 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
130 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
131 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
132 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
133 ;; 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
134 (setq ns-invocation-args args
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
135 args nil)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
136 (while ns-invocation-args
96757
18b856a0216f (ns-handle-switch): Simplify. Handle the numeric case.
Glenn Morris <rgm@gnu.org>
parents: 96748
diff changeset
137 (let* ((this-switch (pop ns-invocation-args))
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
138 (orig-this-switch this-switch)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
139 completion argval aelt handler)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
140 ;; Check for long options with attached arguments
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
141 ;; 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
142 (if (string-match "^--[^=]*=" this-switch)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
143 (setq argval (substring this-switch (match-end 0))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
144 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
145 ;; Complete names of long options.
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
146 (if (string-match "^--" this-switch)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
147 (progn
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
148 (setq completion (try-completion this-switch
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
149 command-line-ns-option-alist))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
150 (if (eq completion t)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
151 ;; Exact match for long option.
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
152 nil
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
153 (if (stringp completion)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
154 (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
155 ;; Check for abbreviated long option.
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
156 (or elt
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
157 (error "Option `%s' is ambiguous" this-switch))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
158 (setq this-switch completion))))))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
159 (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
160 (if aelt (setq handler (nth 2 aelt)))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
161 (if handler
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
162 (if argval
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
163 (let ((ns-invocation-args
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
164 (cons argval ns-invocation-args)))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
165 (funcall handler this-switch))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
166 (funcall handler this-switch))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
167 (setq args (cons orig-this-switch args)))))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
168 (nreverse args))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
169
97447
378d7afbbe93 (ns-parse-geometry): Rename from x-parse-geometry.
Chong Yidong <cyd@stupidchicken.com>
parents: 97423
diff changeset
170 (defun ns-parse-geometry (geom)
97423
04e6451326c5 (x-parse-geometry): Doc fix.
Glenn Morris <rgm@gnu.org>
parents: 97422
diff changeset
171 "Parse a Nextstep-style geometry string GEOM.
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
172 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
173 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
174 (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
175 \\( \\([0-9]+\\) ?\\)?\\)?\\)?"
2e1af3a60ab7 Standardize references to "Nextstep" in comments, messages, and docstrings.
Chong Yidong <cyd@stupidchicken.com>
parents: 96814
diff changeset
176 geom)
2e1af3a60ab7 Standardize references to "Nextstep" in comments, messages, and docstrings.
Chong Yidong <cyd@stupidchicken.com>
parents: 96814
diff changeset
177 (apply
2e1af3a60ab7 Standardize references to "Nextstep" in comments, messages, and docstrings.
Chong Yidong <cyd@stupidchicken.com>
parents: 96814
diff changeset
178 'append
2e1af3a60ab7 Standardize references to "Nextstep" in comments, messages, and docstrings.
Chong Yidong <cyd@stupidchicken.com>
parents: 96814
diff changeset
179 (list
2e1af3a60ab7 Standardize references to "Nextstep" in comments, messages, and docstrings.
Chong Yidong <cyd@stupidchicken.com>
parents: 96814
diff changeset
180 (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
181 (if (match-string 3 geom)
2e1af3a60ab7 Standardize references to "Nextstep" in comments, messages, and docstrings.
Chong Yidong <cyd@stupidchicken.com>
parents: 96814
diff changeset
182 (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
183 (if (match-string 5 geom)
2e1af3a60ab7 Standardize references to "Nextstep" in comments, messages, and docstrings.
Chong Yidong <cyd@stupidchicken.com>
parents: 96814
diff changeset
184 (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
185 (if (match-string 7 geom)
2e1af3a60ab7 Standardize references to "Nextstep" in comments, messages, and docstrings.
Chong Yidong <cyd@stupidchicken.com>
parents: 96814
diff changeset
186 (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
187
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
188 ;;;; Keyboard mapping.
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
189
97541
33164d8e9921 Uncomment 'put backspace ascii-character...' and friends, they are needed for tramp.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 97447
diff changeset
190 ;; These tell read-char how to convert these special chars to ASCII.
33164d8e9921 Uncomment 'put backspace ascii-character...' and friends, they are needed for tramp.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 97447
diff changeset
191 (put 'S-tab 'ascii-character (logior 16 ?\t))
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
192
97348
bf45b2dcafff * startup.el (command-line-ns-option-alist): Use ignore instead of ns-ignore-0-arg. * term/ns-win.el (ns-ignore-0-arg, mouse-extend-region) (ns-win-suspend-error, ns-yes-or-no-p, colors): Drop. (ns-alternatives-map): New variable. (x-set-up-function-keys): Use it. (global): Comment out 'put backspace ascii-character...' and friends. Move function-key-map into ns-alternatives-map. Don't call precompute-menubar-bindings. Don't set anything connected with browse-url. (after-make-frame-functions): Clarify comment why a hook is added.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 97279
diff changeset
193 (defvar ns-alternatives-map
bf45b2dcafff * startup.el (command-line-ns-option-alist): Use ignore instead of ns-ignore-0-arg. * term/ns-win.el (ns-ignore-0-arg, mouse-extend-region) (ns-win-suspend-error, ns-yes-or-no-p, colors): Drop. (ns-alternatives-map): New variable. (x-set-up-function-keys): Use it. (global): Comment out 'put backspace ascii-character...' and friends. Move function-key-map into ns-alternatives-map. Don't call precompute-menubar-bindings. Don't set anything connected with browse-url. (after-make-frame-functions): Clarify comment why a hook is added.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 97279
diff changeset
194 (let ((map (make-sparse-keymap)))
bf45b2dcafff * startup.el (command-line-ns-option-alist): Use ignore instead of ns-ignore-0-arg. * term/ns-win.el (ns-ignore-0-arg, mouse-extend-region) (ns-win-suspend-error, ns-yes-or-no-p, colors): Drop. (ns-alternatives-map): New variable. (x-set-up-function-keys): Use it. (global): Comment out 'put backspace ascii-character...' and friends. Move function-key-map into ns-alternatives-map. Don't call precompute-menubar-bindings. Don't set anything connected with browse-url. (after-make-frame-functions): Clarify comment why a hook is added.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 97279
diff changeset
195 ;; Map certain keypad keys into ASCII characters
bf45b2dcafff * startup.el (command-line-ns-option-alist): Use ignore instead of ns-ignore-0-arg. * term/ns-win.el (ns-ignore-0-arg, mouse-extend-region) (ns-win-suspend-error, ns-yes-or-no-p, colors): Drop. (ns-alternatives-map): New variable. (x-set-up-function-keys): Use it. (global): Comment out 'put backspace ascii-character...' and friends. Move function-key-map into ns-alternatives-map. Don't call precompute-menubar-bindings. Don't set anything connected with browse-url. (after-make-frame-functions): Clarify comment why a hook is added.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 97279
diff changeset
196 ;; that people usually expect.
bf45b2dcafff * startup.el (command-line-ns-option-alist): Use ignore instead of ns-ignore-0-arg. * term/ns-win.el (ns-ignore-0-arg, mouse-extend-region) (ns-win-suspend-error, ns-yes-or-no-p, colors): Drop. (ns-alternatives-map): New variable. (x-set-up-function-keys): Use it. (global): Comment out 'put backspace ascii-character...' and friends. Move function-key-map into ns-alternatives-map. Don't call precompute-menubar-bindings. Don't set anything connected with browse-url. (after-make-frame-functions): Clarify comment why a hook is added.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 97279
diff changeset
197 (define-key map [S-tab] [25])
bf45b2dcafff * startup.el (command-line-ns-option-alist): Use ignore instead of ns-ignore-0-arg. * term/ns-win.el (ns-ignore-0-arg, mouse-extend-region) (ns-win-suspend-error, ns-yes-or-no-p, colors): Drop. (ns-alternatives-map): New variable. (x-set-up-function-keys): Use it. (global): Comment out 'put backspace ascii-character...' and friends. Move function-key-map into ns-alternatives-map. Don't call precompute-menubar-bindings. Don't set anything connected with browse-url. (after-make-frame-functions): Clarify comment why a hook is added.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 97279
diff changeset
198 (define-key map [M-backspace] [?\M-\d])
bf45b2dcafff * startup.el (command-line-ns-option-alist): Use ignore instead of ns-ignore-0-arg. * term/ns-win.el (ns-ignore-0-arg, mouse-extend-region) (ns-win-suspend-error, ns-yes-or-no-p, colors): Drop. (ns-alternatives-map): New variable. (x-set-up-function-keys): Use it. (global): Comment out 'put backspace ascii-character...' and friends. Move function-key-map into ns-alternatives-map. Don't call precompute-menubar-bindings. Don't set anything connected with browse-url. (after-make-frame-functions): Clarify comment why a hook is added.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 97279
diff changeset
199 (define-key map [M-delete] [?\M-\d])
bf45b2dcafff * startup.el (command-line-ns-option-alist): Use ignore instead of ns-ignore-0-arg. * term/ns-win.el (ns-ignore-0-arg, mouse-extend-region) (ns-win-suspend-error, ns-yes-or-no-p, colors): Drop. (ns-alternatives-map): New variable. (x-set-up-function-keys): Use it. (global): Comment out 'put backspace ascii-character...' and friends. Move function-key-map into ns-alternatives-map. Don't call precompute-menubar-bindings. Don't set anything connected with browse-url. (after-make-frame-functions): Clarify comment why a hook is added.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 97279
diff changeset
200 (define-key map [M-tab] [?\M-\t])
bf45b2dcafff * startup.el (command-line-ns-option-alist): Use ignore instead of ns-ignore-0-arg. * term/ns-win.el (ns-ignore-0-arg, mouse-extend-region) (ns-win-suspend-error, ns-yes-or-no-p, colors): Drop. (ns-alternatives-map): New variable. (x-set-up-function-keys): Use it. (global): Comment out 'put backspace ascii-character...' and friends. Move function-key-map into ns-alternatives-map. Don't call precompute-menubar-bindings. Don't set anything connected with browse-url. (after-make-frame-functions): Clarify comment why a hook is added.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 97279
diff changeset
201 (define-key map [M-linefeed] [?\M-\n])
bf45b2dcafff * startup.el (command-line-ns-option-alist): Use ignore instead of ns-ignore-0-arg. * term/ns-win.el (ns-ignore-0-arg, mouse-extend-region) (ns-win-suspend-error, ns-yes-or-no-p, colors): Drop. (ns-alternatives-map): New variable. (x-set-up-function-keys): Use it. (global): Comment out 'put backspace ascii-character...' and friends. Move function-key-map into ns-alternatives-map. Don't call precompute-menubar-bindings. Don't set anything connected with browse-url. (after-make-frame-functions): Clarify comment why a hook is added.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 97279
diff changeset
202 (define-key map [M-clear] [?\M-\C-l])
bf45b2dcafff * startup.el (command-line-ns-option-alist): Use ignore instead of ns-ignore-0-arg. * term/ns-win.el (ns-ignore-0-arg, mouse-extend-region) (ns-win-suspend-error, ns-yes-or-no-p, colors): Drop. (ns-alternatives-map): New variable. (x-set-up-function-keys): Use it. (global): Comment out 'put backspace ascii-character...' and friends. Move function-key-map into ns-alternatives-map. Don't call precompute-menubar-bindings. Don't set anything connected with browse-url. (after-make-frame-functions): Clarify comment why a hook is added.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 97279
diff changeset
203 (define-key map [M-return] [?\M-\C-m])
bf45b2dcafff * startup.el (command-line-ns-option-alist): Use ignore instead of ns-ignore-0-arg. * term/ns-win.el (ns-ignore-0-arg, mouse-extend-region) (ns-win-suspend-error, ns-yes-or-no-p, colors): Drop. (ns-alternatives-map): New variable. (x-set-up-function-keys): Use it. (global): Comment out 'put backspace ascii-character...' and friends. Move function-key-map into ns-alternatives-map. Don't call precompute-menubar-bindings. Don't set anything connected with browse-url. (after-make-frame-functions): Clarify comment why a hook is added.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 97279
diff changeset
204 (define-key map [M-escape] [?\M-\e])
bf45b2dcafff * startup.el (command-line-ns-option-alist): Use ignore instead of ns-ignore-0-arg. * term/ns-win.el (ns-ignore-0-arg, mouse-extend-region) (ns-win-suspend-error, ns-yes-or-no-p, colors): Drop. (ns-alternatives-map): New variable. (x-set-up-function-keys): Use it. (global): Comment out 'put backspace ascii-character...' and friends. Move function-key-map into ns-alternatives-map. Don't call precompute-menubar-bindings. Don't set anything connected with browse-url. (after-make-frame-functions): Clarify comment why a hook is added.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 97279
diff changeset
205 map)
103140
ba681b91f716 * term/ns-win.el (ns-alternatives-map, ns-insert-working-text)
Juanma Barranquero <lekktu@gmail.com>
parents: 103122
diff changeset
206 "Keymap of alternative meanings for some keys under Nextstep.")
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
207
96859
2e1af3a60ab7 Standardize references to "Nextstep" in comments, messages, and docstrings.
Chong Yidong <cyd@stupidchicken.com>
parents: 96814
diff changeset
208 ;; Here are some Nextstep-like bindings for command key sequences.
102771
15dc97800b2f (ns-expand-space): remove defvar.
David Reitter <david.reitter@gmail.com>
parents: 102641
diff changeset
209 (define-key global-map [?\s-,] 'customize)
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
210 (define-key global-map [?\s-'] 'next-multiframe-window)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
211 (define-key global-map [?\s-`] 'other-frame)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
212 (define-key global-map [?\s--] 'center-line)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
213 (define-key global-map [?\s-:] 'ispell)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
214 (define-key global-map [?\s-\;] 'ispell-next)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
215 (define-key global-map [?\s-?] 'info)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
216 (define-key global-map [?\s-^] 'kill-some-buffers)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
217 (define-key global-map [?\s-&] 'kill-this-buffer)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
218 (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
219 (define-key global-map [?\s-D] 'dired)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
220 (define-key global-map [?\s-E] 'edit-abbrevs)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
221 (define-key global-map [?\s-L] 'shell-command)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
222 (define-key global-map [?\s-M] 'manual-entry)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
223 (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
224 (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
225 (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
226 (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
227 (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
228 (define-key global-map [?\s-f] 'isearch-forward)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
229 (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
230 (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
231 (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
232 (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
233 (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
234 (define-key global-map [?\s-l] 'goto-line)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
235 (define-key global-map [?\s-m] 'iconify-frame)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
236 (define-key global-map [?\s-n] 'make-frame)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
237 (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
238 (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
239 (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
240 (define-key global-map [?\s-s] 'save-buffer)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
241 (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
242 (define-key global-map [?\s-u] 'revert-buffer)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
243 (define-key global-map [?\s-v] 'yank)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
244 (define-key global-map [?\s-w] 'delete-frame)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
245 (define-key global-map [?\s-x] 'kill-region)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
246 (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
247 (define-key global-map [?\s-z] 'undo)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
248 (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
249 (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
250 ;; (as in Terminal.app)
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
251 (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
252 (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
253
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
254 (define-key global-map [home] 'beginning-of-buffer)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
255 (define-key global-map [end] 'end-of-buffer)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
256 (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
257 (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
258 (define-key global-map [kp-prior] 'scroll-down)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
259 (define-key global-map [kp-next] 'scroll-up)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
260
97348
bf45b2dcafff * startup.el (command-line-ns-option-alist): Use ignore instead of ns-ignore-0-arg. * term/ns-win.el (ns-ignore-0-arg, mouse-extend-region) (ns-win-suspend-error, ns-yes-or-no-p, colors): Drop. (ns-alternatives-map): New variable. (x-set-up-function-keys): Use it. (global): Comment out 'put backspace ascii-character...' and friends. Move function-key-map into ns-alternatives-map. Don't call precompute-menubar-bindings. Don't set anything connected with browse-url. (after-make-frame-functions): Clarify comment why a hook is added.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 97279
diff changeset
261 ;;; Allow shift-clicks to work similarly to under Nextstep
bf45b2dcafff * startup.el (command-line-ns-option-alist): Use ignore instead of ns-ignore-0-arg. * term/ns-win.el (ns-ignore-0-arg, mouse-extend-region) (ns-win-suspend-error, ns-yes-or-no-p, colors): Drop. (ns-alternatives-map): New variable. (x-set-up-function-keys): Use it. (global): Comment out 'put backspace ascii-character...' and friends. Move function-key-map into ns-alternatives-map. Don't call precompute-menubar-bindings. Don't set anything connected with browse-url. (after-make-frame-functions): Clarify comment why a hook is added.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 97279
diff changeset
262 (define-key global-map [S-mouse-1] 'mouse-save-then-kill)
bf45b2dcafff * startup.el (command-line-ns-option-alist): Use ignore instead of ns-ignore-0-arg. * term/ns-win.el (ns-ignore-0-arg, mouse-extend-region) (ns-win-suspend-error, ns-yes-or-no-p, colors): Drop. (ns-alternatives-map): New variable. (x-set-up-function-keys): Use it. (global): Comment out 'put backspace ascii-character...' and friends. Move function-key-map into ns-alternatives-map. Don't call precompute-menubar-bindings. Don't set anything connected with browse-url. (after-make-frame-functions): Clarify comment why a hook is added.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 97279
diff changeset
263 (global-unset-key [S-down-mouse-1])
bf45b2dcafff * startup.el (command-line-ns-option-alist): Use ignore instead of ns-ignore-0-arg. * term/ns-win.el (ns-ignore-0-arg, mouse-extend-region) (ns-win-suspend-error, ns-yes-or-no-p, colors): Drop. (ns-alternatives-map): New variable. (x-set-up-function-keys): Use it. (global): Comment out 'put backspace ascii-character...' and friends. Move function-key-map into ns-alternatives-map. Don't call precompute-menubar-bindings. Don't set anything connected with browse-url. (after-make-frame-functions): Clarify comment why a hook is added.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 97279
diff changeset
264
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
265
96859
2e1af3a60ab7 Standardize references to "Nextstep" in comments, messages, and docstrings.
Chong Yidong <cyd@stupidchicken.com>
parents: 96814
diff changeset
266 ;; 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
267 ;; are the bindings for them.
102560
291f6c889881 Unify shutdown handling under NS, via ns-power-off key event (where appropriate) and save-buffers-kill-emacs.
David Reitter <david.reitter@gmail.com>
parents: 102253
diff changeset
268 (define-key global-map [ns-power-off] 'save-buffers-kill-emacs)
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
269 (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
270 (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
271 (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
272 (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
273 (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
274 (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
275 (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
276 (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
277 (define-key global-map [ns-spi-service-call] 'ns-spi-service-call)
97279
76ed169d532c Dock menu customization, based on a patch by Ken Raeburn, plus some other fixes.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 97044
diff changeset
278 (define-key global-map [ns-new-frame] 'make-frame)
101491
305655dc1e3a * term/ns-win.el (ns-insert-working-text, ns-delete-working-text):
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 101427
diff changeset
279 (define-key global-map [ns-toggle-toolbar] 'ns-toggle-toolbar)
102560
291f6c889881 Unify shutdown handling under NS, via ns-power-off key event (where appropriate) and save-buffers-kill-emacs.
David Reitter <david.reitter@gmail.com>
parents: 102253
diff changeset
280 (define-key global-map [ns-show-prefs] 'customize)
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
281
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
282
96788
c4b6acf322cc Contents of ns-carbon-compat.el moved here.
Chong Yidong <cyd@stupidchicken.com>
parents: 96767
diff changeset
283 ;; 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
284 ;; the Choi/Mitsuharu Carbon port.
c4b6acf322cc Contents of ns-carbon-compat.el moved here.
Chong Yidong <cyd@stupidchicken.com>
parents: 96767
diff changeset
285
c4b6acf322cc Contents of ns-carbon-compat.el moved here.
Chong Yidong <cyd@stupidchicken.com>
parents: 96767
diff changeset
286 (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
287 (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
288 (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
289 (defvaralias 'mac-option-modifier 'ns-option-modifier)
110930
b6cf32bb07a1 Bug#7150: Distinguishing between left and right Alt keys on NextStep/OSX.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
290 (defvaralias 'mac-right-option-modifier 'ns-right-option-modifier)
96788
c4b6acf322cc Contents of ns-carbon-compat.el moved here.
Chong Yidong <cyd@stupidchicken.com>
parents: 96767
diff changeset
291 (defvaralias 'mac-function-modifier 'ns-function-modifier)
99588
a61ecfde8504 (ns-do-applescript, ns-popup-font-panel): Declare.
Glenn Morris <rgm@gnu.org>
parents: 98512
diff changeset
292 (declare-function ns-do-applescript "nsfns.m" (script))
97044
68cf271f3d30 rename do-applescript,do_applescript in keeping with NS code conventions
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 97042
diff changeset
293 (defalias 'do-applescript 'ns-do-applescript)
68cf271f3d30 rename do-applescript,do_applescript in keeping with NS code conventions
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 97042
diff changeset
294
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
295 (defun x-setup-function-keys (frame)
104934
05d4f1d2bf6c (x-display-name, x-setup-function-keys): Unify doc-strings with X versions.
Glenn Morris <rgm@gnu.org>
parents: 104774
diff changeset
296 "Set up `function-key-map' on the graphical frame FRAME."
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
297 (unless (terminal-parameter frame 'x-setup-function-keys)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
298 (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
299 (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
300 interprogram-paste-function 'x-cut-buffer-or-selection-value)
97348
bf45b2dcafff * startup.el (command-line-ns-option-alist): Use ignore instead of ns-ignore-0-arg. * term/ns-win.el (ns-ignore-0-arg, mouse-extend-region) (ns-win-suspend-error, ns-yes-or-no-p, colors): Drop. (ns-alternatives-map): New variable. (x-set-up-function-keys): Use it. (global): Comment out 'put backspace ascii-character...' and friends. Move function-key-map into ns-alternatives-map. Don't call precompute-menubar-bindings. Don't set anything connected with browse-url. (after-make-frame-functions): Clarify comment why a hook is added.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 97279
diff changeset
301 (let ((map (copy-keymap ns-alternatives-map)))
bf45b2dcafff * startup.el (command-line-ns-option-alist): Use ignore instead of ns-ignore-0-arg. * term/ns-win.el (ns-ignore-0-arg, mouse-extend-region) (ns-win-suspend-error, ns-yes-or-no-p, colors): Drop. (ns-alternatives-map): New variable. (x-set-up-function-keys): Use it. (global): Comment out 'put backspace ascii-character...' and friends. Move function-key-map into ns-alternatives-map. Don't call precompute-menubar-bindings. Don't set anything connected with browse-url. (after-make-frame-functions): Clarify comment why a hook is added.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 97279
diff changeset
302 (set-keymap-parent map (keymap-parent local-function-key-map))
bf45b2dcafff * startup.el (command-line-ns-option-alist): Use ignore instead of ns-ignore-0-arg. * term/ns-win.el (ns-ignore-0-arg, mouse-extend-region) (ns-win-suspend-error, ns-yes-or-no-p, colors): Drop. (ns-alternatives-map): New variable. (x-set-up-function-keys): Use it. (global): Comment out 'put backspace ascii-character...' and friends. Move function-key-map into ns-alternatives-map. Don't call precompute-menubar-bindings. Don't set anything connected with browse-url. (after-make-frame-functions): Clarify comment why a hook is added.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 97279
diff changeset
303 (set-keymap-parent local-function-key-map map))
96748
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
304 (setq system-key-alist
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
305 (list
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
306 (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
307 (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
308 (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
309 (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
310 (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
311 (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
312 (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
313 (cons (logior (lsh 0 16) 8) 'ns-open-file-line)
101491
305655dc1e3a * term/ns-win.el (ns-insert-working-text, ns-delete-working-text):
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 101427
diff changeset
314 ; (cons (logior (lsh 0 16) 9) 'ns-insert-working-text)
305655dc1e3a * term/ns-win.el (ns-insert-working-text, ns-delete-working-text):
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 101427
diff changeset
315 ; (cons (logior (lsh 0 16) 10) 'ns-delete-working-text)
96748
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
316 (cons (logior (lsh 0 16) 11) 'ns-spi-service-call)
102771
15dc97800b2f (ns-expand-space): remove defvar.
David Reitter <david.reitter@gmail.com>
parents: 102641
diff changeset
317 (cons (logior (lsh 0 16) 12) 'ns-new-frame)
15dc97800b2f (ns-expand-space): remove defvar.
David Reitter <david.reitter@gmail.com>
parents: 102641
diff changeset
318 (cons (logior (lsh 0 16) 13) 'ns-toggle-toolbar)
15dc97800b2f (ns-expand-space): remove defvar.
David Reitter <david.reitter@gmail.com>
parents: 102641
diff changeset
319 (cons (logior (lsh 0 16) 14) 'ns-show-prefs)
15dc97800b2f (ns-expand-space): remove defvar.
David Reitter <david.reitter@gmail.com>
parents: 102641
diff changeset
320 (cons (logior (lsh 1 16) 32) 'f1)
96748
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
321 (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
322 (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
323 (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
324 (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
325 (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
326 (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
327 (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
328 (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
329 (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
330 (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
331 (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
332 (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
333 (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
334 (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
335 (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
336 (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
337 (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
338 (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
339 (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
340 (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
341 (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
342 (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
343 (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
344 (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
345 (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
346 (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
347 (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
348 (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
349 (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
350 (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
351 (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
352 (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
353 (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
354 (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
355 (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
356 (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
357 (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
358 (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
359 (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
360 (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
361 (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
362 (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
363 (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
364 (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
365 (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
366 (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
367 (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
368 (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
369 (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
370 (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
371 (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
372 (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
373 (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
374 (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
375 (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
376 (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
377 (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
378 (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
379 (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
380 (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
381 (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
382 (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
383 (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
384 (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
385 (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
386 (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
387 (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
388 (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
389 (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
390 (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
391 (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
392 (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
393 (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
394 (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
395 (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
396 (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
397 (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
398 (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
399 (cons (logior (lsh 3 16) 127) 'delete)
97348
bf45b2dcafff * startup.el (command-line-ns-option-alist): Use ignore instead of ns-ignore-0-arg. * term/ns-win.el (ns-ignore-0-arg, mouse-extend-region) (ns-win-suspend-error, ns-yes-or-no-p, colors): Drop. (ns-alternatives-map): New variable. (x-set-up-function-keys): Use it. (global): Comment out 'put backspace ascii-character...' and friends. Move function-key-map into ns-alternatives-map. Don't call precompute-menubar-bindings. Don't set anything connected with browse-url. (after-make-frame-functions): Clarify comment why a hook is added.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 97279
diff changeset
400 )))
bf45b2dcafff * startup.el (command-line-ns-option-alist): Use ignore instead of ns-ignore-0-arg. * term/ns-win.el (ns-ignore-0-arg, mouse-extend-region) (ns-win-suspend-error, ns-yes-or-no-p, colors): Drop. (ns-alternatives-map): New variable. (x-set-up-function-keys): Use it. (global): Comment out 'put backspace ascii-character...' and friends. Move function-key-map into ns-alternatives-map. Don't call precompute-menubar-bindings. Don't set anything connected with browse-url. (after-make-frame-functions): Clarify comment why a hook is added.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 97279
diff changeset
401 (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
402
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
403
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
404 ;; 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
405 ;; 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
406 (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
407
96748
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
408 (setq menu-bar-final-items
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
409 (cond ((eq system-type 'darwin)
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
410 '(buffer windows services help-menu))
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
411 ;; Otherwise, GNUstep.
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
412 (t
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
413 '(buffer windows services hide-app quit))))
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
414
96748
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
415 ;; 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
416 (unless (eq system-type 'darwin)
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
417 (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
418 (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
419
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
420 (define-key global-map [menu-bar services]
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
421 (cons "Services" (make-sparse-keymap "Services")))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
422 (define-key global-map [menu-bar buffer]
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
423 (cons "Buffers" global-buffers-menu-map))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
424 ;; (cons "Buffers" (make-sparse-keymap "Buffers")))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
425 (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
426 (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
427 (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
428 (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
429
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
430 ;; If running under GNUstep, rename "Help" to "Info"
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
431 (cond ((eq system-type 'darwin)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
432 (define-key global-map [menu-bar help-menu]
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
433 (cons "Help" menu-bar-help-menu)))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
434 (t
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
435 (let ((contents (reverse (cdr menu-bar-help-menu))))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
436 (setq menu-bar-help-menu
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
437 (append (list 'keymap) (cdr contents) (list "Info"))))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
438 (define-key global-map [menu-bar help-menu]
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
439 (cons "Info" menu-bar-help-menu))))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
440
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
441 (if (not (eq system-type 'darwin))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
442 ;; 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
443 (define-key menu-bar-help-menu [info-panel]
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
444 '("About Emacs..." . ns-do-emacs-info-panel)))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
445
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
446 ;;;; Edit menu: Modify slightly
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
447
96748
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
448 ;; 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
449 (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
450 (define-key-after menu-bar-edit-menu [copy]
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
451 '(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
452 :enable mark-active
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
453 :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
454 'cut)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
455
96748
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
456 ;; 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
457 ;; `x-selection-exists-p'.
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
458 (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
459 (define-key-after menu-bar-edit-menu [paste]
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
460 '(menu-item "Paste" yank
96748
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
461 :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
462 :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
463 'copy)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
464
96748
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
465 ;; 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
466 (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
467 (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
468 '(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
469 :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
470 :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
471 'paste)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
472
96748
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
473 ;; 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
474 (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
475 (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
476
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
477
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
478 ;;;; Services
96757
18b856a0216f (ns-handle-switch): Simplify. Handle the numeric case.
Glenn Morris <rgm@gnu.org>
parents: 96748
diff changeset
479 (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
480
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
481 (defun ns-define-service (path)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
482 (let ((mapping [menu-bar services])
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
483 (service (mapconcat 'identity path "/"))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
484 (name (intern
96748
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
485 (subst-char-in-string
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
486 ?\s ?-
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
487 (mapconcat 'identity (cons "ns-service" path) "-")))))
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
488 ;; This defines the function.
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
489 (defalias name
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
490 (lexical-let ((service service))
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
491 (lambda (arg)
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
492 (interactive "p")
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
493 (let* ((in-string
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
494 (cond ((stringp arg) arg)
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
495 (mark-active
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
496 (buffer-substring (region-beginning) (region-end)))))
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
497 (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
498 (cond
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
499 ((stringp arg) out-string)
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
500 ((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
501 (not (string= in-string out-string))))
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
502 (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
503 (insert out-string)
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
504 (setq deactivate-mark nil)))))))
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
505 (cond
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
506 ((lookup-key global-map mapping)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
507 (while (cdr path)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
508 (setq mapping (vconcat mapping (list (intern (car path)))))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
509 (if (not (keymapp (lookup-key global-map mapping)))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
510 (define-key global-map mapping
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
511 (cons (car path) (make-sparse-keymap (car path)))))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
512 (setq path (cdr path)))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
513 (setq mapping (vconcat mapping (list (intern (car path)))))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
514 (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
515 name))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
516
96699
05aeed7284d3 Fix header format and permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 96684
diff changeset
517 ;; nsterm.m
05aeed7284d3 Fix header format and permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 96684
diff changeset
518 (defvar ns-input-spi-name)
05aeed7284d3 Fix header format and permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 96684
diff changeset
519 (defvar ns-input-spi-arg)
05aeed7284d3 Fix header format and permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 96684
diff changeset
520
97422
6e551caf98f6 Add declarations for builds without X.
Glenn Morris <rgm@gnu.org>
parents: 97348
diff changeset
521 (declare-function dnd-open-file "dnd" (uri action))
6e551caf98f6 Add declarations for builds without X.
Glenn Morris <rgm@gnu.org>
parents: 97348
diff changeset
522
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
523 (defun ns-spi-service-call ()
96799
6cfed26789b7 (ns-submit-bug-report): Function removed. Bug
Chong Yidong <cyd@stupidchicken.com>
parents: 96792
diff changeset
524 "Respond to a service request."
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
525 (interactive)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
526 (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
527 (switch-to-buffer (generate-new-buffer "*untitled*"))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
528 (insert ns-input-spi-arg))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
529 ((string-equal ns-input-spi-name "open-file")
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
530 (dnd-open-file ns-input-spi-arg nil))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
531 ((string-equal ns-input-spi-name "mail-selection")
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
532 (compose-mail)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
533 (rfc822-goto-eoh)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
534 (forward-line 1)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
535 (insert ns-input-spi-arg))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
536 ((string-equal ns-input-spi-name "mail-to")
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
537 (compose-mail ns-input-spi-arg))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
538 (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
539
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
540
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
541 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
542
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
543
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
544
102253
8a3d30f9b513 (ns-working-overlay): Don't make it buffer-local.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 101783
diff changeset
545 ;; Composed key sequence handling for Nextstep system input methods.
8a3d30f9b513 (ns-working-overlay): Don't make it buffer-local.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 101783
diff changeset
546 ;; (On Nextstep systems, input methods are provided for CJK
8a3d30f9b513 (ns-working-overlay): Don't make it buffer-local.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 101783
diff changeset
547 ;; characters, etc. which require multiple keystrokes, and during
8a3d30f9b513 (ns-working-overlay): Don't make it buffer-local.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 101783
diff changeset
548 ;; entry a partial ("working") result is typically shown in the
8a3d30f9b513 (ns-working-overlay): Don't make it buffer-local.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 101783
diff changeset
549 ;; editing window.)
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
550
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
551 (defface ns-working-text-face
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
552 '((t :underline t))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
553 "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
554 :group 'ns)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
555
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
556 (defvar ns-working-overlay nil
102253
8a3d30f9b513 (ns-working-overlay): Don't make it buffer-local.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 101783
diff changeset
557 "Overlay used to highlight working text during compose sequence insert.
8a3d30f9b513 (ns-working-overlay): Don't make it buffer-local.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 101783
diff changeset
558 When text is in th echo area, this just stores the length of the working text.")
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
559
101491
305655dc1e3a * term/ns-win.el (ns-insert-working-text, ns-delete-working-text):
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 101427
diff changeset
560 (defvar ns-working-text) ; nsterm.m
305655dc1e3a * term/ns-win.el (ns-insert-working-text, ns-delete-working-text):
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 101427
diff changeset
561
305655dc1e3a * term/ns-win.el (ns-insert-working-text, ns-delete-working-text):
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 101427
diff changeset
562 ;; Test if in echo area, based on mac-win.el 2007/08/26 unicode-2.
305655dc1e3a * term/ns-win.el (ns-insert-working-text, ns-delete-working-text):
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 101427
diff changeset
563 ;; This will fail if called from a NONASCII_KEYSTROKE event on the global map.
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
564 (defun ns-in-echo-area ()
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
565 "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
566 is currently being used."
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
567 (or isearch-mode
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
568 (and cursor-in-echo-area (current-message))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
569 ;; Overlay strings are not shown in some cases.
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
570 (get-char-property (point) 'invisible)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
571 (and (not (bobp))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
572 (or (and (get-char-property (point) 'display)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
573 (eq (get-char-property (1- (point)) 'display)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
574 (get-char-property (point) 'display)))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
575 (and (get-char-property (point) 'composition)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
576 (eq (get-char-property (1- (point)) 'composition)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
577 (get-char-property (point) 'composition)))))))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
578
101401
93936c347fa1 * term/ns-win.el (ns-insert-working-text, ns-put-working-text): Switch names and update comments for clarity.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 101354
diff changeset
579 ;; The 'interactive' here stays for subinvocations, so the ns-in-echo-area
93936c347fa1 * term/ns-win.el (ns-insert-working-text, ns-put-working-text): Switch names and update comments for clarity.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 101354
diff changeset
580 ;; always returns nil for some reason. If this WASN'T the case, we could
93936c347fa1 * term/ns-win.el (ns-insert-working-text, ns-put-working-text): Switch names and update comments for clarity.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 101354
diff changeset
581 ;; map this to [ns-insert-working-text] and eliminate Fevals in nsterm.m.
101491
305655dc1e3a * term/ns-win.el (ns-insert-working-text, ns-delete-working-text):
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 101427
diff changeset
582 ;; These functions test whether in echo area and delegate accordingly.
101401
93936c347fa1 * term/ns-win.el (ns-insert-working-text, ns-put-working-text): Switch names and update comments for clarity.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 101354
diff changeset
583 (defun ns-put-working-text ()
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
584 (interactive)
101401
93936c347fa1 * term/ns-win.el (ns-insert-working-text, ns-put-working-text): Switch names and update comments for clarity.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 101354
diff changeset
585 (if (ns-in-echo-area) (ns-echo-working-text) (ns-insert-working-text)))
101491
305655dc1e3a * term/ns-win.el (ns-insert-working-text, ns-delete-working-text):
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 101427
diff changeset
586 (defun ns-unput-working-text ()
305655dc1e3a * term/ns-win.el (ns-insert-working-text, ns-delete-working-text):
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 101427
diff changeset
587 (interactive)
102253
8a3d30f9b513 (ns-working-overlay): Don't make it buffer-local.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 101783
diff changeset
588 (ns-delete-working-text))
96699
05aeed7284d3 Fix header format and permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 96684
diff changeset
589
101401
93936c347fa1 * term/ns-win.el (ns-insert-working-text, ns-put-working-text): Switch names and update comments for clarity.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 101354
diff changeset
590 (defun ns-insert-working-text ()
103140
ba681b91f716 * term/ns-win.el (ns-alternatives-map, ns-insert-working-text)
Juanma Barranquero <lekktu@gmail.com>
parents: 103122
diff changeset
591 "Insert contents of `ns-working-text' as UTF-8 string and mark with
102253
8a3d30f9b513 (ns-working-overlay): Don't make it buffer-local.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 101783
diff changeset
592 `ns-working-overlay'. Any previously existing working text is cleared first.
8a3d30f9b513 (ns-working-overlay): Don't make it buffer-local.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 101783
diff changeset
593 The overlay is assigned the face `ns-working-text-face'."
8a3d30f9b513 (ns-working-overlay): Don't make it buffer-local.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 101783
diff changeset
594 ;; FIXME: if buffer is read-only, don't try to insert anything
8a3d30f9b513 (ns-working-overlay): Don't make it buffer-local.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 101783
diff changeset
595 ;; and if text is bound to a command, execute that instead (Bug#1453)
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
596 (interactive)
102253
8a3d30f9b513 (ns-working-overlay): Don't make it buffer-local.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 101783
diff changeset
597 (ns-delete-working-text)
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
598 (let ((start (point)))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
599 (insert ns-working-text)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
600 (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
601 (current-buffer) nil t))
102253
8a3d30f9b513 (ns-working-overlay): Don't make it buffer-local.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 101783
diff changeset
602 'face 'ns-working-text-face)))
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
603
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
604 (defun ns-echo-working-text ()
103140
ba681b91f716 * term/ns-win.el (ns-alternatives-map, ns-insert-working-text)
Juanma Barranquero <lekktu@gmail.com>
parents: 103122
diff changeset
605 "Echo contents of `ns-working-text' in message display area.
102253
8a3d30f9b513 (ns-working-overlay): Don't make it buffer-local.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 101783
diff changeset
606 See `ns-insert-working-text'."
8a3d30f9b513 (ns-working-overlay): Don't make it buffer-local.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 101783
diff changeset
607 (ns-delete-working-text)
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
608 (let* ((msg (current-message))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
609 (msglen (length msg))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
610 message-log-max)
102253
8a3d30f9b513 (ns-working-overlay): Don't make it buffer-local.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 101783
diff changeset
611 (setq ns-working-overlay (length ns-working-text))
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
612 (setq msg (concat msg ns-working-text))
102253
8a3d30f9b513 (ns-working-overlay): Don't make it buffer-local.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 101783
diff changeset
613 (put-text-property msglen (+ msglen ns-working-overlay)
101427
1b7286db7263 * term/ns-win.el (menu-bar-select-frame): Drop this override.\n\t(menu-bar-update-frames): Update call to menu-bar-select-frame.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 101401
diff changeset
614 'face 'ns-working-text-face msg)
102253
8a3d30f9b513 (ns-working-overlay): Don't make it buffer-local.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 101783
diff changeset
615 (message "%s" msg)))
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
616
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
617 (defun ns-delete-working-text()
102253
8a3d30f9b513 (ns-working-overlay): Don't make it buffer-local.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 101783
diff changeset
618 "Delete working text and clear `ns-working-overlay'."
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
619 (interactive)
102253
8a3d30f9b513 (ns-working-overlay): Don't make it buffer-local.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 101783
diff changeset
620 (cond
8a3d30f9b513 (ns-working-overlay): Don't make it buffer-local.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 101783
diff changeset
621 ((and (overlayp ns-working-overlay)
8a3d30f9b513 (ns-working-overlay): Don't make it buffer-local.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 101783
diff changeset
622 ;; Still alive?
8a3d30f9b513 (ns-working-overlay): Don't make it buffer-local.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 101783
diff changeset
623 (overlay-buffer ns-working-overlay))
8a3d30f9b513 (ns-working-overlay): Don't make it buffer-local.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 101783
diff changeset
624 (with-current-buffer (overlay-buffer ns-working-overlay)
8a3d30f9b513 (ns-working-overlay): Don't make it buffer-local.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 101783
diff changeset
625 (delete-region (overlay-start ns-working-overlay)
8a3d30f9b513 (ns-working-overlay): Don't make it buffer-local.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 101783
diff changeset
626 (overlay-end ns-working-overlay))
8a3d30f9b513 (ns-working-overlay): Don't make it buffer-local.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 101783
diff changeset
627 (delete-overlay ns-working-overlay)))
8a3d30f9b513 (ns-working-overlay): Don't make it buffer-local.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 101783
diff changeset
628 ((integerp ns-working-overlay)
8a3d30f9b513 (ns-working-overlay): Don't make it buffer-local.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 101783
diff changeset
629 (let ((msg (current-message))
8a3d30f9b513 (ns-working-overlay): Don't make it buffer-local.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 101783
diff changeset
630 message-log-max)
8a3d30f9b513 (ns-working-overlay): Don't make it buffer-local.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 101783
diff changeset
631 (setq msg (substring msg 0 (- (length msg) ns-working-overlay)))
8a3d30f9b513 (ns-working-overlay): Don't make it buffer-local.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 101783
diff changeset
632 (message "%s" msg))))
8a3d30f9b513 (ns-working-overlay): Don't make it buffer-local.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 101783
diff changeset
633 (setq ns-working-overlay nil))
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
634
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
635
96699
05aeed7284d3 Fix header format and permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 96684
diff changeset
636 (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
637
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
638 ;;;; 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
639 ;; 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
640 ;; Carsten Bormann.
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
641 (if (eq system-type 'darwin)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
642 (progn
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
643
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
644 (defun ns-utf8-nfd-post-read-conversion (length)
103140
ba681b91f716 * term/ns-win.el (ns-alternatives-map, ns-insert-working-text)
Juanma Barranquero <lekktu@gmail.com>
parents: 103122
diff changeset
645 "Calls `ns-convert-utf8-nfd-to-nfc' to compose char sequences."
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
646 (save-excursion
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
647 (save-restriction
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
648 (narrow-to-region (point) (+ (point) length))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
649 (let ((str (buffer-string)))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
650 (delete-region (point-min) (point-max))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
651 (insert (ns-convert-utf8-nfd-to-nfc str))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
652 (- (point-max) (point-min))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
653 ))))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
654
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
655 (define-coding-system 'utf-8-nfd
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
656 "UTF-8 NFD (decomposed) encoding."
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
657 :coding-type 'utf-8
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
658 :mnemonic ?U
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
659 :charset-list '(unicode)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
660 :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
661 (set-file-name-coding-system 'utf-8-nfd)))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
662
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
663
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
664
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
665 ;;;; Inter-app communications support.
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
666
96699
05aeed7284d3 Fix header format and permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 96684
diff changeset
667 (defvar ns-input-text) ; nsterm.m
05aeed7284d3 Fix header format and permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 96684
diff changeset
668
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
669 (defun ns-insert-text ()
103140
ba681b91f716 * term/ns-win.el (ns-alternatives-map, ns-insert-working-text)
Juanma Barranquero <lekktu@gmail.com>
parents: 103122
diff changeset
670 "Insert contents of `ns-input-text' at point."
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
671 (interactive)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
672 (insert ns-input-text)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
673 (setq ns-input-text nil))
96699
05aeed7284d3 Fix header format and permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 96684
diff changeset
674
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
675 (defun ns-insert-file ()
103140
ba681b91f716 * term/ns-win.el (ns-alternatives-map, ns-insert-working-text)
Juanma Barranquero <lekktu@gmail.com>
parents: 103122
diff changeset
676 "Insert contents of file `ns-input-file' like insert-file but with less
ba681b91f716 * term/ns-win.el (ns-alternatives-map, ns-insert-working-text)
Juanma Barranquero <lekktu@gmail.com>
parents: 103122
diff changeset
677 prompting. If file is a directory perform a `find-file' on it."
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
678 (interactive)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
679 (let ((f))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
680 (setq f (car ns-input-file))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
681 (setq ns-input-file (cdr ns-input-file))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
682 (if (file-directory-p f)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
683 (find-file f)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
684 (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
685
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
686 (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
687 "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
688 (make-variable-buffer-local 'ns-select-overlay)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
689
96699
05aeed7284d3 Fix header format and permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 96684
diff changeset
690 (defvar ns-input-line) ; nsterm.m
05aeed7284d3 Fix header format and permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 96684
diff changeset
691
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
692 (defun ns-open-file-select-line ()
96792
50bfb208e018 Contents of ns-grabenv.el moved here.
Chong Yidong <cyd@stupidchicken.com>
parents: 96788
diff changeset
693 "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
694 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
695 (interactive)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
696 (ns-find-file)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
697 (cond
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
698 ((and ns-input-line (buffer-modified-p))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
699 (if ns-select-overlay
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
700 (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
701 (deactivate-mark)
104774
468b7fa34d2c Use forward-line rather than goto-line.
Glenn Morris <rgm@gnu.org>
parents: 104387
diff changeset
702 (goto-char (point-min))
468b7fa34d2c Use forward-line rather than goto-line.
Glenn Morris <rgm@gnu.org>
parents: 104387
diff changeset
703 (forward-line (1- (if (consp ns-input-line)
468b7fa34d2c Use forward-line rather than goto-line.
Glenn Morris <rgm@gnu.org>
parents: 104387
diff changeset
704 (min (car ns-input-line) (cdr ns-input-line))
468b7fa34d2c Use forward-line rather than goto-line.
Glenn Morris <rgm@gnu.org>
parents: 104387
diff changeset
705 ns-input-line))))
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
706 (ns-input-line
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
707 (if (not ns-select-overlay)
104387
1229ad8aec26 (ns-open-file-select-line): Use line-beginning-position rather than goto-line.
Glenn Morris <rgm@gnu.org>
parents: 104066
diff changeset
708 (overlay-put (setq ns-select-overlay (make-overlay (point-min)
1229ad8aec26 (ns-open-file-select-line): Use line-beginning-position rather than goto-line.
Glenn Morris <rgm@gnu.org>
parents: 104066
diff changeset
709 (point-min)))
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
710 'face 'highlight))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
711 (let ((beg (save-excursion
104387
1229ad8aec26 (ns-open-file-select-line): Use line-beginning-position rather than goto-line.
Glenn Morris <rgm@gnu.org>
parents: 104066
diff changeset
712 (goto-char (point-min))
1229ad8aec26 (ns-open-file-select-line): Use line-beginning-position rather than goto-line.
Glenn Morris <rgm@gnu.org>
parents: 104066
diff changeset
713 (line-beginning-position
1229ad8aec26 (ns-open-file-select-line): Use line-beginning-position rather than goto-line.
Glenn Morris <rgm@gnu.org>
parents: 104066
diff changeset
714 (if (consp ns-input-line)
1229ad8aec26 (ns-open-file-select-line): Use line-beginning-position rather than goto-line.
Glenn Morris <rgm@gnu.org>
parents: 104066
diff changeset
715 (min (car ns-input-line) (cdr ns-input-line))
1229ad8aec26 (ns-open-file-select-line): Use line-beginning-position rather than goto-line.
Glenn Morris <rgm@gnu.org>
parents: 104066
diff changeset
716 ns-input-line))))
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
717 (end (save-excursion
104387
1229ad8aec26 (ns-open-file-select-line): Use line-beginning-position rather than goto-line.
Glenn Morris <rgm@gnu.org>
parents: 104066
diff changeset
718 (goto-char (point-min))
1229ad8aec26 (ns-open-file-select-line): Use line-beginning-position rather than goto-line.
Glenn Morris <rgm@gnu.org>
parents: 104066
diff changeset
719 (line-beginning-position
1229ad8aec26 (ns-open-file-select-line): Use line-beginning-position rather than goto-line.
Glenn Morris <rgm@gnu.org>
parents: 104066
diff changeset
720 (1+ (if (consp ns-input-line)
1229ad8aec26 (ns-open-file-select-line): Use line-beginning-position rather than goto-line.
Glenn Morris <rgm@gnu.org>
parents: 104066
diff changeset
721 (max (car ns-input-line) (cdr ns-input-line))
1229ad8aec26 (ns-open-file-select-line): Use line-beginning-position rather than goto-line.
Glenn Morris <rgm@gnu.org>
parents: 104066
diff changeset
722 ns-input-line))))))
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
723 (move-overlay ns-select-overlay beg end)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
724 (deactivate-mark)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
725 (goto-char beg)))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
726 (t
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
727 (if ns-select-overlay
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
728 (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
729
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
730 (defun ns-unselect-line ()
96859
2e1af3a60ab7 Standardize references to "Nextstep" in comments, messages, and docstrings.
Chong Yidong <cyd@stupidchicken.com>
parents: 96814
diff changeset
731 "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
732 (if ns-select-overlay
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
733 (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
734
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
735 (add-hook 'first-change-hook 'ns-unselect-line)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
736
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
737
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
738
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
739 ;;;; Preferences handling.
96699
05aeed7284d3 Fix header format and permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 96684
diff changeset
740 (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
741
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
742 (defun get-lisp-resource (arg1 arg2)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
743 (let ((res (ns-get-resource arg1 arg2)))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
744 (cond
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
745 ((not res) 'unbound)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
746 ((string-equal (upcase res) "YES") t)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
747 ((string-equal (upcase res) "NO") nil)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
748 (t (read res)))))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
749
96699
05aeed7284d3 Fix header format and permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 96684
diff changeset
750 ;; nsterm.m
05aeed7284d3 Fix header format and permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 96684
diff changeset
751
05aeed7284d3 Fix header format and permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 96684
diff changeset
752 (declare-function ns-read-file-name "nsfns.m"
05aeed7284d3 Fix header format and permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 96684
diff changeset
753 (prompt &optional dir isLoad init))
05aeed7284d3 Fix header format and permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 96684
diff changeset
754
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
755 ;;;; File handling.
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
756
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
757 (defun ns-open-file-using-panel ()
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
758 "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
759 (interactive)
96748
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
760 ;; Prompt dir defaultName isLoad initial.
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
761 (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
762 (if ns-input-file
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
763 (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
764
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
765 (defun ns-write-file-using-panel ()
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
766 "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
767 (interactive)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
768 (let (ns-output-file)
96748
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
769 ;; Prompt dir defaultName isLoad initial.
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
770 (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
771 (message ns-output-file)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
772 (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
773
102875
fae9460dc1e1 (ns-pop-up-frames): Make it a defcustom.
Glenn Morris <rgm@gnu.org>
parents: 102771
diff changeset
774 (defcustom ns-pop-up-frames 'fresh
fae9460dc1e1 (ns-pop-up-frames): Make it a defcustom.
Glenn Morris <rgm@gnu.org>
parents: 102771
diff changeset
775 "Non-nil means open files upon request from the Workspace in a new frame.
96699
05aeed7284d3 Fix header format and permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 96684
diff changeset
776 If t, always do so. Any other non-nil value means open a new frame
102875
fae9460dc1e1 (ns-pop-up-frames): Make it a defcustom.
Glenn Morris <rgm@gnu.org>
parents: 102771
diff changeset
777 unless the current buffer is a scratch buffer."
fae9460dc1e1 (ns-pop-up-frames): Make it a defcustom.
Glenn Morris <rgm@gnu.org>
parents: 102771
diff changeset
778 :type '(choice (const :tag "Never" nil)
fae9460dc1e1 (ns-pop-up-frames): Make it a defcustom.
Glenn Morris <rgm@gnu.org>
parents: 102771
diff changeset
779 (const :tag "Always" t)
fae9460dc1e1 (ns-pop-up-frames): Make it a defcustom.
Glenn Morris <rgm@gnu.org>
parents: 102771
diff changeset
780 (other :tag "Except for scratch buffer" fresh))
fae9460dc1e1 (ns-pop-up-frames): Make it a defcustom.
Glenn Morris <rgm@gnu.org>
parents: 102771
diff changeset
781 :version "23.1"
fae9460dc1e1 (ns-pop-up-frames): Make it a defcustom.
Glenn Morris <rgm@gnu.org>
parents: 102771
diff changeset
782 :group 'ns)
96699
05aeed7284d3 Fix header format and permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 96684
diff changeset
783
05aeed7284d3 Fix header format and permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 96684
diff changeset
784 (declare-function ns-hide-emacs "nsfns.m" (on))
05aeed7284d3 Fix header format and permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 96684
diff changeset
785
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
786 (defun ns-find-file ()
103140
ba681b91f716 * term/ns-win.el (ns-alternatives-map, ns-insert-working-text)
Juanma Barranquero <lekktu@gmail.com>
parents: 103122
diff changeset
787 "Do a `find-file' with the `ns-input-file' as argument."
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
788 (interactive)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
789 (let ((f) (file) (bufwin1) (bufwin2))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
790 (setq f (file-truename (car ns-input-file)))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
791 (setq ns-input-file (cdr ns-input-file))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
792 (setq file (find-file-noselect f))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
793 (setq bufwin1 (get-buffer-window file 'visible))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
794 (setq bufwin2 (get-buffer-window "*scratch*" 'visibile))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
795 (cond
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
796 (bufwin1
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
797 (select-frame (window-frame bufwin1))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
798 (raise-frame (window-frame bufwin1))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
799 (select-window bufwin1))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
800 ((and (eq ns-pop-up-frames 'fresh) bufwin2)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
801 (ns-hide-emacs 'activate)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
802 (select-frame (window-frame bufwin2))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
803 (raise-frame (window-frame bufwin2))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
804 (select-window bufwin2)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
805 (find-file f))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
806 (ns-pop-up-frames
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
807 (ns-hide-emacs 'activate)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
808 (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
809 (t
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
810 (ns-hide-emacs 'activate)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
811 (find-file f)))))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
812
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
813
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
814
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
815 ;;;; Frame-related functions.
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
816
96859
2e1af3a60ab7 Standardize references to "Nextstep" in comments, messages, and docstrings.
Chong Yidong <cyd@stupidchicken.com>
parents: 96814
diff changeset
817 ;; 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
818 (setq-default mode-line-frame-identification '(" "))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
819
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
820 ;; You say tomAYto, I say tomAHto..
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
821 (defvaralias 'ns-option-modifier 'ns-alternate-modifier)
110930
b6cf32bb07a1 Bug#7150: Distinguishing between left and right Alt keys on NextStep/OSX.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
822 (defvaralias 'ns-right-option-modifier 'ns-right-alternate-modifier)
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
823
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
824 (defun ns-do-hide-emacs ()
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
825 (interactive)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
826 (ns-hide-emacs t))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
827
96699
05aeed7284d3 Fix header format and permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 96684
diff changeset
828 (declare-function ns-hide-others "nsfns.m" ())
05aeed7284d3 Fix header format and permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 96684
diff changeset
829
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
830 (defun ns-do-hide-others ()
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
831 (interactive)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
832 (ns-hide-others))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
833
96699
05aeed7284d3 Fix header format and permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 96684
diff changeset
834 (declare-function ns-emacs-info-panel "nsfns.m" ())
05aeed7284d3 Fix header format and permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 96684
diff changeset
835
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
836 (defun ns-do-emacs-info-panel ()
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
837 (interactive)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
838 (ns-emacs-info-panel))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
839
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
840 (defun ns-next-frame ()
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
841 "Switch to next visible frame."
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
842 (interactive)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
843 (other-frame 1))
103140
ba681b91f716 * term/ns-win.el (ns-alternatives-map, ns-insert-working-text)
Juanma Barranquero <lekktu@gmail.com>
parents: 103122
diff changeset
844
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
845 (defun ns-prev-frame ()
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
846 "Switch to previous visible frame."
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
847 (interactive)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
848 (other-frame -1))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
849
96748
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
850 ;; 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
851 (defvar parameters) ; dynamically bound in make-frame
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
852 (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
853 (lambda ()
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
854 (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
855 (top (cdr (assq 'top (frame-parameters)))))
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
856 (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
857 (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
858 (cond
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
859 ((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
860 ((or (not left) (not top)))
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
861 (t
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
862 (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
863 (cons (cons 'top (+ top 25))
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
864 parameters))))))))
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
865
96748
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
866 ;; frame will be focused anyway, so select it
97348
bf45b2dcafff * startup.el (command-line-ns-option-alist): Use ignore instead of ns-ignore-0-arg. * term/ns-win.el (ns-ignore-0-arg, mouse-extend-region) (ns-win-suspend-error, ns-yes-or-no-p, colors): Drop. (ns-alternatives-map): New variable. (x-set-up-function-keys): Use it. (global): Comment out 'put backspace ascii-character...' and friends. Move function-key-map into ns-alternatives-map. Don't call precompute-menubar-bindings. Don't set anything connected with browse-url. (after-make-frame-functions): Clarify comment why a hook is added.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 97279
diff changeset
867 ;; (if this is not done, modeline is dimmed until first interaction)
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
868 (add-hook 'after-make-frame-functions 'select-frame)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
869
97422
6e551caf98f6 Add declarations for builds without X.
Glenn Morris <rgm@gnu.org>
parents: 97348
diff changeset
870 (defvar tool-bar-mode)
6e551caf98f6 Add declarations for builds without X.
Glenn Morris <rgm@gnu.org>
parents: 97348
diff changeset
871 (declare-function tool-bar-mode "tool-bar" (&optional arg))
6e551caf98f6 Add declarations for builds without X.
Glenn Morris <rgm@gnu.org>
parents: 97348
diff changeset
872
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
873 ;; 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
874 ;; 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
875 (defun ns-toggle-toolbar (&optional frame)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
876 "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
877 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
878 (interactive)
96748
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
879 (modify-frame-parameters
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
880 frame (list (cons 'tool-bar-lines
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
881 (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
882 0 1)) ))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
883 (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
884
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
885
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
886
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
887 ;;;; Dialog-related functions.
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
888
101491
305655dc1e3a * term/ns-win.el (ns-insert-working-text, ns-delete-working-text):
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 101427
diff changeset
889
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
890 ;; 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
891 (defun ns-print-buffer ()
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
892 "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
893 (interactive)
105372
bd2966850aac Use `called-interactively-p' instead of `interactive-p'.
Juanma Barranquero <lekktu@gmail.com>
parents: 105229
diff changeset
894 (if (and (called-interactively-p 'interactive)
96748
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
895 (or (listp last-nonmenu-event)
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
896 (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
897 (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
898 (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
899 last-nonmenu-event
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
900 ;; Fake it:
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
901 `(mouse-1 POSITION 1))))
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
902 (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
903 (print-buffer)
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
904 (error "Cancelled")))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
905 (print-buffer)))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
906
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 ;;;; Font support.
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
909
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
910 ;; 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
911 (setq scalable-fonts-allowed t)
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 ;; Set to use font panel instead
99588
a61ecfde8504 (ns-do-applescript, ns-popup-font-panel): Declare.
Glenn Morris <rgm@gnu.org>
parents: 98512
diff changeset
914 (declare-function ns-popup-font-panel "nsfns.m" (&optional frame))
103879
33055f2b5e31 ns-win.el (x-select-font): defailias x-select-font to
Jan Djärv <jan.h.d@swipnet.se>
parents: 103345
diff changeset
915 (defalias 'x-select-font 'ns-popup-font-panel "Pop up the font panel.
103140
ba681b91f716 * term/ns-win.el (ns-alternatives-map, ns-insert-working-text)
Juanma Barranquero <lekktu@gmail.com>
parents: 103122
diff changeset
916 This function has been overloaded in Nextstep.")
102771
15dc97800b2f (ns-expand-space): remove defvar.
David Reitter <david.reitter@gmail.com>
parents: 102641
diff changeset
917 (defalias 'mouse-set-font 'ns-popup-font-panel "Pop up the font panel.
103140
ba681b91f716 * term/ns-win.el (ns-alternatives-map, ns-insert-working-text)
Juanma Barranquero <lekktu@gmail.com>
parents: 103122
diff changeset
918 This function has been overloaded in Nextstep.")
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
919
96699
05aeed7284d3 Fix header format and permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 96684
diff changeset
920 ;; nsterm.m
05aeed7284d3 Fix header format and permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 96684
diff changeset
921 (defvar ns-input-font)
05aeed7284d3 Fix header format and permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 96684
diff changeset
922 (defvar ns-input-fontsize)
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-respond-to-change-font ()
103140
ba681b91f716 * term/ns-win.el (ns-alternatives-map, ns-insert-working-text)
Juanma Barranquero <lekktu@gmail.com>
parents: 103122
diff changeset
925 "Respond to changeFont: event, expecting `ns-input-font' and\n\
ba681b91f716 * term/ns-win.el (ns-alternatives-map, ns-insert-working-text)
Juanma Barranquero <lekktu@gmail.com>
parents: 103122
diff changeset
926 `ns-input-fontsize' of new font."
96675
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 (modify-frame-parameters (selected-frame)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
929 (list (cons 'font ns-input-font)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
930 (cons 'fontsize ns-input-fontsize)))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
931 (set-frame-font ns-input-font))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
932
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
933
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
934 ;; 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
935 ;; can be set up manually. Ordinarily, fontsets are auto-created whenever
103140
ba681b91f716 * term/ns-win.el (ns-alternatives-map, ns-insert-working-text)
Juanma Barranquero <lekktu@gmail.com>
parents: 103122
diff changeset
936 ;; a font is chosen by
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
937 (defvar ns-standard-fontset-spec
96748
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
938 ;; 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
939 ;; "-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
940 (mapconcat 'identity
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
941 '("-ns-*-*-*-*-*-10-*-*-*-*-*-fontset-standard"
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
942 "latin:-*-Courier-*-*-*-*-10-*-*-*-*-*-iso10646-1"
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
943 "han:-*-Kai-*-*-*-*-10-*-*-*-*-*-iso10646-1"
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
944 "cyrillic:-*-Trebuchet$MS-*-*-*-*-10-*-*-*-*-*-iso10646-1")
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
945 ",")
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
946 "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
947 This defines a fontset consisting of the Courier and other fonts that
103140
ba681b91f716 * term/ns-win.el (ns-alternatives-map, ns-insert-working-text)
Juanma Barranquero <lekktu@gmail.com>
parents: 103122
diff changeset
948 come with OS X.
ba681b91f716 * term/ns-win.el (ns-alternatives-map, ns-insert-working-text)
Juanma Barranquero <lekktu@gmail.com>
parents: 103122
diff changeset
949 See the documentation of `create-fontset-from-fontset-spec' for the format.")
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
950
96748
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
951 ;; 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
952 (if (fboundp 'new-fontset)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
953 (progn
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
954 ;; Setup the default fontset.
102641
507916bdf147 Call create-defualt-fontset, not
Kenichi Handa <handa@m17n.org>
parents: 102560
diff changeset
955 (create-default-fontset)
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
956 ;; Create the standard fontset.
102641
507916bdf147 Call create-defualt-fontset, not
Kenichi Handa <handa@m17n.org>
parents: 102560
diff changeset
957 (condition-case err
507916bdf147 Call create-defualt-fontset, not
Kenichi Handa <handa@m17n.org>
parents: 102560
diff changeset
958 (create-fontset-from-fontset-spec ns-standard-fontset-spec t)
103140
ba681b91f716 * term/ns-win.el (ns-alternatives-map, ns-insert-working-text)
Juanma Barranquero <lekktu@gmail.com>
parents: 103122
diff changeset
959 (error (display-warning
102641
507916bdf147 Call create-defualt-fontset, not
Kenichi Handa <handa@m17n.org>
parents: 102560
diff changeset
960 'initialization
507916bdf147 Call create-defualt-fontset, not
Kenichi Handa <handa@m17n.org>
parents: 102560
diff changeset
961 (format "Creation of the standard fontset failed: %s" err)
507916bdf147 Call create-defualt-fontset, not
Kenichi Handa <handa@m17n.org>
parents: 102560
diff changeset
962 :error)))))
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
963
105177
f3f51ce338e8 (ns-reg-to-script): Define for compiler.
Glenn Morris <rgm@gnu.org>
parents: 105154
diff changeset
964 (defvar ns-reg-to-script) ; nsfont.m
f3f51ce338e8 (ns-reg-to-script): Define for compiler.
Glenn Morris <rgm@gnu.org>
parents: 105154
diff changeset
965
105154
a46a26bd9a4c * term/nswin.el (ns-reg-to-script): New variable.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 105009
diff changeset
966 ;; This maps font registries (not exposed by NS APIs for font selection) to
a46a26bd9a4c * term/nswin.el (ns-reg-to-script): New variable.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 105009
diff changeset
967 ;; unicode scripts (which can be mapped to unicode character ranges which are).
a46a26bd9a4c * term/nswin.el (ns-reg-to-script): New variable.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 105009
diff changeset
968 ;; See ../international/fontset.el
a46a26bd9a4c * term/nswin.el (ns-reg-to-script): New variable.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 105009
diff changeset
969 (setq ns-reg-to-script
a46a26bd9a4c * term/nswin.el (ns-reg-to-script): New variable.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 105009
diff changeset
970 '(("iso8859-1" . latin)
a46a26bd9a4c * term/nswin.el (ns-reg-to-script): New variable.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 105009
diff changeset
971 ("iso8859-2" . latin)
a46a26bd9a4c * term/nswin.el (ns-reg-to-script): New variable.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 105009
diff changeset
972 ("iso8859-3" . latin)
a46a26bd9a4c * term/nswin.el (ns-reg-to-script): New variable.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 105009
diff changeset
973 ("iso8859-4" . latin)
a46a26bd9a4c * term/nswin.el (ns-reg-to-script): New variable.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 105009
diff changeset
974 ("iso8859-5" . cyrillic)
a46a26bd9a4c * term/nswin.el (ns-reg-to-script): New variable.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 105009
diff changeset
975 ("microsoft-cp1251" . cyrillic)
a46a26bd9a4c * term/nswin.el (ns-reg-to-script): New variable.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 105009
diff changeset
976 ("koi8-r" . cyrillic)
a46a26bd9a4c * term/nswin.el (ns-reg-to-script): New variable.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 105009
diff changeset
977 ("iso8859-6" . arabic)
a46a26bd9a4c * term/nswin.el (ns-reg-to-script): New variable.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 105009
diff changeset
978 ("iso8859-7" . greek)
a46a26bd9a4c * term/nswin.el (ns-reg-to-script): New variable.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 105009
diff changeset
979 ("iso8859-8" . hebrew)
a46a26bd9a4c * term/nswin.el (ns-reg-to-script): New variable.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 105009
diff changeset
980 ("iso8859-9" . latin)
a46a26bd9a4c * term/nswin.el (ns-reg-to-script): New variable.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 105009
diff changeset
981 ("iso8859-10" . latin)
a46a26bd9a4c * term/nswin.el (ns-reg-to-script): New variable.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 105009
diff changeset
982 ("iso8859-11" . thai)
a46a26bd9a4c * term/nswin.el (ns-reg-to-script): New variable.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 105009
diff changeset
983 ("tis620" . thai)
a46a26bd9a4c * term/nswin.el (ns-reg-to-script): New variable.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 105009
diff changeset
984 ("iso8859-13" . latin)
a46a26bd9a4c * term/nswin.el (ns-reg-to-script): New variable.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 105009
diff changeset
985 ("iso8859-14" . latin)
a46a26bd9a4c * term/nswin.el (ns-reg-to-script): New variable.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 105009
diff changeset
986 ("iso8859-15" . latin)
a46a26bd9a4c * term/nswin.el (ns-reg-to-script): New variable.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 105009
diff changeset
987 ("iso8859-16" . latin)
a46a26bd9a4c * term/nswin.el (ns-reg-to-script): New variable.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 105009
diff changeset
988 ("viscii1.1-1" . latin)
a46a26bd9a4c * term/nswin.el (ns-reg-to-script): New variable.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 105009
diff changeset
989 ("jisx0201" . kana)
a46a26bd9a4c * term/nswin.el (ns-reg-to-script): New variable.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 105009
diff changeset
990 ("jisx0208" . han)
a46a26bd9a4c * term/nswin.el (ns-reg-to-script): New variable.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 105009
diff changeset
991 ("jisx0212" . han)
a46a26bd9a4c * term/nswin.el (ns-reg-to-script): New variable.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 105009
diff changeset
992 ("jisx0213" . han)
a46a26bd9a4c * term/nswin.el (ns-reg-to-script): New variable.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 105009
diff changeset
993 ("gb2312.1980" . han)
a46a26bd9a4c * term/nswin.el (ns-reg-to-script): New variable.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 105009
diff changeset
994 ("gb18030" . han)
a46a26bd9a4c * term/nswin.el (ns-reg-to-script): New variable.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 105009
diff changeset
995 ("gbk-0" . han)
a46a26bd9a4c * term/nswin.el (ns-reg-to-script): New variable.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 105009
diff changeset
996 ("big5" . han)
a46a26bd9a4c * term/nswin.el (ns-reg-to-script): New variable.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 105009
diff changeset
997 ("cns11643" . han)
a46a26bd9a4c * term/nswin.el (ns-reg-to-script): New variable.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 105009
diff changeset
998 ("sisheng_cwnn" . bopomofo)
a46a26bd9a4c * term/nswin.el (ns-reg-to-script): New variable.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 105009
diff changeset
999 ("ksc5601.1987" . hangul)
a46a26bd9a4c * term/nswin.el (ns-reg-to-script): New variable.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 105009
diff changeset
1000 ("ethiopic-unicode" . ethiopic)
a46a26bd9a4c * term/nswin.el (ns-reg-to-script): New variable.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 105009
diff changeset
1001 ("is13194-devanagari" . indian-is13194)
a46a26bd9a4c * term/nswin.el (ns-reg-to-script): New variable.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 105009
diff changeset
1002 ("iso10646.indian-1" . devanagari)))
a46a26bd9a4c * term/nswin.el (ns-reg-to-script): New variable.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 105009
diff changeset
1003
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1004
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1005 ;;;; Pasteboard support.
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1006
96699
05aeed7284d3 Fix header format and permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 96684
diff changeset
1007 (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
1008
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1009 (defun ns-get-pasteboard ()
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1010 "Returns the value of the pasteboard."
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1011 (ns-get-cut-buffer-internal 'PRIMARY))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1012
96699
05aeed7284d3 Fix header format and permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 96684
diff changeset
1013 (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
1014
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1015 (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
1016 "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
1017 ;; Check the data type of STRING.
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1018 (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
1019 (ns-store-cut-buffer-internal 'PRIMARY string))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1020
96748
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
1021 ;; 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
1022 ;; 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
1023 ;; from x-cut-buffer-or-selection-value.
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1024 (defvar ns-last-selected-text nil)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1025
96870
30f1368d9cf6 * term/ns-win.el: Rename ns- functions/variables to the
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96859
diff changeset
1026 (defun x-select-text (text &optional push)
104066
b564cde0cb8b Fix Bug#3888:
Eli Zaretskii <eliz@gnu.org>
parents: 103932
diff changeset
1027 "Select TEXT, a string, according to the window system.
b564cde0cb8b Fix Bug#3888:
Eli Zaretskii <eliz@gnu.org>
parents: 103932
diff changeset
1028
b564cde0cb8b Fix Bug#3888:
Eli Zaretskii <eliz@gnu.org>
parents: 103932
diff changeset
1029 On X, put TEXT in the primary X selection. For backward
b564cde0cb8b Fix Bug#3888:
Eli Zaretskii <eliz@gnu.org>
parents: 103932
diff changeset
1030 compatibility with older X applications, set the value of X cut
b564cde0cb8b Fix Bug#3888:
Eli Zaretskii <eliz@gnu.org>
parents: 103932
diff changeset
1031 buffer 0 as well, and if the optional argument PUSH is non-nil,
b564cde0cb8b Fix Bug#3888:
Eli Zaretskii <eliz@gnu.org>
parents: 103932
diff changeset
1032 rotate the cut buffers. If `x-select-enable-clipboard' is
b564cde0cb8b Fix Bug#3888:
Eli Zaretskii <eliz@gnu.org>
parents: 103932
diff changeset
1033 non-nil, copy the text to the X clipboard as well.
b564cde0cb8b Fix Bug#3888:
Eli Zaretskii <eliz@gnu.org>
parents: 103932
diff changeset
1034
b564cde0cb8b Fix Bug#3888:
Eli Zaretskii <eliz@gnu.org>
parents: 103932
diff changeset
1035 On Windows, make TEXT the current selection. If
b564cde0cb8b Fix Bug#3888:
Eli Zaretskii <eliz@gnu.org>
parents: 103932
diff changeset
1036 `x-select-enable-clipboard' is non-nil, copy the text to the
b564cde0cb8b Fix Bug#3888:
Eli Zaretskii <eliz@gnu.org>
parents: 103932
diff changeset
1037 clipboard as well. The argument PUSH is ignored.
b564cde0cb8b Fix Bug#3888:
Eli Zaretskii <eliz@gnu.org>
parents: 103932
diff changeset
1038
b564cde0cb8b Fix Bug#3888:
Eli Zaretskii <eliz@gnu.org>
parents: 103932
diff changeset
1039 On Nextstep, put TEXT in the pasteboard; PUSH is ignored."
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1040 ;; Don't send the pasteboard too much text.
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1041 ;; 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
1042 (ns-set-pasteboard text)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1043 (setq ns-last-selected-text text))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1044
96859
2e1af3a60ab7 Standardize references to "Nextstep" in comments, messages, and docstrings.
Chong Yidong <cyd@stupidchicken.com>
parents: 96814
diff changeset
1045 ;; 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
1046 ;; 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
1047 ;; 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
1048 (defun x-cut-buffer-or-selection-value ()
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1049 (let (text)
96757
18b856a0216f (ns-handle-switch): Simplify. Handle the numeric case.
Glenn Morris <rgm@gnu.org>
parents: 96748
diff changeset
1050
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1051 ;; 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
1052 ;; as if they were unset.
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1053 (or text (setq text (ns-get-pasteboard)))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1054 (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
1055
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1056 (cond
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1057 ((not text) nil)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1058 ((eq text ns-last-selected-text) nil)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1059 ((string= text ns-last-selected-text)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1060 ;; 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
1061 (setq ns-last-selected-text text)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1062 nil)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1063 (t
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1064 (setq ns-last-selected-text text)))))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1065
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1066 (defun ns-copy-including-secondary ()
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1067 (interactive)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1068 (call-interactively 'kill-ring-save)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1069 (ns-store-cut-buffer-internal 'SECONDARY
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1070 (buffer-substring (point) (mark t))))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1071 (defun ns-paste-secondary ()
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1072 (interactive)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1073 (insert (ns-get-cut-buffer-internal 'SECONDARY)))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1074
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1075
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1076
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1077 ;;;; Scrollbar handling.
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 (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
1080 (global-unset-key [vertical-scroll-bar mouse-1])
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1081 (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
1082
97422
6e551caf98f6 Add declarations for builds without X.
Glenn Morris <rgm@gnu.org>
parents: 97348
diff changeset
1083 (declare-function scroll-bar-scale "scroll-bar" (num-denom whole))
6e551caf98f6 Add declarations for builds without X.
Glenn Morris <rgm@gnu.org>
parents: 97348
diff changeset
1084
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1085 (defun ns-scroll-bar-move (event)
97348
bf45b2dcafff * startup.el (command-line-ns-option-alist): Use ignore instead of ns-ignore-0-arg. * term/ns-win.el (ns-ignore-0-arg, mouse-extend-region) (ns-win-suspend-error, ns-yes-or-no-p, colors): Drop. (ns-alternatives-map): New variable. (x-set-up-function-keys): Use it. (global): Comment out 'put backspace ascii-character...' and friends. Move function-key-map into ns-alternatives-map. Don't call precompute-menubar-bindings. Don't set anything connected with browse-url. (after-make-frame-functions): Clarify comment why a hook is added.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 97279
diff changeset
1086 "Scroll the frame according to a Nextstep scroller event."
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1087 (interactive "e")
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1088 (let* ((pos (event-end event))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1089 (window (nth 0 pos))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1090 (scale (nth 2 pos)))
105829
328150f0cf76 * url-util.el (url-insert-entities-in-string):
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 105372
diff changeset
1091 (with-current-buffer (window-buffer window)
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1092 (cond
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1093 ((eq (car scale) (cdr scale))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1094 (goto-char (point-max)))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1095 ((= (car scale) 0)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1096 (goto-char (point-min)))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1097 (t
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1098 (goto-char (+ (point-min) 1
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1099 (scroll-bar-scale scale (- (point-max) (point-min)))))))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1100 (beginning-of-line)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1101 (set-window-start window (point))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1102 (vertical-motion (/ (window-height window) 2) window))))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1103
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1104 (defun ns-handle-scroll-bar-event (event)
97348
bf45b2dcafff * startup.el (command-line-ns-option-alist): Use ignore instead of ns-ignore-0-arg. * term/ns-win.el (ns-ignore-0-arg, mouse-extend-region) (ns-win-suspend-error, ns-yes-or-no-p, colors): Drop. (ns-alternatives-map): New variable. (x-set-up-function-keys): Use it. (global): Comment out 'put backspace ascii-character...' and friends. Move function-key-map into ns-alternatives-map. Don't call precompute-menubar-bindings. Don't set anything connected with browse-url. (after-make-frame-functions): Clarify comment why a hook is added.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 97279
diff changeset
1105 "Handle scroll bar EVENT to emulate Nextstep style scrolling."
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1106 (interactive "e")
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1107 (let* ((position (event-start event))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1108 (bar-part (nth 4 position))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1109 (window (nth 0 position))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1110 (old-window (selected-window)))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1111 (cond
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1112 ((eq bar-part 'ratio)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1113 (ns-scroll-bar-move event))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1114 ((eq bar-part 'handle)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1115 (if (eq window (selected-window))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1116 (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
1117 ;; 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
1118 (ns-scroll-bar-move event)))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1119 (t
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1120 (select-window window)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1121 (cond
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1122 ((eq bar-part 'up)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1123 (goto-char (window-start window))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1124 (scroll-down 1))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1125 ((eq bar-part 'above-handle)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1126 (scroll-down))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1127 ((eq bar-part 'below-handle)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1128 (scroll-up))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1129 ((eq bar-part 'down)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1130 (goto-char (window-start window))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1131 (scroll-up 1)))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1132 (select-window old-window)))))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1133
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1134
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1135 ;;;; Color support.
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1136
96699
05aeed7284d3 Fix header format and permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 96684
diff changeset
1137 (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
1138
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1139 (defvar x-colors (ns-list-colors)
104066
b564cde0cb8b Fix Bug#3888:
Eli Zaretskii <eliz@gnu.org>
parents: 103932
diff changeset
1140 "List of basic colors available on color displays.
b564cde0cb8b Fix Bug#3888:
Eli Zaretskii <eliz@gnu.org>
parents: 103932
diff changeset
1141 For X, the list comes from the `rgb.txt' file,v 10.41 94/02/20.
b564cde0cb8b Fix Bug#3888:
Eli Zaretskii <eliz@gnu.org>
parents: 103932
diff changeset
1142 For Nextstep, this is a list of non-PANTONE colors returned by
b564cde0cb8b Fix Bug#3888:
Eli Zaretskii <eliz@gnu.org>
parents: 103932
diff changeset
1143 the operating system.")
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1144
96870
30f1368d9cf6 * term/ns-win.el: Rename ns- functions/variables to the
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96859
diff changeset
1145 (defun xw-defined-colors (&optional frame)
104066
b564cde0cb8b Fix Bug#3888:
Eli Zaretskii <eliz@gnu.org>
parents: 103932
diff changeset
1146 "Internal function called by `defined-colors'."
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1147 (or frame (setq frame (selected-frame)))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1148 (let ((all-colors x-colors)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1149 (this-color nil)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1150 (defined-colors nil))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1151 (while all-colors
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1152 (setq this-color (car all-colors)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1153 all-colors (cdr all-colors))
96748
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
1154 ;; (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
1155 (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
1156 defined-colors))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1157
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1158 ;; Functions for color panel + drag
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1159 (defun ns-face-at-pos (pos)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1160 (let* ((frame (car pos))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1161 (frame-pos (cons (cadr pos) (cddr pos)))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1162 (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
1163 (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
1164 (buffer (window-buffer window))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1165 (edges (window-edges window)))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1166 (cond
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1167 ((not window-pos)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1168 nil)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1169 ((eq window-pos 'mode-line)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1170 'modeline)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1171 ((eq window-pos 'vertical-line)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1172 'default)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1173 ((consp window-pos)
105829
328150f0cf76 * url-util.el (url-insert-entities-in-string):
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 105372
diff changeset
1174 (with-current-buffer buffer
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1175 (let ((p (car (compute-motion (window-start window)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1176 (cons (nth 0 edges) (nth 1 edges))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1177 (window-end window)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1178 frame-pos
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1179 (- (window-width window) 1)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1180 nil
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1181 window))))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1182 (cond
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1183 ((eq p (window-point window))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1184 'cursor)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1185 ((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
1186 'region)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1187 (t
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1188 (let ((faces (get-char-property p 'face window)))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1189 (if (consp faces) (car faces) faces)))))))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1190 (t
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1191 nil))))
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 (defvar ns-input-color) ; nsterm.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-set-foreground-at-mouse ()
103140
ba681b91f716 * term/ns-win.el (ns-alternatives-map, ns-insert-working-text)
Juanma Barranquero <lekktu@gmail.com>
parents: 103122
diff changeset
1196 "Set the foreground color at the mouse location to `ns-input-color'."
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1197 (interactive)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1198 (let* ((pos (mouse-position))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1199 (frame (car pos))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1200 (face (ns-face-at-pos pos)))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1201 (cond
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1202 ((eq face 'cursor)
96699
05aeed7284d3 Fix header format and permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 96684
diff changeset
1203 (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
1204 ns-input-color))))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1205 ((not face)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1206 (modify-frame-parameters frame (list (cons 'foreground-color
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1207 ns-input-color))))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1208 (t
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1209 (set-face-foreground face ns-input-color frame)))))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1210
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1211 (defun ns-set-background-at-mouse ()
103140
ba681b91f716 * term/ns-win.el (ns-alternatives-map, ns-insert-working-text)
Juanma Barranquero <lekktu@gmail.com>
parents: 103122
diff changeset
1212 "Set the background color at the mouse location to `ns-input-color'."
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1213 (interactive)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1214 (let* ((pos (mouse-position))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1215 (frame (car pos))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1216 (face (ns-face-at-pos pos)))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1217 (cond
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1218 ((eq face 'cursor)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1219 (modify-frame-parameters frame (list (cons 'cursor-color
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1220 ns-input-color))))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1221 ((not face)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1222 (modify-frame-parameters frame (list (cons 'background-color
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1223 ns-input-color))))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1224 (t
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1225 (set-face-background face ns-input-color frame)))))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1226
96859
2e1af3a60ab7 Standardize references to "Nextstep" in comments, messages, and docstrings.
Chong Yidong <cyd@stupidchicken.com>
parents: 96814
diff changeset
1227 ;; 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
1228 (setq frame-title-format t
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1229 icon-title-format t)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1230
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1231
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1232 (defvar ns-initialized nil
96859
2e1af3a60ab7 Standardize references to "Nextstep" in comments, messages, and docstrings.
Chong Yidong <cyd@stupidchicken.com>
parents: 96814
diff changeset
1233 "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
1234
96699
05aeed7284d3 Fix header format and permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 96684
diff changeset
1235 (declare-function ns-list-services "nsfns.m" ())
101354
8802a9b050fb * term/ns-win.el (ns-show-manual): Fix node name. (x-open-connection) Fix typo in declaration filename.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 101087
diff changeset
1236 (declare-function x-open-connection "nsfns.m"
97422
6e551caf98f6 Add declarations for builds without X.
Glenn Morris <rgm@gnu.org>
parents: 97348
diff changeset
1237 (display &optional xrm-string must-succeed))
96699
05aeed7284d3 Fix header format and permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 96684
diff changeset
1238
96859
2e1af3a60ab7 Standardize references to "Nextstep" in comments, messages, and docstrings.
Chong Yidong <cyd@stupidchicken.com>
parents: 96814
diff changeset
1239 ;; 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
1240 ;; 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
1241 (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
1242 "Initialize Emacs for Nextstep (Cocoa / GNUstep) windowing."
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1243
96748
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
1244 ;; PENDING: not needed?
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1245 (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
1246
96870
30f1368d9cf6 * term/ns-win.el: Rename ns- functions/variables to the
Dan Nicolaescu <dann@ics.uci.edu>
parents: 96859
diff changeset
1247 (x-open-connection (system-name) nil t)
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1248
96748
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
1249 (dolist (service (ns-list-services))
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
1250 (if (eq (car service) 'undefined)
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
1251 (ns-define-service (cdr service))
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
1252 (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
1253 (ns-define-service (cdr service)))))
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1254
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1255 (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
1256 (eq (get-lisp-resource nil "HideOnAutoLaunch") t))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1257 (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
1258
96748
92f7bbffcb45 Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 96707
diff changeset
1259 ;; 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
1260 (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
1261
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1262 (setq ns-initialized t))
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1263
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1264 (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
1265 (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
1266 (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
1267
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1268
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1269 (provide 'ns-win)
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1270
96684
9a85c163883d Add arch tagline
Miles Bader <miles@gnu.org>
parents: 96675
diff changeset
1271 ;; arch-tag: eb138a45-4e2e-4d68-b1c9-a39665731644
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff changeset
1272 ;;; ns-win.el ends here