Mercurial > emacs
annotate lisp/term/ns-win.el @ 112401:e80422318be4
gnus-art.el (gnus-mime-display-single): Use mm-display-inline rather than mm-insert-inline.
author | Katsumi Yamaoka <yamaoka@jpl.org> |
---|---|
date | Fri, 21 Jan 2011 23:33:46 +0000 |
parents | 417b1e4d63cd |
children |
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 |
112218
376148b31b5e
Add 2011 to FSF/AIST copyright years.
Glenn Morris <rgm@gnu.org>
parents:
110930
diff
changeset
|
3 ;; Copyright (C) 1993, 1994, 2005, 2006, 2007, 2008, 2009, 2010, 2011 |
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 |
111183 | 44 (or (featurep 'ns) |
98512 | 45 (error "%s: Loading ns-win.el but not compiled for GNUstep/MacOS" |
111183 | 46 (invocation-name))) |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
47 |
111198
898ddb0c960d
* lisp/term/ns-win.el: Restore require of cl when compiling.
Glenn Morris <rgm@gnu.org>
parents:
111191
diff
changeset
|
48 (eval-when-compile (require 'cl)) ; lexical-let |
96748
92f7bbffcb45
Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
96707
diff
changeset
|
49 |
111201 | 50 ;; Documentation-purposes only: actually loaded in loadup.el. |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
51 (require 'frame) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
52 (require 'mouse) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
53 (require 'faces) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
54 (require 'menu-bar) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
55 (require 'fontset) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
56 |
101783
9f9c03710f3b
(ns): Define as a custom group.
Glenn Morris <rgm@gnu.org>
parents:
101741
diff
changeset
|
57 (defgroup ns nil |
9f9c03710f3b
(ns): Define as a custom group.
Glenn Morris <rgm@gnu.org>
parents:
101741
diff
changeset
|
58 "GNUstep/Mac OS X specific features." |
9f9c03710f3b
(ns): Define as a custom group.
Glenn Morris <rgm@gnu.org>
parents:
101741
diff
changeset
|
59 :group 'environment) |
9f9c03710f3b
(ns): Define as a custom group.
Glenn Morris <rgm@gnu.org>
parents:
101741
diff
changeset
|
60 |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
61 ;;;; Command line argument handling. |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
62 |
111185
050a28bd1797
Remove ns-handle-* functions that duplicate x-handle-*.
Glenn Morris <rgm@gnu.org>
parents:
111183
diff
changeset
|
63 (defvar x-invocation-args) |
050a28bd1797
Remove ns-handle-* functions that duplicate x-handle-*.
Glenn Morris <rgm@gnu.org>
parents:
111183
diff
changeset
|
64 (defvar ns-command-line-resources nil) ; FIXME unused? |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
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-input-file) |
05aeed7284d3
Fix header format and permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
96684
diff
changeset
|
68 |
111201 | 69 (defun ns-handle-nxopen (switch &optional temp) |
70 (setq unread-command-events (append unread-command-events | |
71 (if temp '(ns-open-temp-file) | |
72 '(ns-open-file))) | |
111185
050a28bd1797
Remove ns-handle-* functions that duplicate x-handle-*.
Glenn Morris <rgm@gnu.org>
parents:
111183
diff
changeset
|
73 ns-input-file (append ns-input-file (list (pop x-invocation-args))))) |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
74 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
75 (defun ns-handle-nxopentemp (switch) |
111201 | 76 (ns-handle-nxopen switch t)) |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
77 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
78 (defun ns-ignore-1-arg (switch) |
111185
050a28bd1797
Remove ns-handle-* functions that duplicate x-handle-*.
Glenn Morris <rgm@gnu.org>
parents:
111183
diff
changeset
|
79 (setq x-invocation-args (cdr x-invocation-args))) |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
80 |
97447
378d7afbbe93
(ns-parse-geometry): Rename from x-parse-geometry.
Chong Yidong <cyd@stupidchicken.com>
parents:
97423
diff
changeset
|
81 (defun ns-parse-geometry (geom) |
97423 | 82 "Parse a Nextstep-style geometry string GEOM. |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
83 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
|
84 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
|
85 (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
|
86 \\( \\([0-9]+\\) ?\\)?\\)?\\)?" |
2e1af3a60ab7
Standardize references to "Nextstep" in comments, messages, and docstrings.
Chong Yidong <cyd@stupidchicken.com>
parents:
96814
diff
changeset
|
87 geom) |
2e1af3a60ab7
Standardize references to "Nextstep" in comments, messages, and docstrings.
Chong Yidong <cyd@stupidchicken.com>
parents:
96814
diff
changeset
|
88 (apply |
2e1af3a60ab7
Standardize references to "Nextstep" in comments, messages, and docstrings.
Chong Yidong <cyd@stupidchicken.com>
parents:
96814
diff
changeset
|
89 'append |
2e1af3a60ab7
Standardize references to "Nextstep" in comments, messages, and docstrings.
Chong Yidong <cyd@stupidchicken.com>
parents:
96814
diff
changeset
|
90 (list |
2e1af3a60ab7
Standardize references to "Nextstep" in comments, messages, and docstrings.
Chong Yidong <cyd@stupidchicken.com>
parents:
96814
diff
changeset
|
91 (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
|
92 (if (match-string 3 geom) |
2e1af3a60ab7
Standardize references to "Nextstep" in comments, messages, and docstrings.
Chong Yidong <cyd@stupidchicken.com>
parents:
96814
diff
changeset
|
93 (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
|
94 (if (match-string 5 geom) |
2e1af3a60ab7
Standardize references to "Nextstep" in comments, messages, and docstrings.
Chong Yidong <cyd@stupidchicken.com>
parents:
96814
diff
changeset
|
95 (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
|
96 (if (match-string 7 geom) |
2e1af3a60ab7
Standardize references to "Nextstep" in comments, messages, and docstrings.
Chong Yidong <cyd@stupidchicken.com>
parents:
96814
diff
changeset
|
97 (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
|
98 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
99 ;;;; Keyboard mapping. |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
100 |
111183 | 101 (define-obsolete-variable-alias 'ns-alternatives-map 'x-alternatives-map "24.1") |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
102 |
96859
2e1af3a60ab7
Standardize references to "Nextstep" in comments, messages, and docstrings.
Chong Yidong <cyd@stupidchicken.com>
parents:
96814
diff
changeset
|
103 ;; 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
|
104 (define-key global-map [?\s-,] 'customize) |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
105 (define-key global-map [?\s-'] 'next-multiframe-window) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
106 (define-key global-map [?\s-`] 'other-frame) |
109379
863ed9bd7c0e
term/ns-win.el: Bind M-~ to 'ns-prev-frame (due to Matthew Dempsky; bug#5084). Remove incorrect binding for S-tab. (ns-alternatives-map): Change S-tab binding to backtab (bug#6616). * simple.el (normal-erase-is-backspace-setup-frame): Set mode on under ns.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
106815
diff
changeset
|
107 (define-key global-map [?\s-~] 'ns-prev-frame) |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
108 (define-key global-map [?\s--] 'center-line) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
109 (define-key global-map [?\s-:] 'ispell) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
110 (define-key global-map [?\s-\;] 'ispell-next) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
111 (define-key global-map [?\s-?] 'info) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
112 (define-key global-map [?\s-^] 'kill-some-buffers) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
113 (define-key global-map [?\s-&] 'kill-this-buffer) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
114 (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
|
115 (define-key global-map [?\s-D] 'dired) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
116 (define-key global-map [?\s-E] 'edit-abbrevs) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
117 (define-key global-map [?\s-L] 'shell-command) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
118 (define-key global-map [?\s-M] 'manual-entry) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
119 (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
|
120 (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
|
121 (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
|
122 (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
|
123 (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
|
124 (define-key global-map [?\s-f] 'isearch-forward) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
125 (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
|
126 (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
|
127 (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
|
128 (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
|
129 (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
|
130 (define-key global-map [?\s-l] 'goto-line) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
131 (define-key global-map [?\s-m] 'iconify-frame) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
132 (define-key global-map [?\s-n] 'make-frame) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
133 (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
|
134 (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
|
135 (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
|
136 (define-key global-map [?\s-s] 'save-buffer) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
137 (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
|
138 (define-key global-map [?\s-u] 'revert-buffer) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
139 (define-key global-map [?\s-v] 'yank) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
140 (define-key global-map [?\s-w] 'delete-frame) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
141 (define-key global-map [?\s-x] 'kill-region) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
142 (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
|
143 (define-key global-map [?\s-z] 'undo) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
144 (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
|
145 (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
|
146 ;; (as in Terminal.app) |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
147 (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
|
148 (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
|
149 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
150 (define-key global-map [home] 'beginning-of-buffer) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
151 (define-key global-map [end] 'end-of-buffer) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
152 (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
|
153 (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
|
154 (define-key global-map [kp-prior] 'scroll-down) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
155 (define-key global-map [kp-next] 'scroll-up) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
156 |
111201 | 157 ;; Allow shift-clicks to work similarly to under Nextstep. |
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
|
158 (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
|
159 (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
|
160 |
96859
2e1af3a60ab7
Standardize references to "Nextstep" in comments, messages, and docstrings.
Chong Yidong <cyd@stupidchicken.com>
parents:
96814
diff
changeset
|
161 ;; Special Nextstep-generated events are converted to function keys. Here |
111191
ed5bac97776a
* term/ns-win.el (ns-new-frame, ns-show-prefs): Don't add to global map. * term/common-win.el (x-setup-function-keys): Remove most of the keymappings. Comment on the remaining ones.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
111187
diff
changeset
|
162 ;; are the bindings for them. Note, these keys are actually declared in |
ed5bac97776a
* term/ns-win.el (ns-new-frame, ns-show-prefs): Don't add to global map. * term/common-win.el (x-setup-function-keys): Remove most of the keymappings. Comment on the remaining ones.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
111187
diff
changeset
|
163 ;; x-setup-function-keys in common-win. |
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
|
164 (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
|
165 (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
|
166 (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
|
167 (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
|
168 (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
|
169 (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
|
170 (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
|
171 (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
|
172 (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
|
173 (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
|
174 (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
|
175 (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
|
176 (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
|
177 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
178 |
96788
c4b6acf322cc
Contents of ns-carbon-compat.el moved here.
Chong Yidong <cyd@stupidchicken.com>
parents:
96767
diff
changeset
|
179 ;; 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
|
180 ;; the Choi/Mitsuharu Carbon port. |
c4b6acf322cc
Contents of ns-carbon-compat.el moved here.
Chong Yidong <cyd@stupidchicken.com>
parents:
96767
diff
changeset
|
181 |
c4b6acf322cc
Contents of ns-carbon-compat.el moved here.
Chong Yidong <cyd@stupidchicken.com>
parents:
96767
diff
changeset
|
182 (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
|
183 (defvaralias 'mac-command-modifier 'ns-command-modifier) |
111662
1303259207a9
Add separate key mappings for left/right control/command on Nextstep (Bug#7458).
Jan D. <jan.h.d@swipnet.se>
parents:
111215
diff
changeset
|
184 (defvaralias 'mac-right-command-modifier 'ns-right-command-modifier) |
96788
c4b6acf322cc
Contents of ns-carbon-compat.el moved here.
Chong Yidong <cyd@stupidchicken.com>
parents:
96767
diff
changeset
|
185 (defvaralias 'mac-control-modifier 'ns-control-modifier) |
111662
1303259207a9
Add separate key mappings for left/right control/command on Nextstep (Bug#7458).
Jan D. <jan.h.d@swipnet.se>
parents:
111215
diff
changeset
|
186 (defvaralias 'mac-right-control-modifier 'ns-right-control-modifier) |
96788
c4b6acf322cc
Contents of ns-carbon-compat.el moved here.
Chong Yidong <cyd@stupidchicken.com>
parents:
96767
diff
changeset
|
187 (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
|
188 (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
|
189 (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
|
190 (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
|
191 (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
|
192 |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
193 ;;;; Services |
96757
18b856a0216f
(ns-handle-switch): Simplify. Handle the numeric case.
Glenn Morris <rgm@gnu.org>
parents:
96748
diff
changeset
|
194 (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
|
195 |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
196 (defun ns-define-service (path) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
197 (let ((mapping [menu-bar services]) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
198 (service (mapconcat 'identity path "/")) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
199 (name (intern |
96748
92f7bbffcb45
Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
96707
diff
changeset
|
200 (subst-char-in-string |
92f7bbffcb45
Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
96707
diff
changeset
|
201 ?\s ?- |
92f7bbffcb45
Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
96707
diff
changeset
|
202 (mapconcat 'identity (cons "ns-service" path) "-"))))) |
92f7bbffcb45
Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
96707
diff
changeset
|
203 ;; This defines the function. |
92f7bbffcb45
Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
96707
diff
changeset
|
204 (defalias name |
92f7bbffcb45
Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
96707
diff
changeset
|
205 (lexical-let ((service service)) |
92f7bbffcb45
Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
96707
diff
changeset
|
206 (lambda (arg) |
92f7bbffcb45
Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
96707
diff
changeset
|
207 (interactive "p") |
92f7bbffcb45
Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
96707
diff
changeset
|
208 (let* ((in-string |
92f7bbffcb45
Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
96707
diff
changeset
|
209 (cond ((stringp arg) arg) |
92f7bbffcb45
Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
96707
diff
changeset
|
210 (mark-active |
92f7bbffcb45
Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
96707
diff
changeset
|
211 (buffer-substring (region-beginning) (region-end))))) |
92f7bbffcb45
Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
96707
diff
changeset
|
212 (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
|
213 (cond |
92f7bbffcb45
Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
96707
diff
changeset
|
214 ((stringp arg) out-string) |
92f7bbffcb45
Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
96707
diff
changeset
|
215 ((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
|
216 (not (string= in-string out-string)))) |
92f7bbffcb45
Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
96707
diff
changeset
|
217 (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
|
218 (insert out-string) |
92f7bbffcb45
Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
96707
diff
changeset
|
219 (setq deactivate-mark nil))))))) |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
220 (cond |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
221 ((lookup-key global-map mapping) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
222 (while (cdr path) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
223 (setq mapping (vconcat mapping (list (intern (car path))))) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
224 (if (not (keymapp (lookup-key global-map mapping))) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
225 (define-key global-map mapping |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
226 (cons (car path) (make-sparse-keymap (car path))))) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
227 (setq path (cdr path))) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
228 (setq mapping (vconcat mapping (list (intern (car path))))) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
229 (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
|
230 name)) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
231 |
96699
05aeed7284d3
Fix header format and permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
96684
diff
changeset
|
232 ;; nsterm.m |
05aeed7284d3
Fix header format and permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
96684
diff
changeset
|
233 (defvar ns-input-spi-name) |
05aeed7284d3
Fix header format and permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
96684
diff
changeset
|
234 (defvar ns-input-spi-arg) |
05aeed7284d3
Fix header format and permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
96684
diff
changeset
|
235 |
97422
6e551caf98f6
Add declarations for builds without X.
Glenn Morris <rgm@gnu.org>
parents:
97348
diff
changeset
|
236 (declare-function dnd-open-file "dnd" (uri action)) |
6e551caf98f6
Add declarations for builds without X.
Glenn Morris <rgm@gnu.org>
parents:
97348
diff
changeset
|
237 |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
238 (defun ns-spi-service-call () |
96799
6cfed26789b7
(ns-submit-bug-report): Function removed. Bug
Chong Yidong <cyd@stupidchicken.com>
parents:
96792
diff
changeset
|
239 "Respond to a service request." |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
240 (interactive) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
241 (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
|
242 (switch-to-buffer (generate-new-buffer "*untitled*")) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
243 (insert ns-input-spi-arg)) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
244 ((string-equal ns-input-spi-name "open-file") |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
245 (dnd-open-file ns-input-spi-arg nil)) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
246 ((string-equal ns-input-spi-name "mail-selection") |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
247 (compose-mail) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
248 (rfc822-goto-eoh) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
249 (forward-line 1) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
250 (insert ns-input-spi-arg)) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
251 ((string-equal ns-input-spi-name "mail-to") |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
252 (compose-mail ns-input-spi-arg)) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
253 (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
|
254 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
255 |
102253
8a3d30f9b513
(ns-working-overlay): Don't make it buffer-local.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
101783
diff
changeset
|
256 ;; 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
|
257 ;; (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
|
258 ;; 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
|
259 ;; 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
|
260 ;; editing window.) |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
261 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
262 (defface ns-working-text-face |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
263 '((t :underline t)) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
264 "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
|
265 :group 'ns) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
266 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
267 (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
|
268 "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
|
269 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
|
270 |
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
|
271 (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
|
272 |
305655dc1e3a
* term/ns-win.el (ns-insert-working-text, ns-delete-working-text):
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
101427
diff
changeset
|
273 ;; 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
|
274 ;; 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
|
275 (defun ns-in-echo-area () |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
276 "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
|
277 is currently being used." |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
278 (or isearch-mode |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
279 (and cursor-in-echo-area (current-message)) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
280 ;; Overlay strings are not shown in some cases. |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
281 (get-char-property (point) 'invisible) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
282 (and (not (bobp)) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
283 (or (and (get-char-property (point) 'display) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
284 (eq (get-char-property (1- (point)) 'display) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
285 (get-char-property (point) 'display))) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
286 (and (get-char-property (point) 'composition) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
287 (eq (get-char-property (1- (point)) 'composition) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
288 (get-char-property (point) 'composition))))))) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
289 |
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
|
290 ;; 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
|
291 ;; 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
|
292 ;; 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
|
293 ;; 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
|
294 (defun ns-put-working-text () |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
295 (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
|
296 (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
|
297 (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
|
298 (interactive) |
102253
8a3d30f9b513
(ns-working-overlay): Don't make it buffer-local.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
101783
diff
changeset
|
299 (ns-delete-working-text)) |
96699
05aeed7284d3
Fix header format and permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
96684
diff
changeset
|
300 |
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
|
301 (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
|
302 "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
|
303 `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
|
304 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
|
305 ;; 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
|
306 ;; 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
|
307 (interactive) |
102253
8a3d30f9b513
(ns-working-overlay): Don't make it buffer-local.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
101783
diff
changeset
|
308 (ns-delete-working-text) |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
309 (let ((start (point))) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
310 (insert ns-working-text) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
311 (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
|
312 (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
|
313 'face 'ns-working-text-face))) |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
314 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
315 (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
|
316 "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
|
317 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
|
318 (ns-delete-working-text) |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
319 (let* ((msg (current-message)) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
320 (msglen (length msg)) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
321 message-log-max) |
102253
8a3d30f9b513
(ns-working-overlay): Don't make it buffer-local.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
101783
diff
changeset
|
322 (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
|
323 (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
|
324 (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
|
325 '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
|
326 (message "%s" msg))) |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
327 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
328 (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
|
329 "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
|
330 (interactive) |
102253
8a3d30f9b513
(ns-working-overlay): Don't make it buffer-local.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
101783
diff
changeset
|
331 (cond |
8a3d30f9b513
(ns-working-overlay): Don't make it buffer-local.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
101783
diff
changeset
|
332 ((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
|
333 ;; Still alive? |
8a3d30f9b513
(ns-working-overlay): Don't make it buffer-local.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
101783
diff
changeset
|
334 (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
|
335 (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
|
336 (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
|
337 (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
|
338 (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
|
339 ((integerp ns-working-overlay) |
8a3d30f9b513
(ns-working-overlay): Don't make it buffer-local.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
101783
diff
changeset
|
340 (let ((msg (current-message)) |
8a3d30f9b513
(ns-working-overlay): Don't make it buffer-local.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
101783
diff
changeset
|
341 message-log-max) |
8a3d30f9b513
(ns-working-overlay): Don't make it buffer-local.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
101783
diff
changeset
|
342 (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
|
343 (message "%s" msg)))) |
8a3d30f9b513
(ns-working-overlay): Don't make it buffer-local.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
101783
diff
changeset
|
344 (setq ns-working-overlay nil)) |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
345 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
346 |
96699
05aeed7284d3
Fix header format and permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
96684
diff
changeset
|
347 (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
|
348 |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
349 ;;;; 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
|
350 ;; 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
|
351 ;; Carsten Bormann. |
111198
898ddb0c960d
* lisp/term/ns-win.el: Restore require of cl when compiling.
Glenn Morris <rgm@gnu.org>
parents:
111191
diff
changeset
|
352 (when (eq system-type 'darwin) |
898ddb0c960d
* lisp/term/ns-win.el: Restore require of cl when compiling.
Glenn Morris <rgm@gnu.org>
parents:
111191
diff
changeset
|
353 (defun ns-utf8-nfd-post-read-conversion (length) |
898ddb0c960d
* lisp/term/ns-win.el: Restore require of cl when compiling.
Glenn Morris <rgm@gnu.org>
parents:
111191
diff
changeset
|
354 "Calls `ns-convert-utf8-nfd-to-nfc' to compose char sequences." |
898ddb0c960d
* lisp/term/ns-win.el: Restore require of cl when compiling.
Glenn Morris <rgm@gnu.org>
parents:
111191
diff
changeset
|
355 (save-excursion |
898ddb0c960d
* lisp/term/ns-win.el: Restore require of cl when compiling.
Glenn Morris <rgm@gnu.org>
parents:
111191
diff
changeset
|
356 (save-restriction |
898ddb0c960d
* lisp/term/ns-win.el: Restore require of cl when compiling.
Glenn Morris <rgm@gnu.org>
parents:
111191
diff
changeset
|
357 (narrow-to-region (point) (+ (point) length)) |
898ddb0c960d
* lisp/term/ns-win.el: Restore require of cl when compiling.
Glenn Morris <rgm@gnu.org>
parents:
111191
diff
changeset
|
358 (let ((str (buffer-string))) |
898ddb0c960d
* lisp/term/ns-win.el: Restore require of cl when compiling.
Glenn Morris <rgm@gnu.org>
parents:
111191
diff
changeset
|
359 (delete-region (point-min) (point-max)) |
898ddb0c960d
* lisp/term/ns-win.el: Restore require of cl when compiling.
Glenn Morris <rgm@gnu.org>
parents:
111191
diff
changeset
|
360 (insert (ns-convert-utf8-nfd-to-nfc str)) |
111201 | 361 (- (point-max) (point-min)))))) |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
362 |
111198
898ddb0c960d
* lisp/term/ns-win.el: Restore require of cl when compiling.
Glenn Morris <rgm@gnu.org>
parents:
111191
diff
changeset
|
363 (define-coding-system 'utf-8-nfd |
898ddb0c960d
* lisp/term/ns-win.el: Restore require of cl when compiling.
Glenn Morris <rgm@gnu.org>
parents:
111191
diff
changeset
|
364 "UTF-8 NFD (decomposed) encoding." |
898ddb0c960d
* lisp/term/ns-win.el: Restore require of cl when compiling.
Glenn Morris <rgm@gnu.org>
parents:
111191
diff
changeset
|
365 :coding-type 'utf-8 |
898ddb0c960d
* lisp/term/ns-win.el: Restore require of cl when compiling.
Glenn Morris <rgm@gnu.org>
parents:
111191
diff
changeset
|
366 :mnemonic ?U |
898ddb0c960d
* lisp/term/ns-win.el: Restore require of cl when compiling.
Glenn Morris <rgm@gnu.org>
parents:
111191
diff
changeset
|
367 :charset-list '(unicode) |
898ddb0c960d
* lisp/term/ns-win.el: Restore require of cl when compiling.
Glenn Morris <rgm@gnu.org>
parents:
111191
diff
changeset
|
368 :post-read-conversion 'ns-utf8-nfd-post-read-conversion) |
898ddb0c960d
* lisp/term/ns-win.el: Restore require of cl when compiling.
Glenn Morris <rgm@gnu.org>
parents:
111191
diff
changeset
|
369 (set-file-name-coding-system 'utf-8-nfd)) |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
370 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
371 ;;;; Inter-app communications support. |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
372 |
96699
05aeed7284d3
Fix header format and permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
96684
diff
changeset
|
373 (defvar ns-input-text) ; nsterm.m |
05aeed7284d3
Fix header format and permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
96684
diff
changeset
|
374 |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
375 (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
|
376 "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
|
377 (interactive) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
378 (insert ns-input-text) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
379 (setq ns-input-text nil)) |
96699
05aeed7284d3
Fix header format and permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
96684
diff
changeset
|
380 |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
381 (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
|
382 "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
|
383 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
|
384 (interactive) |
111203
d9447313bf33
* lisp/term/ns-win.el (ns-insert-file): Init in let.
Glenn Morris <rgm@gnu.org>
parents:
111201
diff
changeset
|
385 (let ((f (pop ns-input-file))) |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
386 (if (file-directory-p f) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
387 (find-file f) |
111201 | 388 (push-mark (+ (point) (cadr (insert-file-contents f))))))) |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
389 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
390 (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
|
391 "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
|
392 (make-variable-buffer-local 'ns-select-overlay) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
393 |
96699
05aeed7284d3
Fix header format and permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
96684
diff
changeset
|
394 (defvar ns-input-line) ; nsterm.m |
05aeed7284d3
Fix header format and permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
96684
diff
changeset
|
395 |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
396 (defun ns-open-file-select-line () |
96792
50bfb208e018
Contents of ns-grabenv.el moved here.
Chong Yidong <cyd@stupidchicken.com>
parents:
96788
diff
changeset
|
397 "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
|
398 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
|
399 (interactive) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
400 (ns-find-file) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
401 (cond |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
402 ((and ns-input-line (buffer-modified-p)) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
403 (if ns-select-overlay |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
404 (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
|
405 (deactivate-mark) |
104774
468b7fa34d2c
Use forward-line rather than goto-line.
Glenn Morris <rgm@gnu.org>
parents:
104387
diff
changeset
|
406 (goto-char (point-min)) |
468b7fa34d2c
Use forward-line rather than goto-line.
Glenn Morris <rgm@gnu.org>
parents:
104387
diff
changeset
|
407 (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
|
408 (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
|
409 ns-input-line)))) |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
410 (ns-input-line |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
411 (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
|
412 (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
|
413 (point-min))) |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
414 'face 'highlight)) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
415 (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
|
416 (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
|
417 (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
|
418 (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
|
419 (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
|
420 ns-input-line)))) |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
421 (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
|
422 (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
|
423 (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
|
424 (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
|
425 (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
|
426 ns-input-line)))))) |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
427 (move-overlay ns-select-overlay beg end) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
428 (deactivate-mark) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
429 (goto-char beg))) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
430 (t |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
431 (if ns-select-overlay |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
432 (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
|
433 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
434 (defun ns-unselect-line () |
96859
2e1af3a60ab7
Standardize references to "Nextstep" in comments, messages, and docstrings.
Chong Yidong <cyd@stupidchicken.com>
parents:
96814
diff
changeset
|
435 "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
|
436 (if ns-select-overlay |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
437 (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
|
438 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
439 (add-hook 'first-change-hook 'ns-unselect-line) |
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 ;;;; Preferences handling. |
96699
05aeed7284d3
Fix header format and permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
96684
diff
changeset
|
442 (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
|
443 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
444 (defun get-lisp-resource (arg1 arg2) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
445 (let ((res (ns-get-resource arg1 arg2))) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
446 (cond |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
447 ((not res) 'unbound) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
448 ((string-equal (upcase res) "YES") t) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
449 ((string-equal (upcase res) "NO") nil) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
450 (t (read res))))) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
451 |
96699
05aeed7284d3
Fix header format and permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
96684
diff
changeset
|
452 ;; nsterm.m |
05aeed7284d3
Fix header format and permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
96684
diff
changeset
|
453 |
05aeed7284d3
Fix header format and permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
96684
diff
changeset
|
454 (declare-function ns-read-file-name "nsfns.m" |
05aeed7284d3
Fix header format and permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
96684
diff
changeset
|
455 (prompt &optional dir isLoad init)) |
05aeed7284d3
Fix header format and permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
96684
diff
changeset
|
456 |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
457 ;;;; File handling. |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
458 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
459 (defun ns-open-file-using-panel () |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
460 "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
|
461 (interactive) |
96748
92f7bbffcb45
Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
96707
diff
changeset
|
462 ;; Prompt dir defaultName isLoad initial. |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
463 (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
|
464 (if ns-input-file |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
465 (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
|
466 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
467 (defun ns-write-file-using-panel () |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
468 "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
|
469 (interactive) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
470 (let (ns-output-file) |
96748
92f7bbffcb45
Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
96707
diff
changeset
|
471 ;; Prompt dir defaultName isLoad initial. |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
472 (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
|
473 (message ns-output-file) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
474 (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
|
475 |
102875
fae9460dc1e1
(ns-pop-up-frames): Make it a defcustom.
Glenn Morris <rgm@gnu.org>
parents:
102771
diff
changeset
|
476 (defcustom ns-pop-up-frames 'fresh |
fae9460dc1e1
(ns-pop-up-frames): Make it a defcustom.
Glenn Morris <rgm@gnu.org>
parents:
102771
diff
changeset
|
477 "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
|
478 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
|
479 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
|
480 :type '(choice (const :tag "Never" nil) |
fae9460dc1e1
(ns-pop-up-frames): Make it a defcustom.
Glenn Morris <rgm@gnu.org>
parents:
102771
diff
changeset
|
481 (const :tag "Always" t) |
fae9460dc1e1
(ns-pop-up-frames): Make it a defcustom.
Glenn Morris <rgm@gnu.org>
parents:
102771
diff
changeset
|
482 (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
|
483 :version "23.1" |
fae9460dc1e1
(ns-pop-up-frames): Make it a defcustom.
Glenn Morris <rgm@gnu.org>
parents:
102771
diff
changeset
|
484 :group 'ns) |
96699
05aeed7284d3
Fix header format and permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
96684
diff
changeset
|
485 |
05aeed7284d3
Fix header format and permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
96684
diff
changeset
|
486 (declare-function ns-hide-emacs "nsfns.m" (on)) |
05aeed7284d3
Fix header format and permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
96684
diff
changeset
|
487 |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
488 (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
|
489 "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
|
490 (interactive) |
111203
d9447313bf33
* lisp/term/ns-win.el (ns-insert-file): Init in let.
Glenn Morris <rgm@gnu.org>
parents:
111201
diff
changeset
|
491 (let* ((f (file-truename (pop ns-input-file))) |
d9447313bf33
* lisp/term/ns-win.el (ns-insert-file): Init in let.
Glenn Morris <rgm@gnu.org>
parents:
111201
diff
changeset
|
492 (file (find-file-noselect f)) |
d9447313bf33
* lisp/term/ns-win.el (ns-insert-file): Init in let.
Glenn Morris <rgm@gnu.org>
parents:
111201
diff
changeset
|
493 (bufwin1 (get-buffer-window file 'visible)) |
d9447313bf33
* lisp/term/ns-win.el (ns-insert-file): Init in let.
Glenn Morris <rgm@gnu.org>
parents:
111201
diff
changeset
|
494 (bufwin2 (get-buffer-window "*scratch*" 'visibile))) |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
495 (cond |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
496 (bufwin1 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
497 (select-frame (window-frame bufwin1)) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
498 (raise-frame (window-frame bufwin1)) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
499 (select-window bufwin1)) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
500 ((and (eq ns-pop-up-frames 'fresh) bufwin2) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
501 (ns-hide-emacs 'activate) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
502 (select-frame (window-frame bufwin2)) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
503 (raise-frame (window-frame bufwin2)) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
504 (select-window bufwin2) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
505 (find-file f)) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
506 (ns-pop-up-frames |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
507 (ns-hide-emacs 'activate) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
508 (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
|
509 (t |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
510 (ns-hide-emacs 'activate) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
511 (find-file f))))) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
512 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
513 ;;;; Frame-related functions. |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
514 |
96859
2e1af3a60ab7
Standardize references to "Nextstep" in comments, messages, and docstrings.
Chong Yidong <cyd@stupidchicken.com>
parents:
96814
diff
changeset
|
515 ;; 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
|
516 (setq-default mode-line-frame-identification '(" ")) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
517 |
111198
898ddb0c960d
* lisp/term/ns-win.el: Restore require of cl when compiling.
Glenn Morris <rgm@gnu.org>
parents:
111191
diff
changeset
|
518 ;; nsterm.m |
898ddb0c960d
* lisp/term/ns-win.el: Restore require of cl when compiling.
Glenn Morris <rgm@gnu.org>
parents:
111191
diff
changeset
|
519 (defvar ns-alternate-modifier) |
898ddb0c960d
* lisp/term/ns-win.el: Restore require of cl when compiling.
Glenn Morris <rgm@gnu.org>
parents:
111191
diff
changeset
|
520 (defvar ns-right-alternate-modifier) |
111662
1303259207a9
Add separate key mappings for left/right control/command on Nextstep (Bug#7458).
Jan D. <jan.h.d@swipnet.se>
parents:
111215
diff
changeset
|
521 (defvar ns-right-command-modifier) |
1303259207a9
Add separate key mappings for left/right control/command on Nextstep (Bug#7458).
Jan D. <jan.h.d@swipnet.se>
parents:
111215
diff
changeset
|
522 (defvar ns-right-control-modifier) |
111198
898ddb0c960d
* lisp/term/ns-win.el: Restore require of cl when compiling.
Glenn Morris <rgm@gnu.org>
parents:
111191
diff
changeset
|
523 |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
524 ;; You say tomAYto, I say tomAHto.. |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
525 (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
|
526 (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
|
527 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
528 (defun ns-do-hide-emacs () |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
529 (interactive) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
530 (ns-hide-emacs t)) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
531 |
96699
05aeed7284d3
Fix header format and permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
96684
diff
changeset
|
532 (declare-function ns-hide-others "nsfns.m" ()) |
05aeed7284d3
Fix header format and permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
96684
diff
changeset
|
533 |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
534 (defun ns-do-hide-others () |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
535 (interactive) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
536 (ns-hide-others)) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
537 |
96699
05aeed7284d3
Fix header format and permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
96684
diff
changeset
|
538 (declare-function ns-emacs-info-panel "nsfns.m" ()) |
05aeed7284d3
Fix header format and permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
96684
diff
changeset
|
539 |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
540 (defun ns-do-emacs-info-panel () |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
541 (interactive) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
542 (ns-emacs-info-panel)) |
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 (defun ns-next-frame () |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
545 "Switch to next visible frame." |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
546 (interactive) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
547 (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
|
548 |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
549 (defun ns-prev-frame () |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
550 "Switch to previous visible frame." |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
551 (interactive) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
552 (other-frame -1)) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
553 |
96748
92f7bbffcb45
Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
96707
diff
changeset
|
554 ;; 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
|
555 (defvar parameters) ; dynamically bound in make-frame |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
556 (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
|
557 (lambda () |
92f7bbffcb45
Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
96707
diff
changeset
|
558 (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
|
559 (top (cdr (assq 'top (frame-parameters))))) |
92f7bbffcb45
Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
96707
diff
changeset
|
560 (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
|
561 (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
|
562 (cond |
92f7bbffcb45
Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
96707
diff
changeset
|
563 ((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
|
564 ((or (not left) (not top))) |
92f7bbffcb45
Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
96707
diff
changeset
|
565 (t |
92f7bbffcb45
Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
96707
diff
changeset
|
566 (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
|
567 (cons (cons 'top (+ top 25)) |
92f7bbffcb45
Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
96707
diff
changeset
|
568 parameters)))))))) |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
569 |
96748
92f7bbffcb45
Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
96707
diff
changeset
|
570 ;; 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
|
571 ;; (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
|
572 (add-hook 'after-make-frame-functions 'select-frame) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
573 |
97422
6e551caf98f6
Add declarations for builds without X.
Glenn Morris <rgm@gnu.org>
parents:
97348
diff
changeset
|
574 (defvar tool-bar-mode) |
6e551caf98f6
Add declarations for builds without X.
Glenn Morris <rgm@gnu.org>
parents:
97348
diff
changeset
|
575 (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
|
576 |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
577 ;; 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
|
578 ;; 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
|
579 (defun ns-toggle-toolbar (&optional frame) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
580 "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
|
581 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
|
582 (interactive) |
96748
92f7bbffcb45
Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
96707
diff
changeset
|
583 (modify-frame-parameters |
92f7bbffcb45
Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
96707
diff
changeset
|
584 frame (list (cons 'tool-bar-lines |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
585 (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
|
586 0 1)) )) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
587 (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
|
588 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
589 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
590 ;;;; Dialog-related functions. |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
591 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
592 ;; 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
|
593 (defun ns-print-buffer () |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
594 "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
|
595 (interactive) |
105372
bd2966850aac
Use `called-interactively-p' instead of `interactive-p'.
Juanma Barranquero <lekktu@gmail.com>
parents:
105229
diff
changeset
|
596 (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
|
597 (or (listp last-nonmenu-event) |
92f7bbffcb45
Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
96707
diff
changeset
|
598 (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
|
599 (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
|
600 (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
|
601 last-nonmenu-event |
92f7bbffcb45
Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
96707
diff
changeset
|
602 ;; Fake it: |
92f7bbffcb45
Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
96707
diff
changeset
|
603 `(mouse-1 POSITION 1)))) |
92f7bbffcb45
Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
96707
diff
changeset
|
604 (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
|
605 (print-buffer) |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
606 (error "Cancelled"))) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
607 (print-buffer))) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
608 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
609 ;;;; Font support. |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
610 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
611 ;; 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
|
612 (setq scalable-fonts-allowed t) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
613 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
614 ;; 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
|
615 (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
|
616 (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
|
617 This function has been overloaded in Nextstep.") |
102771
15dc97800b2f
(ns-expand-space): remove defvar.
David Reitter <david.reitter@gmail.com>
parents:
102641
diff
changeset
|
618 (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
|
619 This function has been overloaded in Nextstep.") |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
620 |
96699
05aeed7284d3
Fix header format and permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
96684
diff
changeset
|
621 ;; nsterm.m |
05aeed7284d3
Fix header format and permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
96684
diff
changeset
|
622 (defvar ns-input-font) |
05aeed7284d3
Fix header format and permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
96684
diff
changeset
|
623 (defvar ns-input-fontsize) |
05aeed7284d3
Fix header format and permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
96684
diff
changeset
|
624 |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
625 (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
|
626 "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
|
627 `ns-input-fontsize' of new font." |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
628 (interactive) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
629 (modify-frame-parameters (selected-frame) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
630 (list (cons 'font ns-input-font) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
631 (cons 'fontsize ns-input-fontsize))) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
632 (set-frame-font ns-input-font)) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
633 |
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 ;; 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
|
636 ;; 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
|
637 ;; a font is chosen by |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
638 (defvar ns-standard-fontset-spec |
96748
92f7bbffcb45
Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
96707
diff
changeset
|
639 ;; 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
|
640 ;; "-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
|
641 (mapconcat 'identity |
92f7bbffcb45
Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
96707
diff
changeset
|
642 '("-ns-*-*-*-*-*-10-*-*-*-*-*-fontset-standard" |
92f7bbffcb45
Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
96707
diff
changeset
|
643 "latin:-*-Courier-*-*-*-*-10-*-*-*-*-*-iso10646-1" |
92f7bbffcb45
Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
96707
diff
changeset
|
644 "han:-*-Kai-*-*-*-*-10-*-*-*-*-*-iso10646-1" |
92f7bbffcb45
Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
96707
diff
changeset
|
645 "cyrillic:-*-Trebuchet$MS-*-*-*-*-10-*-*-*-*-*-iso10646-1") |
92f7bbffcb45
Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
96707
diff
changeset
|
646 ",") |
92f7bbffcb45
Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
96707
diff
changeset
|
647 "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
|
648 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
|
649 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
|
650 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
|
651 |
96748
92f7bbffcb45
Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
96707
diff
changeset
|
652 ;; Conditional on new-fontset so bootstrapping works on non-GUI compiles. |
111183 | 653 (when (fboundp 'new-fontset) |
654 ;; Setup the default fontset. | |
655 (create-default-fontset) | |
656 ;; Create the standard fontset. | |
657 (condition-case err | |
658 (create-fontset-from-fontset-spec ns-standard-fontset-spec t) | |
659 (error (display-warning | |
660 'initialization | |
661 (format "Creation of the standard fontset failed: %s" err) | |
662 :error)))) | |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
663 |
105177
f3f51ce338e8
(ns-reg-to-script): Define for compiler.
Glenn Morris <rgm@gnu.org>
parents:
105154
diff
changeset
|
664 (defvar ns-reg-to-script) ; nsfont.m |
f3f51ce338e8
(ns-reg-to-script): Define for compiler.
Glenn Morris <rgm@gnu.org>
parents:
105154
diff
changeset
|
665 |
105154
a46a26bd9a4c
* term/nswin.el (ns-reg-to-script): New variable.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
105009
diff
changeset
|
666 ;; 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
|
667 ;; 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
|
668 ;; 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
|
669 (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
|
670 '(("iso8859-1" . latin) |
a46a26bd9a4c
* term/nswin.el (ns-reg-to-script): New variable.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
105009
diff
changeset
|
671 ("iso8859-2" . latin) |
a46a26bd9a4c
* term/nswin.el (ns-reg-to-script): New variable.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
105009
diff
changeset
|
672 ("iso8859-3" . latin) |
a46a26bd9a4c
* term/nswin.el (ns-reg-to-script): New variable.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
105009
diff
changeset
|
673 ("iso8859-4" . latin) |
a46a26bd9a4c
* term/nswin.el (ns-reg-to-script): New variable.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
105009
diff
changeset
|
674 ("iso8859-5" . cyrillic) |
a46a26bd9a4c
* term/nswin.el (ns-reg-to-script): New variable.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
105009
diff
changeset
|
675 ("microsoft-cp1251" . cyrillic) |
a46a26bd9a4c
* term/nswin.el (ns-reg-to-script): New variable.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
105009
diff
changeset
|
676 ("koi8-r" . cyrillic) |
a46a26bd9a4c
* term/nswin.el (ns-reg-to-script): New variable.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
105009
diff
changeset
|
677 ("iso8859-6" . arabic) |
a46a26bd9a4c
* term/nswin.el (ns-reg-to-script): New variable.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
105009
diff
changeset
|
678 ("iso8859-7" . greek) |
a46a26bd9a4c
* term/nswin.el (ns-reg-to-script): New variable.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
105009
diff
changeset
|
679 ("iso8859-8" . hebrew) |
a46a26bd9a4c
* term/nswin.el (ns-reg-to-script): New variable.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
105009
diff
changeset
|
680 ("iso8859-9" . latin) |
a46a26bd9a4c
* term/nswin.el (ns-reg-to-script): New variable.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
105009
diff
changeset
|
681 ("iso8859-10" . latin) |
a46a26bd9a4c
* term/nswin.el (ns-reg-to-script): New variable.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
105009
diff
changeset
|
682 ("iso8859-11" . thai) |
a46a26bd9a4c
* term/nswin.el (ns-reg-to-script): New variable.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
105009
diff
changeset
|
683 ("tis620" . thai) |
a46a26bd9a4c
* term/nswin.el (ns-reg-to-script): New variable.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
105009
diff
changeset
|
684 ("iso8859-13" . latin) |
a46a26bd9a4c
* term/nswin.el (ns-reg-to-script): New variable.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
105009
diff
changeset
|
685 ("iso8859-14" . latin) |
a46a26bd9a4c
* term/nswin.el (ns-reg-to-script): New variable.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
105009
diff
changeset
|
686 ("iso8859-15" . latin) |
a46a26bd9a4c
* term/nswin.el (ns-reg-to-script): New variable.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
105009
diff
changeset
|
687 ("iso8859-16" . latin) |
a46a26bd9a4c
* term/nswin.el (ns-reg-to-script): New variable.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
105009
diff
changeset
|
688 ("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
|
689 ("jisx0201" . kana) |
a46a26bd9a4c
* term/nswin.el (ns-reg-to-script): New variable.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
105009
diff
changeset
|
690 ("jisx0208" . han) |
a46a26bd9a4c
* term/nswin.el (ns-reg-to-script): New variable.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
105009
diff
changeset
|
691 ("jisx0212" . han) |
a46a26bd9a4c
* term/nswin.el (ns-reg-to-script): New variable.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
105009
diff
changeset
|
692 ("jisx0213" . han) |
a46a26bd9a4c
* term/nswin.el (ns-reg-to-script): New variable.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
105009
diff
changeset
|
693 ("gb2312.1980" . han) |
a46a26bd9a4c
* term/nswin.el (ns-reg-to-script): New variable.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
105009
diff
changeset
|
694 ("gb18030" . han) |
a46a26bd9a4c
* term/nswin.el (ns-reg-to-script): New variable.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
105009
diff
changeset
|
695 ("gbk-0" . han) |
a46a26bd9a4c
* term/nswin.el (ns-reg-to-script): New variable.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
105009
diff
changeset
|
696 ("big5" . han) |
a46a26bd9a4c
* term/nswin.el (ns-reg-to-script): New variable.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
105009
diff
changeset
|
697 ("cns11643" . han) |
a46a26bd9a4c
* term/nswin.el (ns-reg-to-script): New variable.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
105009
diff
changeset
|
698 ("sisheng_cwnn" . bopomofo) |
a46a26bd9a4c
* term/nswin.el (ns-reg-to-script): New variable.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
105009
diff
changeset
|
699 ("ksc5601.1987" . hangul) |
a46a26bd9a4c
* term/nswin.el (ns-reg-to-script): New variable.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
105009
diff
changeset
|
700 ("ethiopic-unicode" . ethiopic) |
a46a26bd9a4c
* term/nswin.el (ns-reg-to-script): New variable.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
105009
diff
changeset
|
701 ("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
|
702 ("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
|
703 |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
704 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
705 ;;;; Pasteboard support. |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
706 |
96699
05aeed7284d3
Fix header format and permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
96684
diff
changeset
|
707 (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
|
708 |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
709 (defun ns-get-pasteboard () |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
710 "Returns the value of the pasteboard." |
109825
a2dc02f10ab3
Use CLIPBOARD and PRIMARY on NS (Bug#6677).
Jan D <jan.h.d@swipnet.se>
parents:
109379
diff
changeset
|
711 (ns-get-cut-buffer-internal 'CLIPBOARD)) |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
712 |
96699
05aeed7284d3
Fix header format and permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
96684
diff
changeset
|
713 (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
|
714 |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
715 (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
|
716 "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
|
717 ;; Check the data type of STRING. |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
718 (if (not (stringp string)) (error "Nonstring given to pasteboard")) |
109825
a2dc02f10ab3
Use CLIPBOARD and PRIMARY on NS (Bug#6677).
Jan D <jan.h.d@swipnet.se>
parents:
109379
diff
changeset
|
719 (ns-store-cut-buffer-internal 'CLIPBOARD string)) |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
720 |
96748
92f7bbffcb45
Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
96707
diff
changeset
|
721 ;; 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
|
722 ;; current selection against it, and avoid passing back our own text |
110145 | 723 ;; from x-selection-value. |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
724 (defvar ns-last-selected-text nil) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
725 |
96859
2e1af3a60ab7
Standardize references to "Nextstep" in comments, messages, and docstrings.
Chong Yidong <cyd@stupidchicken.com>
parents:
96814
diff
changeset
|
726 ;; 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
|
727 ;; 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
|
728 ;; buffer 0 before retrieving the value of the primary selection. |
110145 | 729 (defun x-selection-value () |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
730 (let (text) |
110148
bcc7c00e9ef4
Remove cut buffer from documentation.
Jan D. <jan.h.d@swipnet.se>
parents:
110145
diff
changeset
|
731 ;; Consult the selection. Treat empty strings as if they were unset. |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
732 (or text (setq text (ns-get-pasteboard))) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
733 (if (string= text "") (setq text nil)) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
734 (cond |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
735 ((not text) nil) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
736 ((eq text ns-last-selected-text) nil) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
737 ((string= text ns-last-selected-text) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
738 ;; 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
|
739 (setq ns-last-selected-text text) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
740 nil) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
741 (t |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
742 (setq ns-last-selected-text text))))) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
743 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
744 (defun ns-copy-including-secondary () |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
745 (interactive) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
746 (call-interactively 'kill-ring-save) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
747 (ns-store-cut-buffer-internal 'SECONDARY |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
748 (buffer-substring (point) (mark t)))) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
749 (defun ns-paste-secondary () |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
750 (interactive) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
751 (insert (ns-get-cut-buffer-internal 'SECONDARY))) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
752 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
753 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
754 ;;;; Scrollbar handling. |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
755 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
756 (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
|
757 (global-unset-key [vertical-scroll-bar mouse-1]) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
758 (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
|
759 |
97422
6e551caf98f6
Add declarations for builds without X.
Glenn Morris <rgm@gnu.org>
parents:
97348
diff
changeset
|
760 (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
|
761 |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
762 (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
|
763 "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
|
764 (interactive "e") |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
765 (let* ((pos (event-end event)) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
766 (window (nth 0 pos)) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
767 (scale (nth 2 pos))) |
105829
328150f0cf76
* url-util.el (url-insert-entities-in-string):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
105372
diff
changeset
|
768 (with-current-buffer (window-buffer window) |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
769 (cond |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
770 ((eq (car scale) (cdr scale)) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
771 (goto-char (point-max))) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
772 ((= (car scale) 0) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
773 (goto-char (point-min))) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
774 (t |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
775 (goto-char (+ (point-min) 1 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
776 (scroll-bar-scale scale (- (point-max) (point-min))))))) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
777 (beginning-of-line) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
778 (set-window-start window (point)) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
779 (vertical-motion (/ (window-height window) 2) window)))) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
780 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
781 (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
|
782 "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
|
783 (interactive "e") |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
784 (let* ((position (event-start event)) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
785 (bar-part (nth 4 position)) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
786 (window (nth 0 position)) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
787 (old-window (selected-window))) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
788 (cond |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
789 ((eq bar-part 'ratio) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
790 (ns-scroll-bar-move event)) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
791 ((eq bar-part 'handle) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
792 (if (eq window (selected-window)) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
793 (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
|
794 ;; 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
|
795 (ns-scroll-bar-move event))) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
796 (t |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
797 (select-window window) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
798 (cond |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
799 ((eq bar-part 'up) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
800 (goto-char (window-start window)) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
801 (scroll-down 1)) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
802 ((eq bar-part 'above-handle) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
803 (scroll-down)) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
804 ((eq bar-part 'below-handle) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
805 (scroll-up)) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
806 ((eq bar-part 'down) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
807 (goto-char (window-start window)) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
808 (scroll-up 1))) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
809 (select-window old-window))))) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
810 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
811 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
812 ;;;; Color support. |
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 ;; Functions for color panel + drag |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
815 (defun ns-face-at-pos (pos) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
816 (let* ((frame (car pos)) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
817 (frame-pos (cons (cadr pos) (cddr pos))) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
818 (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
|
819 (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
|
820 (buffer (window-buffer window)) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
821 (edges (window-edges window))) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
822 (cond |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
823 ((not window-pos) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
824 nil) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
825 ((eq window-pos 'mode-line) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
826 'modeline) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
827 ((eq window-pos 'vertical-line) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
828 'default) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
829 ((consp window-pos) |
105829
328150f0cf76
* url-util.el (url-insert-entities-in-string):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
105372
diff
changeset
|
830 (with-current-buffer buffer |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
831 (let ((p (car (compute-motion (window-start window) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
832 (cons (nth 0 edges) (nth 1 edges)) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
833 (window-end window) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
834 frame-pos |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
835 (- (window-width window) 1) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
836 nil |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
837 window)))) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
838 (cond |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
839 ((eq p (window-point window)) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
840 'cursor) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
841 ((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
|
842 'region) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
843 (t |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
844 (let ((faces (get-char-property p 'face window))) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
845 (if (consp faces) (car faces) faces))))))) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
846 (t |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
847 nil)))) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
848 |
96699
05aeed7284d3
Fix header format and permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
96684
diff
changeset
|
849 (defvar ns-input-color) ; nsterm.m |
05aeed7284d3
Fix header format and permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
96684
diff
changeset
|
850 |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
851 (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
|
852 "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
|
853 (interactive) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
854 (let* ((pos (mouse-position)) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
855 (frame (car pos)) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
856 (face (ns-face-at-pos pos))) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
857 (cond |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
858 ((eq face 'cursor) |
96699
05aeed7284d3
Fix header format and permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
96684
diff
changeset
|
859 (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
|
860 ns-input-color)))) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
861 ((not face) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
862 (modify-frame-parameters frame (list (cons 'foreground-color |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
863 ns-input-color)))) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
864 (t |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
865 (set-face-foreground face ns-input-color frame))))) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
866 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
867 (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
|
868 "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
|
869 (interactive) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
870 (let* ((pos (mouse-position)) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
871 (frame (car pos)) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
872 (face (ns-face-at-pos pos))) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
873 (cond |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
874 ((eq face 'cursor) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
875 (modify-frame-parameters frame (list (cons 'cursor-color |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
876 ns-input-color)))) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
877 ((not face) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
878 (modify-frame-parameters frame (list (cons 'background-color |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
879 ns-input-color)))) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
880 (t |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
881 (set-face-background face ns-input-color frame))))) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
882 |
96859
2e1af3a60ab7
Standardize references to "Nextstep" in comments, messages, and docstrings.
Chong Yidong <cyd@stupidchicken.com>
parents:
96814
diff
changeset
|
883 ;; 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
|
884 (setq frame-title-format t |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
885 icon-title-format t) |
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 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
888 (defvar ns-initialized nil |
96859
2e1af3a60ab7
Standardize references to "Nextstep" in comments, messages, and docstrings.
Chong Yidong <cyd@stupidchicken.com>
parents:
96814
diff
changeset
|
889 "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
|
890 |
96699
05aeed7284d3
Fix header format and permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
96684
diff
changeset
|
891 (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
|
892 (declare-function x-open-connection "nsfns.m" |
97422
6e551caf98f6
Add declarations for builds without X.
Glenn Morris <rgm@gnu.org>
parents:
97348
diff
changeset
|
893 (display &optional xrm-string must-succeed)) |
96699
05aeed7284d3
Fix header format and permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
96684
diff
changeset
|
894 |
96859
2e1af3a60ab7
Standardize references to "Nextstep" in comments, messages, and docstrings.
Chong Yidong <cyd@stupidchicken.com>
parents:
96814
diff
changeset
|
895 ;; 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
|
896 ;; 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
|
897 (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
|
898 "Initialize Emacs for Nextstep (Cocoa / GNUstep) windowing." |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
899 |
96748
92f7bbffcb45
Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
96707
diff
changeset
|
900 ;; PENDING: not needed? |
111185
050a28bd1797
Remove ns-handle-* functions that duplicate x-handle-*.
Glenn Morris <rgm@gnu.org>
parents:
111183
diff
changeset
|
901 (setq command-line-args (x-handle-args command-line-args)) |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
902 |
96870
30f1368d9cf6
* term/ns-win.el: Rename ns- functions/variables to the
Dan Nicolaescu <dann@ics.uci.edu>
parents:
96859
diff
changeset
|
903 (x-open-connection (system-name) nil t) |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
904 |
96748
92f7bbffcb45
Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
96707
diff
changeset
|
905 (dolist (service (ns-list-services)) |
92f7bbffcb45
Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
96707
diff
changeset
|
906 (if (eq (car service) 'undefined) |
92f7bbffcb45
Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
96707
diff
changeset
|
907 (ns-define-service (cdr service)) |
92f7bbffcb45
Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
96707
diff
changeset
|
908 (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
|
909 (ns-define-service (cdr service))))) |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
910 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
911 (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
|
912 (eq (get-lisp-resource nil "HideOnAutoLaunch") t)) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
913 (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
|
914 |
96748
92f7bbffcb45
Require CL; fix up comment style; reindent.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
96707
diff
changeset
|
915 ;; 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
|
916 (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
|
917 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
918 (setq ns-initialized t)) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
919 |
111185
050a28bd1797
Remove ns-handle-* functions that duplicate x-handle-*.
Glenn Morris <rgm@gnu.org>
parents:
111183
diff
changeset
|
920 (add-to-list 'handle-args-function-alist '(ns . x-handle-args)) |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
921 (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
|
922 (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
|
923 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
924 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
925 (provide 'ns-win) |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
926 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
diff
changeset
|
927 ;;; ns-win.el ends here |