summaryrefslogtreecommitdiff
path: root/.emacs.d/early-init.el
diff options
context:
space:
mode:
authorSean Whitton <spwhitton@spwhitton.name>2022-12-27 11:16:28 -0700
committerSean Whitton <spwhitton@spwhitton.name>2022-12-27 11:16:28 -0700
commit04ead44c46cc71c9d6f076e84da1e11f9e5d8864 (patch)
tree1f695d5b2e58e50904516d9db2d1f843f4b97572 /.emacs.d/early-init.el
parentb1803ad503967550e733a9c65773dacde65a7dc5 (diff)
downloaddotfiles-04ead44c46cc71c9d6f076e84da1e11f9e5d8864.tar.gz
new detection of in-tree builds, simplify setting frame-title-format
Diffstat (limited to '.emacs.d/early-init.el')
-rw-r--r--.emacs.d/early-init.el60
1 files changed, 25 insertions, 35 deletions
diff --git a/.emacs.d/early-init.el b/.emacs.d/early-init.el
index 39847ba7..67d41b1c 100644
--- a/.emacs.d/early-init.el
+++ b/.emacs.d/early-init.el
@@ -15,18 +15,32 @@
;; You should have received a copy of the GNU General Public License
;; along with this file. If not, see <https://www.gnu.org/licenses/>.
-(when (file-in-directory-p invocation-directory (expand-file-name "~/"))
- ;; Make packages compiled against my emacs-snapshot Debian packages
- ;; available to in-tree builds too. (Used to do this by patching the code
- ;; computing the default value of `package-directory-list' in those builds.)
- (when (file-directory-p "/usr/share/emacs-snapshot/site-lisp/elpa")
- (add-to-list 'package-directory-list
- "/usr/share/emacs-snapshot/site-lisp/elpa" t))
+(let ((in-tree
+ ;; `installation-directory' is normally nil when running an installed
+ ;; Emacs. If I've installed Emacs somewhere under HOME, then I can
+ ;; ensure that it is indeed nil when running that build.
+ ;; Thus, if `installation-directory' is non-nil and under HOME, we can
+ ;; be sure that we are running an uninstalled executable.
+ (and installation-directory
+ (file-in-directory-p installation-directory
+ (expand-file-name "~/")))))
+ (when in-tree
+ ;; Make packages compiled against my emacs-snapshot Debian packages
+ ;; available to in-tree builds. (Previously we patched the code computing
+ ;; the default value of `package-directory-list' in those builds.)
+ (when (file-directory-p "/usr/share/emacs-snapshot/site-lisp/elpa")
+ (add-to-list 'package-directory-list
+ "/usr/share/emacs-snapshot/site-lisp/elpa" t))
- ;; Run Debian's site-start library site-run-file for in-tree builds too.
- ;; (Used to do this by patching `command-line' in those builds.)
- (when (file-readable-p "/etc/emacs/site-start.d/00debian.el")
- (load "/etc/emacs/site-start.d/00debian.el")))
+ ;; Run Debian's site-start library site-run-file for in-tree builds too.
+ ;; (Used to do this by patching `command-line' in those builds.)
+ (when (file-readable-p "/etc/emacs/site-start.d/00debian.el")
+ (load "/etc/emacs/site-start.d/00debian.el")))
+
+ (setq frame-title-format
+ (format "%%b - %s Emacs-%s@%s"
+ (if in-tree "in-tree" "installed") emacs-version system-name)
+ icon-title-format frame-title-format))
;;; Per docstring for `after-make-frame-functions', these additions to that
@@ -88,27 +102,3 @@ won't be found."
;; (not (or spw/tiling-wm-p (eq (framep frame) 'x))))
)
(add-to-list 'after-make-frame-functions #'spw/detect-tiling-wm)
-
-(defun spw/use-tabs-not-frames (&optional frame)
- "Whether to pop up new tabs instead of new frames.
-Should be t when do not have a good way to handle having lots of open
-frames, as I do have under i3/swaywm with its tabbed layout, which is my
-default layout."
- (not (and spw/tiling-wm-p
- (memq (framep (or frame (selected-frame))) '(x pgtk)))))
-
-(defun spw/set-frame-title-format (frame)
- "If we're going to be using multiple frames, make `frame-title-format' not
-depend on whether there are multiple frames right now."
- (unless (spw/use-tabs-not-frames frame)
- (setq after-make-frame-functions
- (delq #'spw/set-frame-title-format after-make-frame-functions))
- (setq frame-title-format
- (format "%%b - %s Emacs-%s@%s"
- (if (file-in-directory-p invocation-directory
- (expand-file-name "~/"))
- "in-tree" "installed")
- emacs-version system-name)
- icon-title-format frame-title-format)))
-;; Must come after `spw/detect-tiling-wm'.
-(add-to-list 'after-make-frame-functions #'spw/set-frame-title-format t)