2021-04-19 10:21:01 +00:00
|
|
|
|
;;; dframe.el --- dedicate frame support modes -*- lexical-binding:t -*-
|
2005-09-30 13:18:43 +00:00
|
|
|
|
|
2024-01-02 01:47:10 +00:00
|
|
|
|
;; Copyright (C) 1996-2024 Free Software Foundation, Inc.
|
2005-09-30 13:18:43 +00:00
|
|
|
|
|
|
|
|
|
;; Author: Eric M. Ludlam <zappo@gnu.org>
|
|
|
|
|
;; Keywords: file, tags, tools
|
|
|
|
|
|
|
|
|
|
;; This file is part of GNU Emacs.
|
|
|
|
|
|
2008-05-06 08:06:51 +00:00
|
|
|
|
;; GNU Emacs is free software: you can redistribute it and/or modify
|
2005-09-30 13:18:43 +00:00
|
|
|
|
;; it under the terms of the GNU General Public License as published by
|
2008-05-06 08:06:51 +00:00
|
|
|
|
;; the Free Software Foundation, either version 3 of the License, or
|
|
|
|
|
;; (at your option) any later version.
|
2005-09-30 13:18:43 +00:00
|
|
|
|
|
|
|
|
|
;; GNU Emacs is distributed in the hope that it will be useful,
|
|
|
|
|
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
;; GNU General Public License for more details.
|
|
|
|
|
|
|
|
|
|
;; You should have received a copy of the GNU General Public License
|
2017-09-13 22:52:52 +00:00
|
|
|
|
;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
|
2005-09-30 13:18:43 +00:00
|
|
|
|
|
|
|
|
|
;;; Commentary:
|
|
|
|
|
;;
|
|
|
|
|
;; This code was developed and maintained as a part of speedbar since 1996.
|
|
|
|
|
;; It became its own support utility in Aug 2000.
|
|
|
|
|
;;
|
|
|
|
|
;; Dedicated frame mode is an Emacs independent library for supporting
|
|
|
|
|
;; a program/buffer combination that resides in a dedicated frame.
|
|
|
|
|
;; Support of this nature requires several complex interactions with the
|
|
|
|
|
;; user which this library will provide, including:
|
|
|
|
|
;;
|
|
|
|
|
;; * Creation of a frame. Positioned relatively.
|
|
|
|
|
;; Includes a frame cache for User position caching.
|
|
|
|
|
;; * Switching between frames.
|
|
|
|
|
;; * Timed activities using idle-timers
|
|
|
|
|
;; * Frame/buffer killing hooks
|
|
|
|
|
;; * Mouse-3 position relative menu
|
|
|
|
|
;; * Mouse motion, help-echo hacks
|
2019-09-08 22:24:18 +00:00
|
|
|
|
;; * Mouse clicking & double clicking
|
2005-09-30 13:18:43 +00:00
|
|
|
|
;; * Mode line hacking
|
|
|
|
|
;; * Utilities for use in a program covering:
|
|
|
|
|
;; o keymap massage for some actions
|
|
|
|
|
;; o working with an associated buffer
|
|
|
|
|
;; o shift-click
|
|
|
|
|
;; o detaching a frame
|
|
|
|
|
;; o focus-shifting & optional frame jumping
|
|
|
|
|
;; o currently active frame.
|
|
|
|
|
;; o message/y-or-n-p
|
|
|
|
|
;; o mouse set point
|
|
|
|
|
;;
|
|
|
|
|
;; To Use:
|
|
|
|
|
;; 1) (require 'dframe)
|
|
|
|
|
;; 2) Variable Setup:
|
|
|
|
|
;; -frame-parameters -- Frame parameters for Emacs.
|
|
|
|
|
;; -- Not on parameter lists: They can optionally include width
|
|
|
|
|
;; and height. If width or height is not included, then it will
|
|
|
|
|
;; be provided to match the originating frame. In general,
|
|
|
|
|
;; turning off the menu bar, mode line, and minibuffer can
|
|
|
|
|
;; provide a smaller window, or more display area.
|
|
|
|
|
;; -track-mouse-flag -- mouse tracking on/off specific to your tool.
|
|
|
|
|
;; -update-flag -- app toggle for timer use. Init from
|
|
|
|
|
;; `dframe-have-timer-flag'. This is nil for terminals, since
|
|
|
|
|
;; updating a frame in a terminal is not useful to the user.
|
|
|
|
|
;; -key-map -- Your keymap. Call `dframe-update-keymap' on it.
|
|
|
|
|
;; -buffer, -frame, -cached-frame -- Variables used to track your
|
|
|
|
|
;; applications buffer, frame, or frame cache (when hidden). See
|
|
|
|
|
;; `dframe-frame-mode' for details.
|
|
|
|
|
;; -before-delete-hook, -before-popup-hook, -after-create-hook --
|
|
|
|
|
;; Hooks to have called. The `-after-create-hook' probably wants
|
|
|
|
|
;; to call a function which calls `dframe-reposition-frame' in an
|
|
|
|
|
;; appropriate manner.
|
|
|
|
|
;; 3) Function Setup:
|
|
|
|
|
;; your-frame-mode -- function to toggle your app frame on and off.
|
|
|
|
|
;; its tasks are:
|
|
|
|
|
;; a) create a buffer
|
|
|
|
|
;; b) Call `dframe-frame-mode'. (See its doc)
|
|
|
|
|
;; c) If successful (your -frame variable has a value), call
|
|
|
|
|
;; timer setup if applicable.
|
|
|
|
|
;; your-frame-reposition- -- Function to call from after-create-hook to
|
2011-11-20 07:30:16 +00:00
|
|
|
|
;; reposition your frame with `dframe-reposition-frame'.
|
2005-09-30 13:18:43 +00:00
|
|
|
|
;; your-mode -- Set up the major mode of the buffer for your app.
|
|
|
|
|
;; Set these variables: dframe-track-mouse-function,
|
|
|
|
|
;; dframe-help-echo-function,
|
|
|
|
|
;; dframe-mouse-click-function,
|
|
|
|
|
;; dframe-mouse-position-function.
|
|
|
|
|
;; See speedbar's implementation of these functions.
|
|
|
|
|
;; `speedbar-current-frame', `speedbar-get-focus', `speedbar-message',
|
|
|
|
|
;; `speedbar-y-or-n-p', `speedbar-set-timer', `speedbar-click',
|
|
|
|
|
;; `speedbar-position-cursor-on-line'
|
|
|
|
|
;; 4) Handling mouse clicks, and help text:
|
|
|
|
|
;; dframe-track-mouse, dframe-help-echo-function --
|
|
|
|
|
;; These variables need to be set to functions that display info
|
|
|
|
|
;; based on the mouse's position.
|
2011-11-20 02:29:42 +00:00
|
|
|
|
;; Text property 'help-echo, set to `dframe-help-echo', which will
|
2005-09-30 13:18:43 +00:00
|
|
|
|
;; call `dframe-help-echo-function'.
|
|
|
|
|
;; Have a `-click' function, it can call `dframe-quick-mouse' for
|
|
|
|
|
;; positioning. If the variable `dframe-power-click' is non-nil,
|
|
|
|
|
;; then `shift' was held down during the click.
|
|
|
|
|
|
|
|
|
|
;;; Bugs
|
|
|
|
|
;;
|
|
|
|
|
;; * The timer managers doesn't handle multiple different timeouts.
|
2008-04-23 02:57:11 +00:00
|
|
|
|
;; * You can't specify continuous timeouts (as opposed to just idle timers.)
|
2005-09-30 13:18:43 +00:00
|
|
|
|
|
2005-10-06 08:19:10 +00:00
|
|
|
|
(defvar x-pointer-hand2)
|
|
|
|
|
(defvar x-pointer-top-left-arrow)
|
|
|
|
|
|
2005-09-30 13:18:43 +00:00
|
|
|
|
;;; Code:
|
|
|
|
|
|
2019-09-08 22:24:18 +00:00
|
|
|
|
|
|
|
|
|
(define-obsolete-function-alias 'dframe-frame-parameter
|
|
|
|
|
'frame-parameter "27.1")
|
2005-09-30 13:18:43 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;;; Variables
|
|
|
|
|
;;
|
|
|
|
|
(defgroup dframe nil
|
|
|
|
|
"Faces used in dframe."
|
|
|
|
|
:prefix "dframe-"
|
|
|
|
|
:group 'dframe)
|
|
|
|
|
|
2022-05-14 20:36:36 +00:00
|
|
|
|
(defvar dframe-have-timer-flag (display-graphic-p)
|
2008-04-23 02:57:11 +00:00
|
|
|
|
"Non-nil means that timers are available for this Emacs.
|
|
|
|
|
This is nil for terminals, since updating a frame in a terminal
|
|
|
|
|
is not useful to the user.")
|
2005-09-30 13:18:43 +00:00
|
|
|
|
|
2019-06-19 20:07:44 +00:00
|
|
|
|
(defcustom dframe-update-speed 1
|
2007-08-23 18:18:26 +00:00
|
|
|
|
"Idle time in seconds needed before dframe will update itself.
|
2005-09-30 13:18:43 +00:00
|
|
|
|
Updates occur to allow dframe to display directory information
|
|
|
|
|
relevant to the buffer you are currently editing."
|
|
|
|
|
:group 'dframe
|
|
|
|
|
:type 'integer)
|
|
|
|
|
|
|
|
|
|
(defcustom dframe-activity-change-focus-flag nil
|
2007-08-23 18:18:26 +00:00
|
|
|
|
"Non-nil means the selected frame will change based on activity.
|
2005-09-30 13:18:43 +00:00
|
|
|
|
Thus, if a file is selected for edit, the buffer will appear in the
|
|
|
|
|
selected frame and the focus will change to that frame."
|
|
|
|
|
:group 'dframe
|
|
|
|
|
:type 'boolean)
|
|
|
|
|
|
|
|
|
|
(defcustom dframe-after-select-attached-frame-hook nil
|
2007-08-23 18:18:26 +00:00
|
|
|
|
"Hook run after dframe has selected the attached frame."
|
2005-09-30 13:18:43 +00:00
|
|
|
|
:group 'dframe
|
|
|
|
|
:type 'hook)
|
|
|
|
|
|
Prefer defvar-local in remaining libraries
* lisp/align.el (align-mode-rules-list)
(align-mode-exclude-rules-list):
* lisp/bookmark.el (bookmark-current-bookmark)
(bookmark-annotation-name)
(bookmark--annotation-from-bookmark-list):
* lisp/calc/calc-embed.el (calc-embedded-all-active)
(calc-embedded-some-active):
* lisp/comint.el (comint-password-function):
* lisp/completion.el (completion-syntax-table):
* lisp/dframe.el (dframe-track-mouse-function)
(dframe-help-echo-function, dframe-mouse-click-function)
(dframe-mouse-position-function, dframe-timer)
(dframe-attached-frame, dframe-controlled):
* lisp/ehelp.el (electric-help-orig-major-mode):
* lisp/eshell/esh-util.el (eshell-path-env):
* lisp/expand.el (expand-pos, expand-index, expand-point):
* lisp/face-remap.el (text-scale-mode-remapping)
(text-scale-mode-lighter, text-scale-mode-amount)
(text-scale-remap-header-line, buffer-face-mode-remapping):
* lisp/ffap.el (ffap-menu-alist):
* lisp/files-x.el (connection-local-variables-alist):
* lisp/foldout.el (foldout-fold-list, foldout-mode-line-string):
* lisp/follow.el (follow-start-end-invalid):
* lisp/forms.el (forms--mode-setup):
* lisp/gnus/message.el (message-cross-post-old-target)
(message-options):
* lisp/help-mode.el (help-xref-stack, help-xref-forward-stack)
(help-xref-stack-item, help-xref-stack-forward-item):
* lisp/hexl.el (hexl-mode--old-var-vals, hexl-ascii-overlay):
* lisp/hilit-chg.el (hilit-chg-string):
* lisp/ido.el (ido-eoinput):
* lisp/imenu.el (imenu-generic-expression)
(imenu-create-index-function, imenu-default-goto-function)
(imenu-prev-index-position-function)
(imenu-extract-index-name-function, imenu-name-lookup-function)
(imenu-syntax-alist, imenu-case-fold-search):
* lisp/jka-compr.el (jka-compr-really-do-compress):
* lisp/language/ethio-util.el (ethio-prefer-ascii-space):
* lisp/leim/quail/hangul.el (hangul-input-method-help-text):
* lisp/leim/quail/japanese.el (quail-japanese-package-saved):
* lisp/linum.el (linum-overlays, linum-available):
* lisp/man.el (Man-original-frame, Man-arguments, Man--sections)
(Man--refpages, Man-page-list, Man-current-page)
(Man-page-mode-string):
* lisp/pcomplete.el (pcomplete-current-completions)
(pcomplete-last-completion-length)
(pcomplete-last-completion-stub, pcomplete-last-completion-raw)
(pcomplete-last-window-config, pcomplete-window-restore-timer):
* lisp/reveal.el (reveal-open-spots, reveal-last-tick):
* lisp/ruler-mode.el (ruler-mode):
* lisp/scroll-lock.el (scroll-lock-preserve-screen-pos-save):
* lisp/server.el (server-buffer-clients, server-existing-buffer):
* lisp/tab-line.el (tab-line-exclude):
* lisp/tar-mode.el (tar-data-buffer, tar-data-swapped):
* lisp/thumbs.el (thumbs-current-tmp-filename)
(thumbs-current-image-filename, thumbs-extra-images)
(thumbs-image-num, thumbs-buffer, thumbs-marked-list):
* lisp/tutorial.el (tutorial--point-before-chkeys)
(tutorial--point-after-chkeys, tutorial--lang):
* lisp/url/url-vars.el (url-current-object)
(url-current-mime-headers, url-current-lastloc):
* lisp/view.el (view-mode, view-old-buffer-read-only)
(view-old-Helper-return-blurb, view-page-size)
(view-half-page-size, view-last-regexp, view-return-to-alist)
(view-exit-action, view-overlay):
* lisp/wid-edit.el (widget-global-map, widget-field-new)
(widget-field-list, widget-field-last, widget-field-was):
* lisp/woman.el (woman-imenu-done): Prefer defvar-local.
2021-02-02 08:55:40 +00:00
|
|
|
|
(defvar-local dframe-track-mouse-function nil
|
2012-04-09 13:05:48 +00:00
|
|
|
|
"A function to call when the mouse is moved in the given frame.
|
2005-09-30 13:18:43 +00:00
|
|
|
|
Typically used to display info about the line under the mouse.")
|
|
|
|
|
|
Prefer defvar-local in remaining libraries
* lisp/align.el (align-mode-rules-list)
(align-mode-exclude-rules-list):
* lisp/bookmark.el (bookmark-current-bookmark)
(bookmark-annotation-name)
(bookmark--annotation-from-bookmark-list):
* lisp/calc/calc-embed.el (calc-embedded-all-active)
(calc-embedded-some-active):
* lisp/comint.el (comint-password-function):
* lisp/completion.el (completion-syntax-table):
* lisp/dframe.el (dframe-track-mouse-function)
(dframe-help-echo-function, dframe-mouse-click-function)
(dframe-mouse-position-function, dframe-timer)
(dframe-attached-frame, dframe-controlled):
* lisp/ehelp.el (electric-help-orig-major-mode):
* lisp/eshell/esh-util.el (eshell-path-env):
* lisp/expand.el (expand-pos, expand-index, expand-point):
* lisp/face-remap.el (text-scale-mode-remapping)
(text-scale-mode-lighter, text-scale-mode-amount)
(text-scale-remap-header-line, buffer-face-mode-remapping):
* lisp/ffap.el (ffap-menu-alist):
* lisp/files-x.el (connection-local-variables-alist):
* lisp/foldout.el (foldout-fold-list, foldout-mode-line-string):
* lisp/follow.el (follow-start-end-invalid):
* lisp/forms.el (forms--mode-setup):
* lisp/gnus/message.el (message-cross-post-old-target)
(message-options):
* lisp/help-mode.el (help-xref-stack, help-xref-forward-stack)
(help-xref-stack-item, help-xref-stack-forward-item):
* lisp/hexl.el (hexl-mode--old-var-vals, hexl-ascii-overlay):
* lisp/hilit-chg.el (hilit-chg-string):
* lisp/ido.el (ido-eoinput):
* lisp/imenu.el (imenu-generic-expression)
(imenu-create-index-function, imenu-default-goto-function)
(imenu-prev-index-position-function)
(imenu-extract-index-name-function, imenu-name-lookup-function)
(imenu-syntax-alist, imenu-case-fold-search):
* lisp/jka-compr.el (jka-compr-really-do-compress):
* lisp/language/ethio-util.el (ethio-prefer-ascii-space):
* lisp/leim/quail/hangul.el (hangul-input-method-help-text):
* lisp/leim/quail/japanese.el (quail-japanese-package-saved):
* lisp/linum.el (linum-overlays, linum-available):
* lisp/man.el (Man-original-frame, Man-arguments, Man--sections)
(Man--refpages, Man-page-list, Man-current-page)
(Man-page-mode-string):
* lisp/pcomplete.el (pcomplete-current-completions)
(pcomplete-last-completion-length)
(pcomplete-last-completion-stub, pcomplete-last-completion-raw)
(pcomplete-last-window-config, pcomplete-window-restore-timer):
* lisp/reveal.el (reveal-open-spots, reveal-last-tick):
* lisp/ruler-mode.el (ruler-mode):
* lisp/scroll-lock.el (scroll-lock-preserve-screen-pos-save):
* lisp/server.el (server-buffer-clients, server-existing-buffer):
* lisp/tab-line.el (tab-line-exclude):
* lisp/tar-mode.el (tar-data-buffer, tar-data-swapped):
* lisp/thumbs.el (thumbs-current-tmp-filename)
(thumbs-current-image-filename, thumbs-extra-images)
(thumbs-image-num, thumbs-buffer, thumbs-marked-list):
* lisp/tutorial.el (tutorial--point-before-chkeys)
(tutorial--point-after-chkeys, tutorial--lang):
* lisp/url/url-vars.el (url-current-object)
(url-current-mime-headers, url-current-lastloc):
* lisp/view.el (view-mode, view-old-buffer-read-only)
(view-old-Helper-return-blurb, view-page-size)
(view-half-page-size, view-last-regexp, view-return-to-alist)
(view-exit-action, view-overlay):
* lisp/wid-edit.el (widget-global-map, widget-field-new)
(widget-field-list, widget-field-last, widget-field-was):
* lisp/woman.el (woman-imenu-done): Prefer defvar-local.
2021-02-02 08:55:40 +00:00
|
|
|
|
(defvar-local dframe-help-echo-function nil
|
2012-04-09 13:05:48 +00:00
|
|
|
|
"A function to call when help-echo is used in newer versions of Emacs.
|
2005-09-30 13:18:43 +00:00
|
|
|
|
Typically used to display info about the line under the mouse.")
|
|
|
|
|
|
Prefer defvar-local in remaining libraries
* lisp/align.el (align-mode-rules-list)
(align-mode-exclude-rules-list):
* lisp/bookmark.el (bookmark-current-bookmark)
(bookmark-annotation-name)
(bookmark--annotation-from-bookmark-list):
* lisp/calc/calc-embed.el (calc-embedded-all-active)
(calc-embedded-some-active):
* lisp/comint.el (comint-password-function):
* lisp/completion.el (completion-syntax-table):
* lisp/dframe.el (dframe-track-mouse-function)
(dframe-help-echo-function, dframe-mouse-click-function)
(dframe-mouse-position-function, dframe-timer)
(dframe-attached-frame, dframe-controlled):
* lisp/ehelp.el (electric-help-orig-major-mode):
* lisp/eshell/esh-util.el (eshell-path-env):
* lisp/expand.el (expand-pos, expand-index, expand-point):
* lisp/face-remap.el (text-scale-mode-remapping)
(text-scale-mode-lighter, text-scale-mode-amount)
(text-scale-remap-header-line, buffer-face-mode-remapping):
* lisp/ffap.el (ffap-menu-alist):
* lisp/files-x.el (connection-local-variables-alist):
* lisp/foldout.el (foldout-fold-list, foldout-mode-line-string):
* lisp/follow.el (follow-start-end-invalid):
* lisp/forms.el (forms--mode-setup):
* lisp/gnus/message.el (message-cross-post-old-target)
(message-options):
* lisp/help-mode.el (help-xref-stack, help-xref-forward-stack)
(help-xref-stack-item, help-xref-stack-forward-item):
* lisp/hexl.el (hexl-mode--old-var-vals, hexl-ascii-overlay):
* lisp/hilit-chg.el (hilit-chg-string):
* lisp/ido.el (ido-eoinput):
* lisp/imenu.el (imenu-generic-expression)
(imenu-create-index-function, imenu-default-goto-function)
(imenu-prev-index-position-function)
(imenu-extract-index-name-function, imenu-name-lookup-function)
(imenu-syntax-alist, imenu-case-fold-search):
* lisp/jka-compr.el (jka-compr-really-do-compress):
* lisp/language/ethio-util.el (ethio-prefer-ascii-space):
* lisp/leim/quail/hangul.el (hangul-input-method-help-text):
* lisp/leim/quail/japanese.el (quail-japanese-package-saved):
* lisp/linum.el (linum-overlays, linum-available):
* lisp/man.el (Man-original-frame, Man-arguments, Man--sections)
(Man--refpages, Man-page-list, Man-current-page)
(Man-page-mode-string):
* lisp/pcomplete.el (pcomplete-current-completions)
(pcomplete-last-completion-length)
(pcomplete-last-completion-stub, pcomplete-last-completion-raw)
(pcomplete-last-window-config, pcomplete-window-restore-timer):
* lisp/reveal.el (reveal-open-spots, reveal-last-tick):
* lisp/ruler-mode.el (ruler-mode):
* lisp/scroll-lock.el (scroll-lock-preserve-screen-pos-save):
* lisp/server.el (server-buffer-clients, server-existing-buffer):
* lisp/tab-line.el (tab-line-exclude):
* lisp/tar-mode.el (tar-data-buffer, tar-data-swapped):
* lisp/thumbs.el (thumbs-current-tmp-filename)
(thumbs-current-image-filename, thumbs-extra-images)
(thumbs-image-num, thumbs-buffer, thumbs-marked-list):
* lisp/tutorial.el (tutorial--point-before-chkeys)
(tutorial--point-after-chkeys, tutorial--lang):
* lisp/url/url-vars.el (url-current-object)
(url-current-mime-headers, url-current-lastloc):
* lisp/view.el (view-mode, view-old-buffer-read-only)
(view-old-Helper-return-blurb, view-page-size)
(view-half-page-size, view-last-regexp, view-return-to-alist)
(view-exit-action, view-overlay):
* lisp/wid-edit.el (widget-global-map, widget-field-new)
(widget-field-list, widget-field-last, widget-field-was):
* lisp/woman.el (woman-imenu-done): Prefer defvar-local.
2021-02-02 08:55:40 +00:00
|
|
|
|
(defvar-local dframe-mouse-click-function nil
|
2012-04-09 13:05:48 +00:00
|
|
|
|
"A function to call when the mouse is clicked.
|
2005-09-30 13:18:43 +00:00
|
|
|
|
Valid clicks are mouse 2, our double mouse 1.")
|
|
|
|
|
|
Prefer defvar-local in remaining libraries
* lisp/align.el (align-mode-rules-list)
(align-mode-exclude-rules-list):
* lisp/bookmark.el (bookmark-current-bookmark)
(bookmark-annotation-name)
(bookmark--annotation-from-bookmark-list):
* lisp/calc/calc-embed.el (calc-embedded-all-active)
(calc-embedded-some-active):
* lisp/comint.el (comint-password-function):
* lisp/completion.el (completion-syntax-table):
* lisp/dframe.el (dframe-track-mouse-function)
(dframe-help-echo-function, dframe-mouse-click-function)
(dframe-mouse-position-function, dframe-timer)
(dframe-attached-frame, dframe-controlled):
* lisp/ehelp.el (electric-help-orig-major-mode):
* lisp/eshell/esh-util.el (eshell-path-env):
* lisp/expand.el (expand-pos, expand-index, expand-point):
* lisp/face-remap.el (text-scale-mode-remapping)
(text-scale-mode-lighter, text-scale-mode-amount)
(text-scale-remap-header-line, buffer-face-mode-remapping):
* lisp/ffap.el (ffap-menu-alist):
* lisp/files-x.el (connection-local-variables-alist):
* lisp/foldout.el (foldout-fold-list, foldout-mode-line-string):
* lisp/follow.el (follow-start-end-invalid):
* lisp/forms.el (forms--mode-setup):
* lisp/gnus/message.el (message-cross-post-old-target)
(message-options):
* lisp/help-mode.el (help-xref-stack, help-xref-forward-stack)
(help-xref-stack-item, help-xref-stack-forward-item):
* lisp/hexl.el (hexl-mode--old-var-vals, hexl-ascii-overlay):
* lisp/hilit-chg.el (hilit-chg-string):
* lisp/ido.el (ido-eoinput):
* lisp/imenu.el (imenu-generic-expression)
(imenu-create-index-function, imenu-default-goto-function)
(imenu-prev-index-position-function)
(imenu-extract-index-name-function, imenu-name-lookup-function)
(imenu-syntax-alist, imenu-case-fold-search):
* lisp/jka-compr.el (jka-compr-really-do-compress):
* lisp/language/ethio-util.el (ethio-prefer-ascii-space):
* lisp/leim/quail/hangul.el (hangul-input-method-help-text):
* lisp/leim/quail/japanese.el (quail-japanese-package-saved):
* lisp/linum.el (linum-overlays, linum-available):
* lisp/man.el (Man-original-frame, Man-arguments, Man--sections)
(Man--refpages, Man-page-list, Man-current-page)
(Man-page-mode-string):
* lisp/pcomplete.el (pcomplete-current-completions)
(pcomplete-last-completion-length)
(pcomplete-last-completion-stub, pcomplete-last-completion-raw)
(pcomplete-last-window-config, pcomplete-window-restore-timer):
* lisp/reveal.el (reveal-open-spots, reveal-last-tick):
* lisp/ruler-mode.el (ruler-mode):
* lisp/scroll-lock.el (scroll-lock-preserve-screen-pos-save):
* lisp/server.el (server-buffer-clients, server-existing-buffer):
* lisp/tab-line.el (tab-line-exclude):
* lisp/tar-mode.el (tar-data-buffer, tar-data-swapped):
* lisp/thumbs.el (thumbs-current-tmp-filename)
(thumbs-current-image-filename, thumbs-extra-images)
(thumbs-image-num, thumbs-buffer, thumbs-marked-list):
* lisp/tutorial.el (tutorial--point-before-chkeys)
(tutorial--point-after-chkeys, tutorial--lang):
* lisp/url/url-vars.el (url-current-object)
(url-current-mime-headers, url-current-lastloc):
* lisp/view.el (view-mode, view-old-buffer-read-only)
(view-old-Helper-return-blurb, view-page-size)
(view-half-page-size, view-last-regexp, view-return-to-alist)
(view-exit-action, view-overlay):
* lisp/wid-edit.el (widget-global-map, widget-field-new)
(widget-field-list, widget-field-last, widget-field-was):
* lisp/woman.el (woman-imenu-done): Prefer defvar-local.
2021-02-02 08:55:40 +00:00
|
|
|
|
(defvar-local dframe-mouse-position-function nil
|
2012-04-09 13:05:48 +00:00
|
|
|
|
"A function to call to position the cursor for a mouse click.")
|
2005-09-30 13:18:43 +00:00
|
|
|
|
|
|
|
|
|
(defvar dframe-power-click nil
|
|
|
|
|
"Never set this by hand. Value is t when S-mouse activity occurs.")
|
|
|
|
|
|
Prefer defvar-local in remaining libraries
* lisp/align.el (align-mode-rules-list)
(align-mode-exclude-rules-list):
* lisp/bookmark.el (bookmark-current-bookmark)
(bookmark-annotation-name)
(bookmark--annotation-from-bookmark-list):
* lisp/calc/calc-embed.el (calc-embedded-all-active)
(calc-embedded-some-active):
* lisp/comint.el (comint-password-function):
* lisp/completion.el (completion-syntax-table):
* lisp/dframe.el (dframe-track-mouse-function)
(dframe-help-echo-function, dframe-mouse-click-function)
(dframe-mouse-position-function, dframe-timer)
(dframe-attached-frame, dframe-controlled):
* lisp/ehelp.el (electric-help-orig-major-mode):
* lisp/eshell/esh-util.el (eshell-path-env):
* lisp/expand.el (expand-pos, expand-index, expand-point):
* lisp/face-remap.el (text-scale-mode-remapping)
(text-scale-mode-lighter, text-scale-mode-amount)
(text-scale-remap-header-line, buffer-face-mode-remapping):
* lisp/ffap.el (ffap-menu-alist):
* lisp/files-x.el (connection-local-variables-alist):
* lisp/foldout.el (foldout-fold-list, foldout-mode-line-string):
* lisp/follow.el (follow-start-end-invalid):
* lisp/forms.el (forms--mode-setup):
* lisp/gnus/message.el (message-cross-post-old-target)
(message-options):
* lisp/help-mode.el (help-xref-stack, help-xref-forward-stack)
(help-xref-stack-item, help-xref-stack-forward-item):
* lisp/hexl.el (hexl-mode--old-var-vals, hexl-ascii-overlay):
* lisp/hilit-chg.el (hilit-chg-string):
* lisp/ido.el (ido-eoinput):
* lisp/imenu.el (imenu-generic-expression)
(imenu-create-index-function, imenu-default-goto-function)
(imenu-prev-index-position-function)
(imenu-extract-index-name-function, imenu-name-lookup-function)
(imenu-syntax-alist, imenu-case-fold-search):
* lisp/jka-compr.el (jka-compr-really-do-compress):
* lisp/language/ethio-util.el (ethio-prefer-ascii-space):
* lisp/leim/quail/hangul.el (hangul-input-method-help-text):
* lisp/leim/quail/japanese.el (quail-japanese-package-saved):
* lisp/linum.el (linum-overlays, linum-available):
* lisp/man.el (Man-original-frame, Man-arguments, Man--sections)
(Man--refpages, Man-page-list, Man-current-page)
(Man-page-mode-string):
* lisp/pcomplete.el (pcomplete-current-completions)
(pcomplete-last-completion-length)
(pcomplete-last-completion-stub, pcomplete-last-completion-raw)
(pcomplete-last-window-config, pcomplete-window-restore-timer):
* lisp/reveal.el (reveal-open-spots, reveal-last-tick):
* lisp/ruler-mode.el (ruler-mode):
* lisp/scroll-lock.el (scroll-lock-preserve-screen-pos-save):
* lisp/server.el (server-buffer-clients, server-existing-buffer):
* lisp/tab-line.el (tab-line-exclude):
* lisp/tar-mode.el (tar-data-buffer, tar-data-swapped):
* lisp/thumbs.el (thumbs-current-tmp-filename)
(thumbs-current-image-filename, thumbs-extra-images)
(thumbs-image-num, thumbs-buffer, thumbs-marked-list):
* lisp/tutorial.el (tutorial--point-before-chkeys)
(tutorial--point-after-chkeys, tutorial--lang):
* lisp/url/url-vars.el (url-current-object)
(url-current-mime-headers, url-current-lastloc):
* lisp/view.el (view-mode, view-old-buffer-read-only)
(view-old-Helper-return-blurb, view-page-size)
(view-half-page-size, view-last-regexp, view-return-to-alist)
(view-exit-action, view-overlay):
* lisp/wid-edit.el (widget-global-map, widget-field-new)
(widget-field-list, widget-field-last, widget-field-was):
* lisp/woman.el (woman-imenu-done): Prefer defvar-local.
2021-02-02 08:55:40 +00:00
|
|
|
|
(defvar-local dframe-timer nil
|
2005-09-30 13:18:43 +00:00
|
|
|
|
"The dframe timer used for updating the buffer.")
|
|
|
|
|
|
Prefer defvar-local in remaining libraries
* lisp/align.el (align-mode-rules-list)
(align-mode-exclude-rules-list):
* lisp/bookmark.el (bookmark-current-bookmark)
(bookmark-annotation-name)
(bookmark--annotation-from-bookmark-list):
* lisp/calc/calc-embed.el (calc-embedded-all-active)
(calc-embedded-some-active):
* lisp/comint.el (comint-password-function):
* lisp/completion.el (completion-syntax-table):
* lisp/dframe.el (dframe-track-mouse-function)
(dframe-help-echo-function, dframe-mouse-click-function)
(dframe-mouse-position-function, dframe-timer)
(dframe-attached-frame, dframe-controlled):
* lisp/ehelp.el (electric-help-orig-major-mode):
* lisp/eshell/esh-util.el (eshell-path-env):
* lisp/expand.el (expand-pos, expand-index, expand-point):
* lisp/face-remap.el (text-scale-mode-remapping)
(text-scale-mode-lighter, text-scale-mode-amount)
(text-scale-remap-header-line, buffer-face-mode-remapping):
* lisp/ffap.el (ffap-menu-alist):
* lisp/files-x.el (connection-local-variables-alist):
* lisp/foldout.el (foldout-fold-list, foldout-mode-line-string):
* lisp/follow.el (follow-start-end-invalid):
* lisp/forms.el (forms--mode-setup):
* lisp/gnus/message.el (message-cross-post-old-target)
(message-options):
* lisp/help-mode.el (help-xref-stack, help-xref-forward-stack)
(help-xref-stack-item, help-xref-stack-forward-item):
* lisp/hexl.el (hexl-mode--old-var-vals, hexl-ascii-overlay):
* lisp/hilit-chg.el (hilit-chg-string):
* lisp/ido.el (ido-eoinput):
* lisp/imenu.el (imenu-generic-expression)
(imenu-create-index-function, imenu-default-goto-function)
(imenu-prev-index-position-function)
(imenu-extract-index-name-function, imenu-name-lookup-function)
(imenu-syntax-alist, imenu-case-fold-search):
* lisp/jka-compr.el (jka-compr-really-do-compress):
* lisp/language/ethio-util.el (ethio-prefer-ascii-space):
* lisp/leim/quail/hangul.el (hangul-input-method-help-text):
* lisp/leim/quail/japanese.el (quail-japanese-package-saved):
* lisp/linum.el (linum-overlays, linum-available):
* lisp/man.el (Man-original-frame, Man-arguments, Man--sections)
(Man--refpages, Man-page-list, Man-current-page)
(Man-page-mode-string):
* lisp/pcomplete.el (pcomplete-current-completions)
(pcomplete-last-completion-length)
(pcomplete-last-completion-stub, pcomplete-last-completion-raw)
(pcomplete-last-window-config, pcomplete-window-restore-timer):
* lisp/reveal.el (reveal-open-spots, reveal-last-tick):
* lisp/ruler-mode.el (ruler-mode):
* lisp/scroll-lock.el (scroll-lock-preserve-screen-pos-save):
* lisp/server.el (server-buffer-clients, server-existing-buffer):
* lisp/tab-line.el (tab-line-exclude):
* lisp/tar-mode.el (tar-data-buffer, tar-data-swapped):
* lisp/thumbs.el (thumbs-current-tmp-filename)
(thumbs-current-image-filename, thumbs-extra-images)
(thumbs-image-num, thumbs-buffer, thumbs-marked-list):
* lisp/tutorial.el (tutorial--point-before-chkeys)
(tutorial--point-after-chkeys, tutorial--lang):
* lisp/url/url-vars.el (url-current-object)
(url-current-mime-headers, url-current-lastloc):
* lisp/view.el (view-mode, view-old-buffer-read-only)
(view-old-Helper-return-blurb, view-page-size)
(view-half-page-size, view-last-regexp, view-return-to-alist)
(view-exit-action, view-overlay):
* lisp/wid-edit.el (widget-global-map, widget-field-new)
(widget-field-list, widget-field-last, widget-field-was):
* lisp/woman.el (woman-imenu-done): Prefer defvar-local.
2021-02-02 08:55:40 +00:00
|
|
|
|
(defvar-local dframe-attached-frame nil
|
2005-09-30 13:18:43 +00:00
|
|
|
|
"The frame which started a frame mode.
|
|
|
|
|
This is the frame from which all interesting activities will go
|
|
|
|
|
for the mode using dframe.")
|
|
|
|
|
|
Prefer defvar-local in remaining libraries
* lisp/align.el (align-mode-rules-list)
(align-mode-exclude-rules-list):
* lisp/bookmark.el (bookmark-current-bookmark)
(bookmark-annotation-name)
(bookmark--annotation-from-bookmark-list):
* lisp/calc/calc-embed.el (calc-embedded-all-active)
(calc-embedded-some-active):
* lisp/comint.el (comint-password-function):
* lisp/completion.el (completion-syntax-table):
* lisp/dframe.el (dframe-track-mouse-function)
(dframe-help-echo-function, dframe-mouse-click-function)
(dframe-mouse-position-function, dframe-timer)
(dframe-attached-frame, dframe-controlled):
* lisp/ehelp.el (electric-help-orig-major-mode):
* lisp/eshell/esh-util.el (eshell-path-env):
* lisp/expand.el (expand-pos, expand-index, expand-point):
* lisp/face-remap.el (text-scale-mode-remapping)
(text-scale-mode-lighter, text-scale-mode-amount)
(text-scale-remap-header-line, buffer-face-mode-remapping):
* lisp/ffap.el (ffap-menu-alist):
* lisp/files-x.el (connection-local-variables-alist):
* lisp/foldout.el (foldout-fold-list, foldout-mode-line-string):
* lisp/follow.el (follow-start-end-invalid):
* lisp/forms.el (forms--mode-setup):
* lisp/gnus/message.el (message-cross-post-old-target)
(message-options):
* lisp/help-mode.el (help-xref-stack, help-xref-forward-stack)
(help-xref-stack-item, help-xref-stack-forward-item):
* lisp/hexl.el (hexl-mode--old-var-vals, hexl-ascii-overlay):
* lisp/hilit-chg.el (hilit-chg-string):
* lisp/ido.el (ido-eoinput):
* lisp/imenu.el (imenu-generic-expression)
(imenu-create-index-function, imenu-default-goto-function)
(imenu-prev-index-position-function)
(imenu-extract-index-name-function, imenu-name-lookup-function)
(imenu-syntax-alist, imenu-case-fold-search):
* lisp/jka-compr.el (jka-compr-really-do-compress):
* lisp/language/ethio-util.el (ethio-prefer-ascii-space):
* lisp/leim/quail/hangul.el (hangul-input-method-help-text):
* lisp/leim/quail/japanese.el (quail-japanese-package-saved):
* lisp/linum.el (linum-overlays, linum-available):
* lisp/man.el (Man-original-frame, Man-arguments, Man--sections)
(Man--refpages, Man-page-list, Man-current-page)
(Man-page-mode-string):
* lisp/pcomplete.el (pcomplete-current-completions)
(pcomplete-last-completion-length)
(pcomplete-last-completion-stub, pcomplete-last-completion-raw)
(pcomplete-last-window-config, pcomplete-window-restore-timer):
* lisp/reveal.el (reveal-open-spots, reveal-last-tick):
* lisp/ruler-mode.el (ruler-mode):
* lisp/scroll-lock.el (scroll-lock-preserve-screen-pos-save):
* lisp/server.el (server-buffer-clients, server-existing-buffer):
* lisp/tab-line.el (tab-line-exclude):
* lisp/tar-mode.el (tar-data-buffer, tar-data-swapped):
* lisp/thumbs.el (thumbs-current-tmp-filename)
(thumbs-current-image-filename, thumbs-extra-images)
(thumbs-image-num, thumbs-buffer, thumbs-marked-list):
* lisp/tutorial.el (tutorial--point-before-chkeys)
(tutorial--point-after-chkeys, tutorial--lang):
* lisp/url/url-vars.el (url-current-object)
(url-current-mime-headers, url-current-lastloc):
* lisp/view.el (view-mode, view-old-buffer-read-only)
(view-old-Helper-return-blurb, view-page-size)
(view-half-page-size, view-last-regexp, view-return-to-alist)
(view-exit-action, view-overlay):
* lisp/wid-edit.el (widget-global-map, widget-field-new)
(widget-field-list, widget-field-last, widget-field-was):
* lisp/woman.el (woman-imenu-done): Prefer defvar-local.
2021-02-02 08:55:40 +00:00
|
|
|
|
(defvar-local dframe-controlled nil
|
2005-09-30 13:18:43 +00:00
|
|
|
|
"Is this buffer controlled by a dedicated frame.
|
|
|
|
|
Local to those buffers, as a function called that created it.")
|
|
|
|
|
|
|
|
|
|
(defun dframe-update-keymap (map)
|
|
|
|
|
"Update the keymap MAP for dframe default bindings."
|
|
|
|
|
;; Frame control
|
|
|
|
|
(define-key map "q" 'dframe-close-frame)
|
|
|
|
|
(define-key map "Q" 'delete-frame)
|
|
|
|
|
|
|
|
|
|
;; Override switch to buffer to never hack our frame.
|
|
|
|
|
(substitute-key-definition 'switch-to-buffer
|
|
|
|
|
'dframe-switch-buffer-attached-frame
|
|
|
|
|
map global-map)
|
|
|
|
|
|
2019-06-19 20:07:44 +00:00
|
|
|
|
;; mouse bindings so we can manipulate the items on each line
|
|
|
|
|
;; (define-key map [down-mouse-1] 'dframe-double-click)
|
|
|
|
|
(define-key map [follow-link] 'mouse-face)
|
|
|
|
|
(define-key map [mouse-2] 'dframe-click)
|
|
|
|
|
;; This is the power click for new frames, or refreshing a cache
|
|
|
|
|
(define-key map [S-mouse-2] 'dframe-power-click)
|
|
|
|
|
;; This adds a small unnecessary visual effect
|
|
|
|
|
;;(define-key map [down-mouse-2] 'dframe-quick-mouse)
|
|
|
|
|
|
|
|
|
|
(define-key map [down-mouse-3] 'dframe-popup-kludge)
|
|
|
|
|
|
|
|
|
|
;; This lets the user scroll as if we had a scrollbar... well maybe not
|
|
|
|
|
(define-key map [mode-line mouse-2] 'dframe-mouse-hscroll)
|
|
|
|
|
;; another handy place users might click to get our menu.
|
|
|
|
|
(define-key map [mode-line down-mouse-1]
|
|
|
|
|
'dframe-popup-kludge)
|
|
|
|
|
|
|
|
|
|
;; We can't switch buffers with the buffer mouse menu. Lets hack it.
|
|
|
|
|
(define-key map [C-down-mouse-1] 'dframe-hack-buffer-menu)
|
|
|
|
|
|
|
|
|
|
;; Lastly, we want to track the mouse. Play here
|
|
|
|
|
(define-key map [mouse-movement] 'dframe-track-mouse))
|
2005-09-30 13:18:43 +00:00
|
|
|
|
|
|
|
|
|
(defun dframe-live-p (frame)
|
|
|
|
|
"Return non-nil if FRAME is currently available."
|
|
|
|
|
(and frame (frame-live-p frame) (frame-visible-p frame)))
|
|
|
|
|
|
2013-09-18 01:48:00 +00:00
|
|
|
|
(defvar x-sensitive-text-pointer-shape)
|
|
|
|
|
(defvar x-pointer-shape)
|
|
|
|
|
|
2005-09-30 13:18:43 +00:00
|
|
|
|
(defun dframe-frame-mode (arg frame-var cache-var buffer-var frame-name
|
|
|
|
|
local-mode-fn
|
|
|
|
|
&optional
|
|
|
|
|
parameters
|
|
|
|
|
delete-hook popup-hook create-hook
|
|
|
|
|
)
|
|
|
|
|
"Manage a frame for an application, enabling it when ARG is positive.
|
|
|
|
|
FRAME-VAR is a variable used to cache the frame being used.
|
|
|
|
|
This frame is either resurrected, hidden, killed, etc based on
|
|
|
|
|
the value.
|
|
|
|
|
CACHE-VAR is a variable used to cache a cached frame.
|
|
|
|
|
BUFFER-VAR is a variable used to cache the buffer being used in dframe.
|
2006-02-02 11:04:55 +00:00
|
|
|
|
This buffer will have `dframe-frame-mode' run on it.
|
2005-09-30 13:18:43 +00:00
|
|
|
|
FRAME-NAME is the name of the frame to create.
|
|
|
|
|
LOCAL-MODE-FN is the function used to call this one.
|
|
|
|
|
PARAMETERS are frame parameters to apply to this dframe.
|
2013-08-29 19:55:58 +00:00
|
|
|
|
DELETE-HOOK is a hook to run when deleting a frame.
|
|
|
|
|
POPUP-HOOK is a hook to run before showing a frame.
|
|
|
|
|
CREATE-HOOK is a hook to run after creating a frame."
|
|
|
|
|
(let ((conv-hook (lambda (val)
|
|
|
|
|
(let ((sym (make-symbol "hook")))
|
|
|
|
|
(set sym val) sym))))
|
|
|
|
|
(if (consp delete-hook) (setq delete-hook (funcall conv-hook delete-hook)))
|
|
|
|
|
(if (consp create-hook) (setq create-hook (funcall conv-hook create-hook)))
|
|
|
|
|
(if (consp popup-hook) (setq popup-hook (funcall conv-hook popup-hook))))
|
2005-09-30 13:18:43 +00:00
|
|
|
|
;; toggle frame on and off.
|
|
|
|
|
(if (not arg) (if (dframe-live-p (symbol-value frame-var))
|
|
|
|
|
(setq arg -1) (setq arg 1)))
|
|
|
|
|
;; Make sure the current buffer is set.
|
|
|
|
|
(set-buffer (symbol-value buffer-var))
|
|
|
|
|
;; turn the frame off on neg number
|
|
|
|
|
(if (and (numberp arg) (< arg 0))
|
|
|
|
|
(progn
|
2013-08-29 19:55:58 +00:00
|
|
|
|
(run-hooks delete-hook)
|
2005-09-30 13:18:43 +00:00
|
|
|
|
(if (and (symbol-value frame-var)
|
|
|
|
|
(frame-live-p (symbol-value frame-var)))
|
|
|
|
|
(progn
|
|
|
|
|
(set cache-var (symbol-value frame-var))
|
|
|
|
|
(make-frame-invisible (symbol-value frame-var))))
|
|
|
|
|
(set frame-var nil))
|
|
|
|
|
;; Set this as our currently attached frame
|
|
|
|
|
(setq dframe-attached-frame (selected-frame))
|
2017-12-19 01:30:10 +00:00
|
|
|
|
(run-hooks 'dframe-setup-hook)
|
2013-08-29 19:55:58 +00:00
|
|
|
|
(run-hooks popup-hook)
|
2005-09-30 13:18:43 +00:00
|
|
|
|
;; Updated the buffer passed in to contain all the hacks needed
|
|
|
|
|
;; to make it work well in a dedicated window.
|
2007-08-23 18:18:26 +00:00
|
|
|
|
(with-current-buffer (symbol-value buffer-var)
|
2005-09-30 13:18:43 +00:00
|
|
|
|
;; Declare this buffer a dedicated frame
|
|
|
|
|
(setq dframe-controlled local-mode-fn)
|
|
|
|
|
|
2019-06-19 20:07:44 +00:00
|
|
|
|
;; Enable mouse tracking in emacs
|
|
|
|
|
(if dframe-track-mouse-function
|
2020-12-09 08:44:38 +00:00
|
|
|
|
(setq-local track-mouse t)) ;this could be messy.
|
2019-06-19 20:07:44 +00:00
|
|
|
|
|
2005-09-30 13:18:43 +00:00
|
|
|
|
;; Override `temp-buffer-show-hook' so that help and such
|
|
|
|
|
;; put their stuff into a frame other than our own.
|
|
|
|
|
;; Correct use of `temp-buffer-show-function': Bob Weiner
|
|
|
|
|
(if (and (boundp 'temp-buffer-show-hook)
|
|
|
|
|
(boundp 'temp-buffer-show-function))
|
2020-11-04 05:24:45 +00:00
|
|
|
|
;; FIXME: Doesn't this get us into an inf-loop when the
|
|
|
|
|
;; `temp-buffer-show-function' runs `temp-buffer-show-hook'
|
|
|
|
|
;; (as is normally the case)?
|
2020-12-09 08:44:38 +00:00
|
|
|
|
(setq-local temp-buffer-show-hook temp-buffer-show-function))
|
|
|
|
|
(setq-local temp-buffer-show-function 'dframe-temp-buffer-show-function)
|
2005-09-30 13:18:43 +00:00
|
|
|
|
;; If this buffer is killed, we must make sure that we destroy
|
|
|
|
|
;; the frame the dedicated window is in.
|
2013-08-29 19:55:58 +00:00
|
|
|
|
(add-hook 'kill-buffer-hook (lambda ()
|
|
|
|
|
(let ((skilling (boundp 'skilling)))
|
|
|
|
|
(if skilling
|
|
|
|
|
nil
|
|
|
|
|
(if dframe-controlled
|
|
|
|
|
(progn
|
|
|
|
|
(funcall dframe-controlled -1)
|
|
|
|
|
(set buffer-var nil)
|
|
|
|
|
)))))
|
2019-06-19 20:07:44 +00:00
|
|
|
|
t t))
|
2005-09-30 13:18:43 +00:00
|
|
|
|
;; Get the frame to work in
|
|
|
|
|
(if (frame-live-p (symbol-value cache-var))
|
|
|
|
|
(progn
|
|
|
|
|
(set frame-var (symbol-value cache-var))
|
|
|
|
|
(make-frame-visible (symbol-value frame-var))
|
|
|
|
|
(select-frame (symbol-value frame-var))
|
|
|
|
|
(set-window-dedicated-p (selected-window) nil)
|
2019-11-15 08:43:02 +00:00
|
|
|
|
(unless (eq (current-buffer) (symbol-value buffer-var))
|
|
|
|
|
;; To avoid that 'switch-to-buffer-obey-display-actions'
|
|
|
|
|
;; butts in, use plain 'set-window-buffer' (Bug#37840).
|
|
|
|
|
(set-window-buffer nil (symbol-value buffer-var)))
|
2005-09-30 13:18:43 +00:00
|
|
|
|
(set-window-dedicated-p (selected-window) t)
|
|
|
|
|
(raise-frame (symbol-value frame-var))
|
|
|
|
|
)
|
|
|
|
|
(if (frame-live-p (symbol-value frame-var))
|
|
|
|
|
(raise-frame (symbol-value frame-var))
|
|
|
|
|
(set frame-var
|
2019-09-08 22:24:18 +00:00
|
|
|
|
(let* ((mh (frame-parameter dframe-attached-frame
|
|
|
|
|
'menu-bar-lines))
|
2019-06-19 20:07:44 +00:00
|
|
|
|
(paramsa
|
|
|
|
|
;; Only add a guessed height if one is not specified
|
|
|
|
|
;; in the input parameters.
|
|
|
|
|
(if (assoc 'height parameters)
|
|
|
|
|
parameters
|
|
|
|
|
(append
|
|
|
|
|
parameters
|
|
|
|
|
(list (cons 'height (+ (or mh 0) (frame-height)))))))
|
|
|
|
|
(params
|
|
|
|
|
;; Only add a guessed width if one is not specified
|
|
|
|
|
;; in the input parameters.
|
|
|
|
|
(if (assoc 'width parameters)
|
|
|
|
|
paramsa
|
|
|
|
|
(append
|
|
|
|
|
paramsa
|
|
|
|
|
(list (cons 'width (frame-width))))))
|
|
|
|
|
(frame
|
|
|
|
|
(if (not (eq window-system 'x))
|
|
|
|
|
(make-frame params)
|
|
|
|
|
(let ((x-pointer-shape x-pointer-top-left-arrow)
|
|
|
|
|
(x-sensitive-text-pointer-shape
|
|
|
|
|
x-pointer-hand2))
|
|
|
|
|
(make-frame params)))))
|
|
|
|
|
frame))
|
2005-09-30 13:18:43 +00:00
|
|
|
|
;; Put the buffer into the frame
|
|
|
|
|
(save-excursion
|
|
|
|
|
(select-frame (symbol-value frame-var))
|
2019-11-15 08:43:02 +00:00
|
|
|
|
;; To avoid that 'switch-to-buffer-obey-display-actions'
|
|
|
|
|
;; butts in, use plain 'set-window-buffer' (Bug#37840).
|
|
|
|
|
(set-window-buffer nil (symbol-value buffer-var))
|
2005-09-30 13:18:43 +00:00
|
|
|
|
(set-window-dedicated-p (selected-window) t))
|
|
|
|
|
;; Run hooks (like reposition)
|
2013-08-29 19:55:58 +00:00
|
|
|
|
(run-hooks create-hook)
|
2005-09-30 13:18:43 +00:00
|
|
|
|
;; Frame name
|
|
|
|
|
(if (and (or (null window-system) (eq window-system 'pc))
|
|
|
|
|
(fboundp 'set-frame-name))
|
|
|
|
|
(save-window-excursion
|
|
|
|
|
(select-frame (symbol-value frame-var))
|
|
|
|
|
(set-frame-name frame-name)))
|
|
|
|
|
;; On a terminal, raise the frame or the user will
|
|
|
|
|
;; be confused.
|
|
|
|
|
(if (not window-system)
|
2019-06-19 20:07:44 +00:00
|
|
|
|
(select-frame (symbol-value frame-var)))))))
|
2005-09-30 13:18:43 +00:00
|
|
|
|
|
2008-06-12 03:53:47 +00:00
|
|
|
|
;; Not defined in builds without X, but behind window-system test.
|
|
|
|
|
(declare-function x-display-pixel-width "xfns.c" (&optional terminal))
|
|
|
|
|
(declare-function x-display-pixel-height "xfns.c" (&optional terminal))
|
|
|
|
|
|
2019-06-19 20:07:44 +00:00
|
|
|
|
(defun dframe-reposition-frame (new-frame parent-frame location)
|
2005-09-30 13:18:43 +00:00
|
|
|
|
"Move NEW-FRAME to be relative to PARENT-FRAME.
|
2015-11-17 23:28:50 +00:00
|
|
|
|
LOCATION can be one of `random', `left-right', `top-bottom', or
|
2008-11-04 09:48:55 +00:00
|
|
|
|
a cons cell indicating a position of the form (LEFT . TOP)."
|
2008-06-12 03:53:47 +00:00
|
|
|
|
;; Position dframe.
|
|
|
|
|
;; Do no positioning if not on a windowing system,
|
|
|
|
|
(unless (or (not window-system) (eq window-system 'pc))
|
2019-09-08 22:24:18 +00:00
|
|
|
|
(let* ((pfx (frame-parameter parent-frame 'left))
|
|
|
|
|
(pfy (frame-parameter parent-frame 'top))
|
2010-09-17 09:04:35 +00:00
|
|
|
|
(pfw (+ (tool-bar-pixel-width parent-frame)
|
|
|
|
|
(frame-pixel-width parent-frame)))
|
2008-06-12 03:53:47 +00:00
|
|
|
|
(pfh (frame-pixel-height parent-frame))
|
|
|
|
|
(nfw (frame-pixel-width new-frame))
|
|
|
|
|
(nfh (frame-pixel-height new-frame))
|
|
|
|
|
newleft newtop)
|
2005-09-30 13:18:43 +00:00
|
|
|
|
;; Rebuild pfx,pfy to be absolute positions.
|
|
|
|
|
(setq pfx (if (not (consp pfx))
|
|
|
|
|
pfx
|
|
|
|
|
;; If pfx is a list, that means we grow
|
|
|
|
|
;; from a specific edge of the display.
|
|
|
|
|
;; Convert that to the distance from the
|
|
|
|
|
;; left side of the display.
|
|
|
|
|
(if (eq (car pfx) '-)
|
|
|
|
|
;; A - means distance from the right edge
|
|
|
|
|
;; of the display, or DW - pfx - framewidth
|
|
|
|
|
(- (x-display-pixel-width) (car (cdr pfx)) pfw)
|
|
|
|
|
(car (cdr pfx))))
|
|
|
|
|
pfy (if (not (consp pfy))
|
|
|
|
|
pfy
|
|
|
|
|
;; If pfy is a list, that means we grow
|
|
|
|
|
;; from a specific edge of the display.
|
|
|
|
|
;; Convert that to the distance from the
|
|
|
|
|
;; left side of the display.
|
|
|
|
|
(if (eq (car pfy) '-)
|
|
|
|
|
;; A - means distance from the right edge
|
|
|
|
|
;; of the display, or DW - pfx - framewidth
|
|
|
|
|
(- (x-display-pixel-height) (car (cdr pfy)) pfh)
|
2008-06-12 03:53:47 +00:00
|
|
|
|
(car (cdr pfy)))))
|
2005-09-30 13:18:43 +00:00
|
|
|
|
(cond ((eq location 'right)
|
2010-09-17 09:04:35 +00:00
|
|
|
|
(setq newleft (+ pfx pfw 10)
|
2005-09-30 13:18:43 +00:00
|
|
|
|
newtop pfy))
|
|
|
|
|
((eq location 'left)
|
2005-11-30 19:40:13 +00:00
|
|
|
|
(setq newleft (- pfx 10 nfw)
|
2005-09-30 13:18:43 +00:00
|
|
|
|
newtop pfy))
|
|
|
|
|
((eq location 'left-right)
|
|
|
|
|
(setq newleft
|
|
|
|
|
;; Decide which side to put it on. 200 is just a
|
|
|
|
|
;; buffer for the left edge of the screen. The
|
|
|
|
|
;; extra 10 is just dressings for window
|
|
|
|
|
;; decorations.
|
|
|
|
|
(let* ((left-guess (- pfx 10 nfw))
|
2010-09-17 09:04:35 +00:00
|
|
|
|
(right-guess (+ pfx pfw 10))
|
2005-09-30 13:18:43 +00:00
|
|
|
|
(left-margin left-guess)
|
|
|
|
|
(right-margin (- (x-display-pixel-width)
|
|
|
|
|
right-guess 5 nfw)))
|
|
|
|
|
(cond ((>= left-margin 0) left-guess)
|
|
|
|
|
((>= right-margin 0) right-guess)
|
|
|
|
|
;; otherwise choose side we overlap less
|
|
|
|
|
((> left-margin right-margin) 0)
|
|
|
|
|
(t (- (x-display-pixel-width) nfw 5))))
|
2008-06-12 03:53:47 +00:00
|
|
|
|
newtop pfy))
|
2005-09-30 13:18:43 +00:00
|
|
|
|
((eq location 'top-bottom)
|
|
|
|
|
(setq newleft pfx
|
|
|
|
|
newtop
|
|
|
|
|
;; Try and guess if we should be on the top or bottom.
|
|
|
|
|
(let* ((top-guess (- pfy 15 nfh))
|
|
|
|
|
(bottom-guess (+ pfy 5 pfh))
|
|
|
|
|
(top-margin top-guess)
|
|
|
|
|
(bottom-margin (- (x-display-pixel-height)
|
|
|
|
|
bottom-guess 5 nfh)))
|
|
|
|
|
(cond ((>= top-margin 0) top-guess)
|
|
|
|
|
((>= bottom-margin 0) bottom-guess)
|
|
|
|
|
;; Choose a side to overlap the least.
|
|
|
|
|
((> top-margin bottom-margin) 0)
|
2008-06-12 03:53:47 +00:00
|
|
|
|
(t (- (x-display-pixel-height) nfh 5))))))
|
2005-09-30 13:18:43 +00:00
|
|
|
|
((consp location)
|
|
|
|
|
(setq newleft (or (car location) 0)
|
|
|
|
|
newtop (or (cdr location) 0)))
|
|
|
|
|
(t nil))
|
|
|
|
|
(modify-frame-parameters new-frame
|
2008-06-12 03:53:47 +00:00
|
|
|
|
(list (cons 'left newleft)
|
|
|
|
|
(cons 'top newtop))))))
|
2005-09-30 13:18:43 +00:00
|
|
|
|
|
|
|
|
|
(defun dframe-detach (frame-var cache-var buffer-var)
|
2011-11-11 10:04:08 +00:00
|
|
|
|
"Detach the frame in symbol FRAME-VAR.
|
2014-02-28 13:19:06 +00:00
|
|
|
|
CACHE-VAR and BUFFER-VAR are symbols as in `dframe-frame-mode'."
|
2007-08-23 18:18:26 +00:00
|
|
|
|
(with-current-buffer (symbol-value buffer-var)
|
2005-09-30 13:18:43 +00:00
|
|
|
|
(rename-buffer (buffer-name) t)
|
|
|
|
|
(let ((oldframe (symbol-value frame-var)))
|
|
|
|
|
(set buffer-var nil)
|
|
|
|
|
(set frame-var nil)
|
|
|
|
|
(set cache-var nil)
|
2007-08-23 18:18:26 +00:00
|
|
|
|
;; FIXME: Looks very suspicious. Luckily this function is unused.
|
2005-09-30 13:18:43 +00:00
|
|
|
|
(make-variable-buffer-local frame-var)
|
2019-06-19 20:07:44 +00:00
|
|
|
|
(set frame-var oldframe))))
|
2005-09-30 13:18:43 +00:00
|
|
|
|
|
|
|
|
|
;;; Special frame event proxies
|
2017-12-19 01:30:10 +00:00
|
|
|
|
(defvar dframe-setup-hook nil
|
|
|
|
|
"Used for setting frame special event bindings.")
|
|
|
|
|
|
|
|
|
|
(defun dframe-set-special-events ()
|
|
|
|
|
(define-key special-event-map [make-frame-visible]
|
|
|
|
|
'dframe-handle-make-frame-visible)
|
|
|
|
|
(define-key special-event-map [iconify-frame]
|
|
|
|
|
'dframe-handle-iconify-frame)
|
|
|
|
|
(define-key special-event-map [delete-frame]
|
|
|
|
|
'dframe-handle-delete-frame)
|
|
|
|
|
;; Only need to run once.
|
|
|
|
|
(remove-hook 'dframe-setup-hook #'dframe-set-special-events))
|
|
|
|
|
|
|
|
|
|
(when (boundp 'special-event-map)
|
|
|
|
|
(add-hook 'dframe-setup-hook #'dframe-set-special-events))
|
2005-09-30 13:18:43 +00:00
|
|
|
|
|
|
|
|
|
(defvar dframe-make-frame-visible-function nil
|
|
|
|
|
"Function used when a dframe controlled frame is de-iconified.
|
|
|
|
|
The function must take an EVENT.")
|
|
|
|
|
(defvar dframe-iconify-frame-function nil
|
|
|
|
|
"Function used when a dframe controlled frame is iconified.
|
|
|
|
|
The function must take an EVENT.")
|
|
|
|
|
(defvar dframe-delete-frame-function nil
|
|
|
|
|
"Function used when a frame attached to a dframe frame is deleted.
|
|
|
|
|
The function must take an EVENT.")
|
|
|
|
|
|
|
|
|
|
(defun dframe-handle-make-frame-visible (e)
|
|
|
|
|
"Handle a `make-frame-visible' event.
|
2006-02-02 11:04:55 +00:00
|
|
|
|
Should enable auto-updating if the last state was also enabled.
|
2005-09-30 13:18:43 +00:00
|
|
|
|
Argument E is the event making the frame visible."
|
|
|
|
|
(interactive "e")
|
|
|
|
|
(let ((f last-event-frame))
|
|
|
|
|
(if (and (dframe-attached-frame f)
|
|
|
|
|
dframe-make-frame-visible-function)
|
|
|
|
|
(funcall dframe-make-frame-visible-function e)
|
|
|
|
|
)))
|
|
|
|
|
|
|
|
|
|
(defun dframe-handle-iconify-frame (e)
|
|
|
|
|
"Handle a `iconify-frame' event.
|
2006-02-02 11:04:55 +00:00
|
|
|
|
Should disable auto-updating if the last state was also enabled.
|
2005-09-30 13:18:43 +00:00
|
|
|
|
Argument E is the event iconifying the frame."
|
|
|
|
|
(interactive "e")
|
|
|
|
|
(let ((f last-event-frame))
|
|
|
|
|
(if (and (dframe-attached-frame f)
|
|
|
|
|
dframe-iconify-frame-function e)
|
|
|
|
|
(funcall dframe-iconify-frame-function)
|
|
|
|
|
)))
|
|
|
|
|
|
|
|
|
|
(defun dframe-handle-delete-frame (e)
|
|
|
|
|
"Handle `delete-frame' event.
|
|
|
|
|
Argument E is the event deleting the frame."
|
|
|
|
|
(interactive "e")
|
|
|
|
|
(let ((fl (frame-list))
|
|
|
|
|
(sf (selected-frame)))
|
|
|
|
|
;; Loop over all frames. If dframe-delete-frame-function is
|
|
|
|
|
;; non-nil, call it.
|
|
|
|
|
(while fl
|
|
|
|
|
(select-frame (car fl))
|
|
|
|
|
(if dframe-delete-frame-function
|
|
|
|
|
(funcall dframe-delete-frame-function e))
|
|
|
|
|
(setq fl (cdr fl)))
|
|
|
|
|
(if (frame-live-p sf)
|
|
|
|
|
(select-frame sf))
|
|
|
|
|
(handle-delete-frame e)))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;;; Utilities
|
|
|
|
|
;;
|
2014-04-21 21:43:17 +00:00
|
|
|
|
(defun dframe-get-focus (frame-var activator)
|
2005-09-30 13:18:43 +00:00
|
|
|
|
"Change frame focus to or from a dedicated frame.
|
|
|
|
|
If the selected frame is not in the symbol FRAME-VAR, then FRAME-VAR
|
|
|
|
|
frame is selected. If the FRAME-VAR is active, then select the
|
|
|
|
|
attached frame. If FRAME-VAR is nil, ACTIVATOR is called to
|
2014-04-21 21:43:17 +00:00
|
|
|
|
created it."
|
2005-09-30 13:18:43 +00:00
|
|
|
|
(interactive)
|
|
|
|
|
(if (eq (selected-frame) (symbol-value frame-var))
|
|
|
|
|
(if (frame-live-p dframe-attached-frame)
|
|
|
|
|
(dframe-select-attached-frame))
|
|
|
|
|
;; make sure we have a frame
|
|
|
|
|
(if (not (frame-live-p (symbol-value frame-var)))
|
|
|
|
|
(funcall activator 1))
|
|
|
|
|
;; go there
|
|
|
|
|
(select-frame (symbol-value frame-var))
|
|
|
|
|
)
|
2014-04-21 21:43:17 +00:00
|
|
|
|
(other-frame 0))
|
2005-09-30 13:18:43 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(defun dframe-close-frame ()
|
|
|
|
|
"Close the current frame if it is dedicated."
|
|
|
|
|
(interactive)
|
|
|
|
|
(if dframe-controlled
|
|
|
|
|
(let ((b (current-buffer)))
|
|
|
|
|
(funcall dframe-controlled -1)
|
|
|
|
|
(kill-buffer b))))
|
|
|
|
|
|
|
|
|
|
(defun dframe-current-frame (frame-var desired-major-mode)
|
|
|
|
|
"Return the existing dedicated frame to use.
|
|
|
|
|
FRAME-VAR is the variable storing the currently active dedicated frame.
|
|
|
|
|
If the current frame's buffer uses DESIRED-MAJOR-MODE, then use that frame."
|
|
|
|
|
(if (not (eq (selected-frame) (symbol-value frame-var)))
|
2011-04-12 15:39:44 +00:00
|
|
|
|
(if (and (eq major-mode desired-major-mode)
|
2005-09-30 13:18:43 +00:00
|
|
|
|
(get-buffer-window (current-buffer))
|
|
|
|
|
(window-frame (get-buffer-window (current-buffer))))
|
|
|
|
|
(window-frame (get-buffer-window (current-buffer)))
|
|
|
|
|
(symbol-value frame-var))
|
|
|
|
|
(symbol-value frame-var)))
|
|
|
|
|
|
|
|
|
|
(defun dframe-attached-frame (&optional frame)
|
|
|
|
|
"Return the attached frame belonging to the dframe controlled frame FRAME.
|
|
|
|
|
If optional arg FRAME is nil just return `dframe-attached-frame'."
|
|
|
|
|
(save-excursion
|
|
|
|
|
(if frame (select-frame frame))
|
|
|
|
|
dframe-attached-frame))
|
|
|
|
|
|
|
|
|
|
(defun dframe-select-attached-frame (&optional frame)
|
2006-02-02 11:04:55 +00:00
|
|
|
|
"Switch to the frame the dframe controlled frame FRAME was started from.
|
|
|
|
|
If optional arg FRAME is nil assume the attached frame is already selected
|
|
|
|
|
and just run the hooks `dframe-after-select-attached-frame-hook'. Return
|
|
|
|
|
the attached frame."
|
2005-09-30 13:18:43 +00:00
|
|
|
|
(let ((frame (dframe-attached-frame frame)))
|
|
|
|
|
(if frame (select-frame frame))
|
|
|
|
|
(prog1 frame
|
|
|
|
|
(run-hooks 'dframe-after-select-attached-frame-hook))))
|
|
|
|
|
|
|
|
|
|
(defmacro dframe-with-attached-buffer (&rest forms)
|
|
|
|
|
"Execute FORMS in the attached frame's special buffer.
|
|
|
|
|
Optionally select that frame if necessary."
|
|
|
|
|
`(save-selected-window
|
|
|
|
|
;;(speedbar-set-timer speedbar-update-speed)
|
|
|
|
|
(dframe-select-attached-frame)
|
|
|
|
|
,@forms
|
|
|
|
|
(dframe-maybee-jump-to-attached-frame)))
|
|
|
|
|
|
|
|
|
|
(defun dframe-maybee-jump-to-attached-frame ()
|
|
|
|
|
"Jump to the attached frame ONLY if this was not a mouse event."
|
|
|
|
|
(when (or (not (dframe-mouse-event-p last-input-event))
|
|
|
|
|
dframe-activity-change-focus-flag)
|
|
|
|
|
(dframe-select-attached-frame)
|
2005-10-06 08:19:10 +00:00
|
|
|
|
;; KB: For what is this - raising the frame??
|
2005-09-30 13:18:43 +00:00
|
|
|
|
(other-frame 0)))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(defvar dframe-suppress-message-flag nil
|
|
|
|
|
"Non-nil means that `dframe-message' should just return a string.")
|
|
|
|
|
|
|
|
|
|
(defun dframe-message (fmt &rest args)
|
Small speedbar-related clean-up
* lisp/dframe.el (x-sensitive-text-pointer-shape, x-pointer-shape):
Remove unnecessary declarations.
(dframe-message): Doc fix.
* lisp/info.el (dframe-select-attached-frame, dframe-current-frame):
Declare.
* lisp/speedbar.el (speedbar-message): Make it an obsolete alias.
Update all callers.
(speedbar-with-attached-buffer)
(speedbar-maybee-jump-to-attached-frame): Make these aliases obsolete.
(speedbar-with-writable): Use backquote.
* lisp/emacs-lisp/eieio-opt.el (eieio-describe-class-sb):
* lisp/emacs-lisp/eieio-speedbar.el (eieio-speedbar-handle-click):
Use dframe-with-attached-buffer, dframe-maybee-jump-to-attached-frame
rather than speedbar- aliases.
* lisp/mail/rmail.el: Load dframe rather than speedbar when compiling.
(speedbar-make-specialized-keymap, speedbar-insert-button)
(dframe-select-attached-frame, dframe-maybee-jump-to-attached-frame)
(speedbar-do-function-pointer): Declare.
(rmail-speedbar-button, rmail-speedbar-find-file)
(rmail-speedbar-move-message):
Use dframe-with-attached-buffer rather than speedbar- alias.
* lisp/progmodes/gud.el: Load dframe rather than speedbar when compiling.
(dframe-message, speedbar-make-specialized-keymap)
(speedbar-add-expansion-list, speedbar-mode-functions-list)
(speedbar-make-tag-line, speedbar-remove-localized-speedbar-support)
(speedbar-insert-button, dframe-select-attached-frame)
(dframe-maybee-jump-to-attached-frame)
(speedbar-change-initial-expansion-list)
(speedbar-previously-used-expansion-list-name): Declare.
(gud-speedbar-item-info, gud-gdb-goto-stackframe):
Use dframe-message, dframe-with-attached-buffer rather than
speedbar- aliases.
(gud-sentinel): Silence compiler.
* lisp/progmodes/vhdl-mode.el (speedbar-refresh)
(speedbar-do-function-pointer, speedbar-add-supported-extension)
(speedbar-add-mode-functions-list, speedbar-make-specialized-keymap)
(speedbar-change-initial-expansion-list, speedbar-add-expansion-list)
(speedbar-extension-list-to-regex, speedbar-directory-buttons)
(speedbar-file-lists, speedbar-make-tag-line)
(speedbar-line-directory, speedbar-goto-this-file)
(speedbar-center-buffer-smartly, speedbar-change-expand-button-char)
(speedbar-delete-subblock, speedbar-position-cursor-on-line)
(speedbar-make-button, speedbar-reset-scanners)
(speedbar-files-item-info, speedbar-line-text)
(speedbar-find-file-in-frame, speedbar-set-timer)
(dframe-maybee-jump-to-attached-frame, speedbar-line-file): Declare.
(speedbar-with-writable): Do not (re)define it.
(vhdl-speedbar-find-file): Use dframe-maybee-jump-to-attached-frame
rather than speedbar- alias.
* lisp/cedet/ede/speedbar.el (ede-file-find, ede-tag-find):
* lisp/cedet/semantic/sb.el (semantic-sb-token-jump):
Use dframe-maybee-jump-to-attached-frame rather than speedbar- alias.
* lisp/mh-e/mh-speed.el (mh-speed-view):
Use dframe-with-attached-buffer rather than speedbar- alias.
2013-05-22 03:13:56 +00:00
|
|
|
|
"Like `message', but for use in a dedicated frame.
|
2005-09-30 13:18:43 +00:00
|
|
|
|
Argument FMT is the format string, and ARGS are the arguments for message."
|
|
|
|
|
(save-selected-window
|
|
|
|
|
(if dframe-suppress-message-flag
|
More-conservative ‘format’ quote restyling
Instead of restyling curved quotes for every call to ‘format’,
create a new function ‘format-message’ that does the restyling,
and using the new function instead of ‘format’ only in contexts
where this seems appropriate.
Problem reported by Dmitry Gutov and Andreas Schwab in:
http://lists.gnu.org/archive/html/emacs-devel/2015-08/msg00826.html
http://lists.gnu.org/archive/html/emacs-devel/2015-08/msg00827.html
* doc/lispref/commands.texi (Using Interactive):
* doc/lispref/control.texi (Signaling Errors, Signaling Errors):
* doc/lispref/display.texi (Displaying Messages, Progress):
* doc/lispref/elisp.texi:
* doc/lispref/help.texi (Keys in Documentation):
* doc/lispref/minibuf.texi (Minibuffer Misc):
* doc/lispref/strings.texi (Formatting Strings):
* etc/NEWS:
Document the changes.
* lisp/abbrev.el (expand-region-abbrevs):
* lisp/apropos.el (apropos-library):
* lisp/calc/calc-ext.el (calc-record-message)
(calc-user-function-list):
* lisp/calc/calc-help.el (calc-describe-key, calc-full-help):
* lisp/calc/calc-lang.el (math-read-big-balance):
* lisp/calc/calc-store.el (calc-edit-variable):
* lisp/calc/calc-units.el (math-build-units-table-buffer):
* lisp/calc/calc-yank.el (calc-edit-mode):
* lisp/calendar/icalendar.el (icalendar-export-region)
(icalendar--add-diary-entry):
* lisp/cedet/mode-local.el (mode-local-print-binding)
(mode-local-describe-bindings-2):
* lisp/cedet/semantic/complete.el (semantic-completion-message):
* lisp/cedet/semantic/edit.el (semantic-parse-changes-failed):
* lisp/cedet/semantic/wisent/comp.el (wisent-log):
* lisp/cedet/srecode/insert.el (srecode-insert-show-error-report):
* lisp/descr-text.el (describe-text-properties-1, describe-char):
* lisp/dframe.el (dframe-message):
* lisp/dired-aux.el (dired-query):
* lisp/emacs-lisp/byte-opt.el (byte-compile-log-lap-1):
* lisp/emacs-lisp/bytecomp.el (byte-compile-log)
(byte-compile-log-file, byte-compile-warn, byte-compile-form):
* lisp/emacs-lisp/cconv.el (cconv-convert, cconv--analyze-use)
(cconv-analyze-form):
* lisp/emacs-lisp/check-declare.el (check-declare-warn):
* lisp/emacs-lisp/checkdoc.el (checkdoc-this-string-valid-engine):
* lisp/emacs-lisp/cl-macs.el (cl-symbol-macrolet):
* lisp/emacs-lisp/edebug.el (edebug-format):
* lisp/emacs-lisp/eieio-core.el (eieio-oref):
* lisp/emacs-lisp/eldoc.el (eldoc-minibuffer-message)
(eldoc-message):
* lisp/emacs-lisp/elint.el (elint-file, elint-log):
* lisp/emacs-lisp/find-func.el (find-function-library):
* lisp/emacs-lisp/macroexp.el (macroexp--obsolete-warning):
* lisp/emacs-lisp/map-ynp.el (map-y-or-n-p):
* lisp/emacs-lisp/nadvice.el (advice--make-docstring):
* lisp/emacs-lisp/package.el (package-compute-transaction)
(package-install-button-action, package-delete-button-action)
(package-menu--list-to-prompt):
* lisp/emacs-lisp/timer.el (timer-event-handler):
* lisp/emacs-lisp/warnings.el (lwarn, warn):
* lisp/emulation/viper-cmd.el:
(viper-toggle-parse-sexp-ignore-comments)
(viper-kill-buffer, viper-brac-function):
* lisp/emulation/viper-macs.el (viper-record-kbd-macro):
* lisp/facemenu.el (facemenu-add-new-face):
* lisp/faces.el (face-documentation, read-face-name)
(face-read-string, read-face-font, describe-face):
* lisp/files.el (find-alternate-file, hack-local-variables)
(hack-one-local-variable--obsolete, write-file)
(basic-save-buffer, delete-directory):
* lisp/format.el (format-write-file, format-find-file)
(format-insert-file):
* lisp/help-fns.el (help-fns--key-bindings)
(help-fns--compiler-macro, help-fns--obsolete)
(help-fns--interactive-only, describe-function-1)
(describe-variable):
* lisp/help.el (describe-mode):
* lisp/info-xref.el (info-xref-output):
* lisp/info.el (Info-virtual-index-find-node)
(Info-virtual-index, info-apropos):
* lisp/international/kkc.el (kkc-error):
* lisp/international/mule-cmds.el:
(select-safe-coding-system-interactively)
(select-safe-coding-system, describe-input-method):
* lisp/international/mule-conf.el (code-offset):
* lisp/international/mule-diag.el (describe-character-set)
(list-input-methods-1):
* lisp/international/quail.el (quail-error):
* lisp/minibuffer.el (minibuffer-message):
* lisp/mpc.el (mpc--debug):
* lisp/msb.el (msb--choose-menu):
* lisp/net/ange-ftp.el (ange-ftp-message):
* lisp/net/gnutls.el (gnutls-message-maybe):
* lisp/net/newst-backend.el (newsticker--sentinel-work):
* lisp/net/newst-treeview.el (newsticker--treeview-load):
* lisp/net/nsm.el (nsm-query-user):
* lisp/net/rlogin.el (rlogin):
* lisp/net/soap-client.el (soap-warning):
* lisp/net/tramp.el (tramp-debug-message):
* lisp/nxml/nxml-outln.el (nxml-report-outline-error):
* lisp/nxml/nxml-parse.el (nxml-parse-error):
* lisp/nxml/rng-cmpct.el (rng-c-error):
* lisp/nxml/rng-match.el (rng-compile-error):
* lisp/nxml/rng-uri.el (rng-uri-error):
* lisp/obsolete/iswitchb.el (iswitchb-possible-new-buffer):
* lisp/org/org-ctags.el:
(org-ctags-ask-rebuild-tags-file-then-find-tag):
* lisp/proced.el (proced-log):
* lisp/progmodes/ebnf2ps.el (ebnf-log):
* lisp/progmodes/flymake.el (flymake-log):
* lisp/progmodes/vhdl-mode.el (vhdl-warning-when-idle):
* lisp/replace.el (occur-1):
* lisp/simple.el (execute-extended-command)
(undo-outer-limit-truncate, define-alternatives):
* lisp/startup.el (command-line):
* lisp/subr.el (error, user-error, add-to-list):
* lisp/tutorial.el (tutorial--describe-nonstandard-key)
(tutorial--find-changed-keys):
* src/callint.c (Fcall_interactively):
* src/editfns.c (Fmessage, Fmessage_box):
Restyle the quotes of format strings intended for use as a
diagnostic, when restyling seems appropriate.
* lisp/subr.el (format-message): New function.
* src/doc.c (Finternal__text_restyle): New function.
(syms_of_doc): Define it.
2015-08-24 05:38:02 +00:00
|
|
|
|
(apply #'format-message fmt args)
|
2005-09-30 13:18:43 +00:00
|
|
|
|
(if dframe-attached-frame
|
|
|
|
|
;; KB: Here we do not need calling `dframe-select-attached-frame'
|
|
|
|
|
(select-frame dframe-attached-frame))
|
More-conservative ‘format’ quote restyling
Instead of restyling curved quotes for every call to ‘format’,
create a new function ‘format-message’ that does the restyling,
and using the new function instead of ‘format’ only in contexts
where this seems appropriate.
Problem reported by Dmitry Gutov and Andreas Schwab in:
http://lists.gnu.org/archive/html/emacs-devel/2015-08/msg00826.html
http://lists.gnu.org/archive/html/emacs-devel/2015-08/msg00827.html
* doc/lispref/commands.texi (Using Interactive):
* doc/lispref/control.texi (Signaling Errors, Signaling Errors):
* doc/lispref/display.texi (Displaying Messages, Progress):
* doc/lispref/elisp.texi:
* doc/lispref/help.texi (Keys in Documentation):
* doc/lispref/minibuf.texi (Minibuffer Misc):
* doc/lispref/strings.texi (Formatting Strings):
* etc/NEWS:
Document the changes.
* lisp/abbrev.el (expand-region-abbrevs):
* lisp/apropos.el (apropos-library):
* lisp/calc/calc-ext.el (calc-record-message)
(calc-user-function-list):
* lisp/calc/calc-help.el (calc-describe-key, calc-full-help):
* lisp/calc/calc-lang.el (math-read-big-balance):
* lisp/calc/calc-store.el (calc-edit-variable):
* lisp/calc/calc-units.el (math-build-units-table-buffer):
* lisp/calc/calc-yank.el (calc-edit-mode):
* lisp/calendar/icalendar.el (icalendar-export-region)
(icalendar--add-diary-entry):
* lisp/cedet/mode-local.el (mode-local-print-binding)
(mode-local-describe-bindings-2):
* lisp/cedet/semantic/complete.el (semantic-completion-message):
* lisp/cedet/semantic/edit.el (semantic-parse-changes-failed):
* lisp/cedet/semantic/wisent/comp.el (wisent-log):
* lisp/cedet/srecode/insert.el (srecode-insert-show-error-report):
* lisp/descr-text.el (describe-text-properties-1, describe-char):
* lisp/dframe.el (dframe-message):
* lisp/dired-aux.el (dired-query):
* lisp/emacs-lisp/byte-opt.el (byte-compile-log-lap-1):
* lisp/emacs-lisp/bytecomp.el (byte-compile-log)
(byte-compile-log-file, byte-compile-warn, byte-compile-form):
* lisp/emacs-lisp/cconv.el (cconv-convert, cconv--analyze-use)
(cconv-analyze-form):
* lisp/emacs-lisp/check-declare.el (check-declare-warn):
* lisp/emacs-lisp/checkdoc.el (checkdoc-this-string-valid-engine):
* lisp/emacs-lisp/cl-macs.el (cl-symbol-macrolet):
* lisp/emacs-lisp/edebug.el (edebug-format):
* lisp/emacs-lisp/eieio-core.el (eieio-oref):
* lisp/emacs-lisp/eldoc.el (eldoc-minibuffer-message)
(eldoc-message):
* lisp/emacs-lisp/elint.el (elint-file, elint-log):
* lisp/emacs-lisp/find-func.el (find-function-library):
* lisp/emacs-lisp/macroexp.el (macroexp--obsolete-warning):
* lisp/emacs-lisp/map-ynp.el (map-y-or-n-p):
* lisp/emacs-lisp/nadvice.el (advice--make-docstring):
* lisp/emacs-lisp/package.el (package-compute-transaction)
(package-install-button-action, package-delete-button-action)
(package-menu--list-to-prompt):
* lisp/emacs-lisp/timer.el (timer-event-handler):
* lisp/emacs-lisp/warnings.el (lwarn, warn):
* lisp/emulation/viper-cmd.el:
(viper-toggle-parse-sexp-ignore-comments)
(viper-kill-buffer, viper-brac-function):
* lisp/emulation/viper-macs.el (viper-record-kbd-macro):
* lisp/facemenu.el (facemenu-add-new-face):
* lisp/faces.el (face-documentation, read-face-name)
(face-read-string, read-face-font, describe-face):
* lisp/files.el (find-alternate-file, hack-local-variables)
(hack-one-local-variable--obsolete, write-file)
(basic-save-buffer, delete-directory):
* lisp/format.el (format-write-file, format-find-file)
(format-insert-file):
* lisp/help-fns.el (help-fns--key-bindings)
(help-fns--compiler-macro, help-fns--obsolete)
(help-fns--interactive-only, describe-function-1)
(describe-variable):
* lisp/help.el (describe-mode):
* lisp/info-xref.el (info-xref-output):
* lisp/info.el (Info-virtual-index-find-node)
(Info-virtual-index, info-apropos):
* lisp/international/kkc.el (kkc-error):
* lisp/international/mule-cmds.el:
(select-safe-coding-system-interactively)
(select-safe-coding-system, describe-input-method):
* lisp/international/mule-conf.el (code-offset):
* lisp/international/mule-diag.el (describe-character-set)
(list-input-methods-1):
* lisp/international/quail.el (quail-error):
* lisp/minibuffer.el (minibuffer-message):
* lisp/mpc.el (mpc--debug):
* lisp/msb.el (msb--choose-menu):
* lisp/net/ange-ftp.el (ange-ftp-message):
* lisp/net/gnutls.el (gnutls-message-maybe):
* lisp/net/newst-backend.el (newsticker--sentinel-work):
* lisp/net/newst-treeview.el (newsticker--treeview-load):
* lisp/net/nsm.el (nsm-query-user):
* lisp/net/rlogin.el (rlogin):
* lisp/net/soap-client.el (soap-warning):
* lisp/net/tramp.el (tramp-debug-message):
* lisp/nxml/nxml-outln.el (nxml-report-outline-error):
* lisp/nxml/nxml-parse.el (nxml-parse-error):
* lisp/nxml/rng-cmpct.el (rng-c-error):
* lisp/nxml/rng-match.el (rng-compile-error):
* lisp/nxml/rng-uri.el (rng-uri-error):
* lisp/obsolete/iswitchb.el (iswitchb-possible-new-buffer):
* lisp/org/org-ctags.el:
(org-ctags-ask-rebuild-tags-file-then-find-tag):
* lisp/proced.el (proced-log):
* lisp/progmodes/ebnf2ps.el (ebnf-log):
* lisp/progmodes/flymake.el (flymake-log):
* lisp/progmodes/vhdl-mode.el (vhdl-warning-when-idle):
* lisp/replace.el (occur-1):
* lisp/simple.el (execute-extended-command)
(undo-outer-limit-truncate, define-alternatives):
* lisp/startup.el (command-line):
* lisp/subr.el (error, user-error, add-to-list):
* lisp/tutorial.el (tutorial--describe-nonstandard-key)
(tutorial--find-changed-keys):
* src/callint.c (Fcall_interactively):
* src/editfns.c (Fmessage, Fmessage_box):
Restyle the quotes of format strings intended for use as a
diagnostic, when restyling seems appropriate.
* lisp/subr.el (format-message): New function.
* src/doc.c (Finternal__text_restyle): New function.
(syms_of_doc): Define it.
2015-08-24 05:38:02 +00:00
|
|
|
|
(apply #'message fmt args))))
|
2005-09-30 13:18:43 +00:00
|
|
|
|
|
|
|
|
|
(defun dframe-y-or-n-p (prompt)
|
|
|
|
|
"Like `y-or-n-p', but for use in a dedicated frame.
|
|
|
|
|
Argument PROMPT is the prompt to use."
|
|
|
|
|
(save-selected-window
|
|
|
|
|
(if (and ;;default-minibuffer-frame
|
|
|
|
|
dframe-attached-frame
|
|
|
|
|
;;(not (eq default-minibuffer-frame dframe-attached-frame))
|
|
|
|
|
)
|
|
|
|
|
;; KB: Here we do not need calling `dframe-select-attached-frame'
|
|
|
|
|
(select-frame dframe-attached-frame))
|
|
|
|
|
(y-or-n-p prompt)))
|
|
|
|
|
|
|
|
|
|
;;; timer management
|
|
|
|
|
;;
|
|
|
|
|
;; Unlike speedbar with a dedicated set of routines, dframe has one master
|
|
|
|
|
;; timer, and all dframe users will use it. At least until I figure out a way
|
|
|
|
|
;; around that problem.
|
|
|
|
|
;;
|
|
|
|
|
;; Advantage 1: Two apps with timer/frames can munge the master list
|
|
|
|
|
;; to make sure they occur in order.
|
|
|
|
|
;; Advantage 2: If a user hits a key between timer functions, we can
|
|
|
|
|
;; interrupt them safely.
|
|
|
|
|
(defvar dframe-client-functions nil
|
|
|
|
|
"List of client functions using the dframe timer.")
|
|
|
|
|
|
2011-04-19 13:44:55 +00:00
|
|
|
|
(defun dframe-set-timer (timeout fn &optional _null-on-error)
|
2005-09-30 13:18:43 +00:00
|
|
|
|
"Apply a timer with TIMEOUT, to call FN, or remove a timer if TIMEOUT is nil.
|
2011-11-27 04:43:11 +00:00
|
|
|
|
TIMEOUT is the number of seconds until the dframe controlled program
|
2005-09-30 13:18:43 +00:00
|
|
|
|
timer is called again. When TIMEOUT is nil, turn off all timeouts.
|
|
|
|
|
This function must be called from the buffer belonging to the program
|
2011-04-19 13:44:55 +00:00
|
|
|
|
who requested the timer. NULL-ON-ERROR is ignored."
|
2005-09-30 13:18:43 +00:00
|
|
|
|
;; First, fix up our list of client functions
|
|
|
|
|
(if timeout
|
|
|
|
|
(add-to-list 'dframe-client-functions fn)
|
|
|
|
|
(setq dframe-client-functions (delete fn dframe-client-functions)))
|
2011-11-20 07:30:16 +00:00
|
|
|
|
;; Now decided what to do about the timeout.
|
2005-09-30 13:18:43 +00:00
|
|
|
|
(if (or
|
|
|
|
|
;; We have a timer, restart the timer with the new time.
|
|
|
|
|
timeout
|
|
|
|
|
;; We have a timer, an off is requested, and no client
|
|
|
|
|
;; functions are left, shut er down.
|
|
|
|
|
(and dframe-timer (not timeout) dframe-client-functions))
|
|
|
|
|
;; Only call the low level function if we are changing the state.
|
2011-04-19 13:44:55 +00:00
|
|
|
|
(dframe-set-timer-internal timeout)))
|
2005-09-30 13:18:43 +00:00
|
|
|
|
|
2011-04-19 13:44:55 +00:00
|
|
|
|
(defun dframe-set-timer-internal (timeout &optional _null-on-error)
|
2008-04-23 02:57:11 +00:00
|
|
|
|
"Apply a timer with TIMEOUT to call the dframe timer manager."
|
|
|
|
|
(when dframe-timer
|
2019-06-19 20:07:44 +00:00
|
|
|
|
(cancel-timer dframe-timer)
|
2008-04-23 02:57:11 +00:00
|
|
|
|
(setq dframe-timer nil))
|
|
|
|
|
(when timeout
|
2019-06-19 20:07:44 +00:00
|
|
|
|
(setq dframe-timer (run-with-idle-timer timeout t 'dframe-timer-fn))))
|
2005-09-30 13:18:43 +00:00
|
|
|
|
|
|
|
|
|
(defun dframe-timer-fn ()
|
|
|
|
|
"Called due to the dframe timer.
|
|
|
|
|
Evaluates all cached timer functions in sequence."
|
|
|
|
|
(let ((l dframe-client-functions))
|
|
|
|
|
(while (and l (sit-for 0))
|
2013-09-12 05:32:57 +00:00
|
|
|
|
(with-demoted-errors "DFRAME TIMER ERROR: %S"
|
|
|
|
|
(funcall (car l)))
|
2005-09-30 13:18:43 +00:00
|
|
|
|
(setq l (cdr l)))))
|
|
|
|
|
|
2021-02-01 04:33:02 +00:00
|
|
|
|
(defun dframe-popup-kludge (e)
|
|
|
|
|
"Pop up a menu related to the clicked on item.
|
2005-09-30 13:18:43 +00:00
|
|
|
|
Must be bound to event E."
|
2021-02-01 04:33:02 +00:00
|
|
|
|
(interactive "e")
|
|
|
|
|
(save-excursion
|
|
|
|
|
(mouse-set-point e)
|
|
|
|
|
;; This gets the cursor where the user can see it.
|
|
|
|
|
(if (not (bolp)) (forward-char -1))
|
|
|
|
|
(sit-for 0)
|
|
|
|
|
(popup-menu (mouse-menu-major-mode-map) e)))
|
2005-09-30 13:18:43 +00:00
|
|
|
|
|
2024-04-09 02:37:47 +00:00
|
|
|
|
(put 'dframe-popup-kludge 'mouse-1-menu-command t)
|
|
|
|
|
|
2005-09-30 13:18:43 +00:00
|
|
|
|
;;; Interactive user functions for the mouse
|
|
|
|
|
;;
|
2021-02-01 04:33:02 +00:00
|
|
|
|
(defun dframe-mouse-event-p (event)
|
|
|
|
|
"Return t if the event is a mouse related event."
|
|
|
|
|
(if (and (listp event)
|
|
|
|
|
(member (event-basic-type event)
|
|
|
|
|
'(mouse-1 mouse-2 mouse-3)))
|
|
|
|
|
t
|
|
|
|
|
nil))
|
2005-09-30 13:18:43 +00:00
|
|
|
|
|
|
|
|
|
(defun dframe-track-mouse (event)
|
|
|
|
|
"For motion EVENT, display info about the current line."
|
|
|
|
|
(interactive "e")
|
|
|
|
|
(when (and dframe-track-mouse-function
|
2019-06-19 20:07:44 +00:00
|
|
|
|
(windowp (posn-window (event-end event)))) ; Sometimes
|
2005-09-30 13:18:43 +00:00
|
|
|
|
; there is no window to jump into.
|
|
|
|
|
(funcall dframe-track-mouse-function event)))
|
|
|
|
|
|
2011-04-19 13:44:55 +00:00
|
|
|
|
(defun dframe-help-echo (_window &optional buffer position)
|
2005-09-30 13:18:43 +00:00
|
|
|
|
"Display help based context.
|
2019-06-19 20:07:44 +00:00
|
|
|
|
The context is in WINDOW, viewing BUFFER, at POSITION."
|
2005-09-30 13:18:43 +00:00
|
|
|
|
(when (and (not dframe-track-mouse-function)
|
|
|
|
|
(bufferp buffer)
|
|
|
|
|
dframe-help-echo-function)
|
|
|
|
|
(let ((dframe-suppress-message-flag t))
|
|
|
|
|
(with-current-buffer buffer
|
2005-10-04 14:06:44 +00:00
|
|
|
|
(save-excursion
|
|
|
|
|
(if position (goto-char position))
|
|
|
|
|
(funcall dframe-help-echo-function))))))
|
2005-09-30 13:18:43 +00:00
|
|
|
|
|
|
|
|
|
(defun dframe-mouse-set-point (e)
|
2019-06-19 20:07:44 +00:00
|
|
|
|
"Set point based on event E."
|
|
|
|
|
(mouse-set-point e))
|
2005-09-30 13:18:43 +00:00
|
|
|
|
|
|
|
|
|
(defun dframe-quick-mouse (e)
|
|
|
|
|
"Since mouse events are strange, this will keep the mouse nicely positioned.
|
|
|
|
|
This should be bound to mouse event E."
|
|
|
|
|
(interactive "e")
|
|
|
|
|
(dframe-mouse-set-point e)
|
|
|
|
|
(if dframe-mouse-position-function
|
|
|
|
|
(funcall dframe-mouse-position-function)))
|
|
|
|
|
|
|
|
|
|
(defun dframe-power-click (e)
|
2006-02-02 11:04:55 +00:00
|
|
|
|
"Activate any dframe mouse click as a power click.
|
2005-09-30 13:18:43 +00:00
|
|
|
|
A power click will dispose of cached data (if available) or bring a buffer
|
|
|
|
|
up into a different window.
|
|
|
|
|
This should be bound to mouse event E."
|
|
|
|
|
(interactive "e")
|
|
|
|
|
(let ((dframe-power-click t))
|
|
|
|
|
(select-frame last-event-frame)
|
|
|
|
|
(dframe-click e)))
|
|
|
|
|
|
|
|
|
|
(defun dframe-click (e)
|
|
|
|
|
"Call our clients click function on a user click.
|
|
|
|
|
E is the event causing the click."
|
|
|
|
|
(interactive "e")
|
|
|
|
|
(dframe-mouse-set-point e)
|
|
|
|
|
(when dframe-mouse-click-function
|
|
|
|
|
;; On the off chance of buffer switch, or something incorrectly
|
|
|
|
|
;; configured.
|
|
|
|
|
(funcall dframe-mouse-click-function e)))
|
|
|
|
|
|
|
|
|
|
(defun dframe-double-click (e)
|
|
|
|
|
"Activate the registered click function on a double click.
|
|
|
|
|
This must be bound to a mouse event.
|
|
|
|
|
This should be bound to mouse event E."
|
|
|
|
|
(interactive "e")
|
|
|
|
|
(cond ((eq (car e) 'down-mouse-1)
|
|
|
|
|
(dframe-mouse-set-point e))
|
|
|
|
|
((eq (car e) 'mouse-1)
|
|
|
|
|
(dframe-quick-mouse e))
|
|
|
|
|
((or (eq (car e) 'double-down-mouse-1)
|
|
|
|
|
(eq (car e) 'triple-down-mouse-1))
|
|
|
|
|
(dframe-click e))))
|
|
|
|
|
|
|
|
|
|
;;; Hacks of normal things.
|
|
|
|
|
;;
|
|
|
|
|
;; Some normal things that happen in one of these dedicated frames
|
|
|
|
|
;; must be handled specially, so that our dedicated frame isn't
|
|
|
|
|
;; messed up.
|
|
|
|
|
(defun dframe-temp-buffer-show-function (buffer)
|
|
|
|
|
"Placed in the variable `temp-buffer-show-function' in dedicated frames.
|
|
|
|
|
If a user requests help using \\[help-command] <Key> the temp BUFFER will be
|
|
|
|
|
redirected into a window on the attached frame."
|
|
|
|
|
(if dframe-attached-frame (dframe-select-attached-frame))
|
|
|
|
|
(pop-to-buffer buffer nil)
|
|
|
|
|
(other-window -1)
|
2019-06-19 20:07:44 +00:00
|
|
|
|
(run-hooks 'temp-buffer-show-hook))
|
2005-09-30 13:18:43 +00:00
|
|
|
|
|
2011-04-19 13:44:55 +00:00
|
|
|
|
(defun dframe-hack-buffer-menu (_e)
|
2005-09-30 13:18:43 +00:00
|
|
|
|
"Control mouse 1 is buffer menu.
|
|
|
|
|
This hack overrides it so that the right thing happens in the main
|
|
|
|
|
Emacs frame, not in the dedicated frame.
|
|
|
|
|
Argument E is the event causing this activity."
|
|
|
|
|
(interactive "e")
|
2019-06-19 20:07:44 +00:00
|
|
|
|
(let ((fn (lookup-key global-map [C-down-mouse-1]))
|
2005-09-30 13:18:43 +00:00
|
|
|
|
(oldbuff (current-buffer))
|
|
|
|
|
(newbuff nil))
|
|
|
|
|
(unwind-protect
|
|
|
|
|
(save-excursion
|
|
|
|
|
(set-window-dedicated-p (selected-window) nil)
|
|
|
|
|
(call-interactively fn)
|
|
|
|
|
(setq newbuff (current-buffer)))
|
|
|
|
|
(switch-to-buffer oldbuff)
|
|
|
|
|
(set-window-dedicated-p (selected-window) t))
|
|
|
|
|
(if (not (eq newbuff oldbuff))
|
|
|
|
|
(dframe-with-attached-buffer
|
|
|
|
|
(switch-to-buffer newbuff)))))
|
|
|
|
|
|
|
|
|
|
(defun dframe-switch-buffer-attached-frame (&optional buffer)
|
|
|
|
|
"Switch to BUFFER in the attached frame, and raise that frame.
|
|
|
|
|
This overrides the default behavior of `switch-to-buffer' which is
|
|
|
|
|
broken because of the dedicated frame."
|
|
|
|
|
(interactive)
|
|
|
|
|
;; Assume we are in the dedicated frame.
|
|
|
|
|
(other-frame 1)
|
|
|
|
|
;; Now switch buffers
|
|
|
|
|
(if buffer
|
|
|
|
|
(switch-to-buffer buffer)
|
|
|
|
|
(call-interactively 'switch-to-buffer nil nil)))
|
|
|
|
|
|
|
|
|
|
(defun dframe-mouse-hscroll (e)
|
|
|
|
|
"Read a mouse event E from the mode line, and horizontally scroll.
|
2019-06-19 20:07:44 +00:00
|
|
|
|
If the mouse is being clicked on the far left, or far right of
|
|
|
|
|
the mode-line."
|
2005-09-30 13:18:43 +00:00
|
|
|
|
(interactive "e")
|
|
|
|
|
(let* ((x-point (car (nth 2 (car (cdr e)))))
|
|
|
|
|
(pixels-per-10-col (/ (* 10 (frame-pixel-width))
|
|
|
|
|
(frame-width)))
|
2019-06-19 20:07:44 +00:00
|
|
|
|
(click-col (1+ (/ (* 10 x-point) pixels-per-10-col))))
|
2005-09-30 13:18:43 +00:00
|
|
|
|
(cond ((< click-col 3)
|
|
|
|
|
(scroll-left 2))
|
|
|
|
|
((> click-col (- (window-width) 5))
|
|
|
|
|
(scroll-right 2))
|
|
|
|
|
(t (dframe-message
|
2012-06-02 10:56:09 +00:00
|
|
|
|
"Click on the edge of the mode line to scroll left/right")))))
|
2005-09-30 13:18:43 +00:00
|
|
|
|
|
2021-02-01 15:03:10 +00:00
|
|
|
|
|
|
|
|
|
;;; Obsolete
|
|
|
|
|
|
|
|
|
|
(defvar dframe-version "1.3"
|
|
|
|
|
"The current version of the dedicated frame library.")
|
2021-03-31 16:17:15 +00:00
|
|
|
|
(make-obsolete-variable 'dframe-version 'emacs-version "28.1")
|
2021-02-01 15:03:10 +00:00
|
|
|
|
|
2005-09-30 13:18:43 +00:00
|
|
|
|
(provide 'dframe)
|
|
|
|
|
|
|
|
|
|
;;; dframe.el ends here
|