dot/xinitrc: If we find an unversioned Emacs, discover its version.
authorMark Wooding <mdw@distorted.org.uk>
Fri, 10 Apr 2020 17:03:54 +0000 (18:03 +0100)
committerMark Wooding <mdw@distorted.org.uk>
Fri, 10 Apr 2020 17:03:54 +0000 (18:03 +0100)
This is because Debian has (rather annoyingly) given up its policy of
allowing multiple Emacs versions to be coinstalled.

dot/xinitrc

index 6a72f2e..cfbfdbd 100755 (executable)
@@ -225,6 +225,19 @@ emacs=$(pick_program emacs \
   emacs-lucid emacs)
 term=$(pick_program terminal pterm Eterm xterm)
 
+## If we fell back to an unversioned Emacs binary, then figure out what
+## version it actually is.
+case $emacs in
+  emacs | emacs-lucid)
+    set -- $($emacs --version | head -n1)
+    e_ver=emacs${3%%.*}${emacs#emacs}
+    ;;
+  *)
+    e_ver=$emacs
+    ;;
+esac
+info emacs-version = $e_ver
+
 ## Emacs window measurements.
 ##
 ## e_colsz = width of a column in characters (from `emacs-width' metaconfig)
@@ -244,7 +257,7 @@ term=$(pick_program terminal pterm Eterm xterm)
 ##     So an N-line Emacs frame takes N*e_lineht + e_vextra pixels
 e_colsz=$(mdw-conf emacs-width 77) e_charwd=6
 e_colextra=30 e_colextrachars=5 e_lineht=13
-case "$emacs" in
+case "$e_ver" in
   emacs21 | emacs) e_hextra=34 e_cextra=-2 e_vextra=52 ;;
   emacs22 | emacs23) e_hextra=8 e_cextra=-6 e_vextra=46 ;;
   emacs24) e_hextra=5 e_cextra=-6 e_vextra=42 ;;