Commit 1a1961c3 authored by David Reitter's avatar David Reitter
Browse files

(ns-make-command-string, ns-grabenv)

(ns-extended-platform-support-mode, menu-bar-ns-file-menu)
(ns-arrange-all-frames, ns-arrange-visible-frames)
(ns-arrange-frames): remove. These functionalities not
available on other (free) platforms will be provided to users
outside the Emacs project in the "ns-platform-support" package.
parent 9250c1e8
......@@ -297,35 +297,6 @@ The properties returned may include `top', `left', `height', and `width'."
(define-key global-map [ns-show-prefs] 'customize)
;; Functions to set environment variables by running a subshell.
;;; Idea based on Nextstep 4.2 distribution, this version of code
;;; based on mac-read-environment-vars-from-shell () by David Reitter.
;;; Mostly used only under ns-extended-platform-support-mode.
(defun ns-make-command-string (cmdlist)
(mapconcat 'identity cmdlist " ; "))
(defun ns-grabenv (&optional shell-path startup)
"Set the Emacs environment using the output of a shell command.
This runs a shell subprocess, and interpret its output as a
series of environment variables to insert into the emacs
SHELL-PATH gives the path to the shell; if nil, this defaults to
the current setting of `shell-file-name'.
STARTUP is a list of commands for the shell to execute; if nil,
this defaults to \"printenv\"."
(let ((shell-file-name (if shell-path shell-path shell-file-name))
(cmd (ns-make-command-string (if startup startup '("printenv")))))
(shell-command cmd t)
(while (search-forward-regexp "^\\([A-Za-z_0-9]+\\)=\\(.*\\)$" nil t)
(setenv (match-string 1)
(if (equal (match-string 1) "PATH")
(concat (getenv "PATH") ":" (match-string 2))
(match-string 2)))))))
;; Set up a number of aliases and other layers to pretend we're using
;; the Choi/Mitsuharu Carbon port.
......@@ -337,49 +308,6 @@ this defaults to \"printenv\"."
(declare-function ns-do-applescript "nsfns.m" (script))
(defalias 'do-applescript 'ns-do-applescript)
(defvar menu-bar-ns-file-menu) ; below
;; Toggle some additional Nextstep-like features that may interfere
;; with users' expectations coming from emacs on other platforms.
(define-minor-mode ns-extended-platform-support-mode
"Toggle Nextstep extended platform support features.
When this mode is active (no modeline indicator):
- File menu is altered slightly in keeping with conventions.
- Screen position is preserved in scrolling.
- Transient mark mode is activated"
:init-value nil
:global t
:group 'ns
(if ns-extended-platform-support-mode
(defun ns-show-manual () "Show section in the Emacs manual"
(info "(emacs) Mac OS / GNUstep"))
(setq where-is-preferred-modifier 'super)
(setq scroll-preserve-screen-position t)
(transient-mark-mode 1)
;; Change file menu to simplify and add a couple of
;; Nextstep-specific items
(easy-menu-remove-item global-map '("menu-bar") 'file)
(easy-menu-add-item global-map '(menu-bar)
(cons "File" menu-bar-ns-file-menu) 'edit)
(define-key menu-bar-help-menu [ns-manual]
'(menu-item "Read the Manual Chapter" ns-show-manual)))
;; Undo everything above.
(fmakunbound 'ns-show-manual)
(setq where-is-preferred-modifier 'nil)
(setq scroll-preserve-screen-position nil)
(transient-mark-mode 0)
(easy-menu-remove-item global-map '("menu-bar") 'file)
(easy-menu-add-item global-map '(menu-bar)
(cons "File" menu-bar-file-menu) 'edit)
(easy-menu-remove-item global-map '("menu-bar" "help-menu") 'ns-manual)
(defun x-setup-function-keys (frame)
"Set up function Keys for Nextstep for frame FRAME."
(unless (terminal-parameter frame 'x-setup-function-keys)
......@@ -539,60 +467,6 @@ this defaults to \"printenv\"."
(define-key menu-bar-help-menu [info-panel]
'("About Emacs..." . ns-do-emacs-info-panel)))
;;;; File menu, replaces standard under ns-extended-platform-support
(defvar menu-bar-ns-file-menu (make-sparse-keymap "File"))
(define-key menu-bar-ns-file-menu [one-window]
'("Remove Splits" . delete-other-windows))
(define-key menu-bar-ns-file-menu [split-window]
'("Split Window" . split-window-vertically))
(define-key menu-bar-ns-file-menu [separator-print] '("--"))
(defvar ns-ps-print-menu-map (make-sparse-keymap "Postscript Print"))
(define-key ns-ps-print-menu-map [ps-print-region]
'("Region (B+W)" . ps-print-region))
(define-key ns-ps-print-menu-map [ps-print-buffer]
'("Buffer (B+W)" . ps-print-buffer))
(define-key ns-ps-print-menu-map [ps-print-region-faces]
'("Region" . ps-print-region-with-faces))
(define-key ns-ps-print-menu-map [ps-print-buffer-faces]
'("Buffer" . ps-print-buffer-with-faces))
(define-key menu-bar-ns-file-menu [postscript-print]
(cons "Postscript Print" ns-ps-print-menu-map))
(define-key menu-bar-ns-file-menu [print-region]
'("Print Region" . print-region))
(define-key menu-bar-ns-file-menu [print-buffer]
'("Print Buffer" . ns-print-buffer))
(define-key menu-bar-ns-file-menu [separator-save] '("--"))
(define-key menu-bar-ns-file-menu [recover-session]
'("Recover Crashed Session" . recover-session))
(define-key menu-bar-ns-file-menu [revert-buffer]
'("Revert Buffer" . revert-buffer))
(define-key menu-bar-ns-file-menu [write-file]
'("Save Buffer As..." . ns-write-file-using-panel))
(define-key menu-bar-ns-file-menu [save-buffer] '("Save Buffer" . save-buffer))
(define-key menu-bar-ns-file-menu [kill-buffer]
'("Kill Current Buffer" . kill-this-buffer))
(define-key menu-bar-ns-file-menu [delete-this-frame]
'("Close Frame" . delete-frame))
(define-key menu-bar-ns-file-menu [separator-open] '("--"))
(define-key menu-bar-ns-file-menu [insert-file]
'("Insert File..." . insert-file))
(define-key menu-bar-ns-file-menu [dired]
'("Open Directory..." . ns-open-file-using-panel))
(define-key menu-bar-ns-file-menu [open-file]
'("Open File..." . ns-open-file-using-panel))
(define-key menu-bar-ns-file-menu [make-frame]
'("New Frame" . make-frame))
;;;; Edit menu: Modify slightly
;; Substitute a Copy function that works better under X (for GNUstep).
......@@ -624,40 +498,6 @@ this defaults to \"printenv\"."
(define-key-after menu-bar-edit-menu [separator-undo] '("--") 'undo)
(define-key-after menu-bar-edit-menu [spell] '("Spell" . ispell-menu-map) 'fill)
;; ns-arrange functions contributed
;; by Eberhard Mandler <mandler@dbag.ulm.DaimlerBenz.COM>
(defun ns-arrange-all-frames ()
"Arranges all frames according to topline"
(ns-arrange-frames t))
(defun ns-arrange-visible-frames ()
"Arranges all visible frames according to topline"
(ns-arrange-frames nil))
(defun ns-arrange-frames (vis)
(let ((frame (next-frame))
(end-frame (selected-frame))
(inc-x 20) ;relative position of frames
(inc-y 22)
(x-pos 100) ;start position
(y-pos 40)
(done nil))
(while (not done) ;cycle through all frames
(if (not (or vis (eq (frame-visible-p frame) t)))
(setq x-pos x-pos); do nothing; true case
(set-frame-position frame x-pos y-pos)
(setq x-pos (+ x-pos inc-x))
(setq y-pos (+ y-pos inc-y))
(raise-frame frame))
(select-frame frame)
(setq frame (next-frame))
(setq done (equal frame end-frame)))
(set-frame-position end-frame x-pos y-pos)
(raise-frame frame)
(select-frame frame)))
;;;; Services
(declare-function ns-perform-service "nsfns.m" (service send))
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment