initial-frame-alist)))
(defvar x-display-name nil
- "The X display name specifying server and X frame.")
+ "The name of the X display on which Emacs was started.
+
+For the X display name of individual frames, see the `display'
+frame parameter.")
(defun x-handle-display (switch)
+ "Handle -display DISPLAY option."
(setq x-display-name (car x-invocation-args)
x-invocation-args (cdr x-invocation-args))
;; Make subshell programs see the same DISPLAY value Emacs really uses.
(t
(setq x-last-selected-text-cut text
x-last-selected-text-cut-encoded
- (encode-coding-string text (or locale-coding-system
- 'iso-latin-1)))
+ ;; ICCCM says cut buffer always contain ISO-Latin-1
+ (encode-coding-string text 'iso-latin-1))
(x-set-cut-buffer x-last-selected-text-cut-encoded push)))
(x-set-selection 'PRIMARY text)
(setq x-last-selected-text-primary text)
(t
(setq x-last-selected-text-cut-encoded cut-text
x-last-selected-text-cut
- (decode-coding-string cut-text (or locale-coding-system
- 'iso-latin-1))))))
+ ;; ICCCM says cut buffer always contain ISO-Latin-1
+ (decode-coding-string cut-text 'iso-latin-1)))))
;; As we have done one selection, clear this now.
(setq next-selection-coding-system nil)
(cons '(user-size . t) parsed))))
;; All geometry parms apply to the initial frame.
(setq initial-frame-alist (append initial-frame-alist parsed))
- ;; The size parms apply to all frames.
- (if (assq 'height parsed)
+ ;; The size parms apply to all frames. Don't set it if there are
+ ;; sizes there already (from command line).
+ (if (and (assq 'height parsed)
+ (not (assq 'height default-frame-alist)))
(setq default-frame-alist
(cons (cons 'height (cdr (assq 'height parsed)))
default-frame-alist)))
- (if (assq 'width parsed)
+ (if (and (assq 'width parsed)
+ (not (assq 'width default-frame-alist)))
(setq default-frame-alist
(cons (cons 'width (cdr (assq 'width parsed)))
default-frame-alist))))))
;; Override Paste so it looks at CLIPBOARD first.
(defun x-clipboard-yank ()
"Insert the clipboard contents, or the last stretch of killed text."
- (interactive)
+ (interactive "*")
(let ((clipboard-text (x-selection-value 'CLIPBOARD))
(x-select-enable-clipboard t))
(if (and clipboard-text (> (length clipboard-text) 0))
(yank)))
(define-key menu-bar-edit-menu [paste]
- (cons "Paste" (cons "Paste text from clipboard or kill ring"
- 'x-clipboard-yank)))
+ '(menu-item "Paste" x-clipboard-yank
+ :enable (not buffer-read-only)
+ :help "Paste (yank) text most recently cut/copied"))
;; Initiate drag and drop
(add-hook 'after-make-frame-functions 'x-dnd-init-frame)
-(global-set-key [drag-n-drop] 'x-dnd-handle-drag-n-drop-event)
+(define-key special-event-map [drag-n-drop] 'x-dnd-handle-drag-n-drop-event)
+
+;; Let F10 do menu bar navigation.
+(defun x-menu-bar-open (&optional frame)
+ "Open the menu bar if `menu-bar-mode' is on. otherwise call `tmm-menubar'."
+ (interactive "i")
+ (if menu-bar-mode (menu-bar-open frame)
+ (tmm-menubar)))
+
+(and (fboundp 'menu-bar-open)
+ (global-set-key [f10] 'x-menu-bar-open))
;; arch-tag: f1501302-db8b-4d95-88e3-116697d89f78
;;; x-win.el ends here