This change introduces a new metaconfiguration variable `emacs-width'
which defaults for 77 for the usual historical reasons. It's used:
* to set the default `loose' Emacs frame width, in `.Xdefaults', via
some fiddly C preprocessor hacking;
* to choose the initial Emacs frame size, in `.xinitrc';
* to decide how to divvy up windows, refill text, highlight overlong
lines, and all of that good stuff, in `.emacs' and `dot-emacs.el'.
Emacs itself now has two new variable, `mdw-column-width' which is the
`physical' column width, used to decide how big to make windows and
frames; and `mdw-text-width' which is a potentially buffer-local
variable holding the logical text width in the buffer, used for
refilling text and highlighting long lines.
This is probably not completely right yet, but it seems like a good
start for supporting environments where I'm expected to use a different
column width most of the time.
If `emacs-width' is unset, or left as its default, there should be no
change.
XConsole*geometry: 485x455
!! Emacs.
XConsole*geometry: 485x455
!! Emacs.
+#define _GEOM(wd, ht) wd##x##ht
+#define GEOM(wd, ht) _GEOM(wd, ht)
+emacs.geometry: GEOM(EMACSWD,33)
Emacs.pane.menubar.font: NICEFONT
Emacs.menu*.font: NICEFONT
Emacs.font: FIXED
Emacs.pane.menubar.font: NICEFONT
Emacs.menu*.font: NICEFONT
Emacs.font: FIXED
(setq read-quoted-char-radix 16) ;C-q HEX-STUFF [RET]
(setq case-fold-file-names nil) ;Don't translate file names (grr...)
(setq scroll-step 5) ;Don't scroll too much at a time
(setq read-quoted-char-radix 16) ;C-q HEX-STUFF [RET]
(setq case-fold-file-names nil) ;Don't translate file names (grr...)
(setq scroll-step 5) ;Don't scroll too much at a time
-(setq-default fill-column 77) ;I use rather narrow windows
+(setq-default fill-column mdw-text-width) ;I use rather narrow windows
(setq-default comment-column 40) ;Set a standard comment column
(setq-default truncate-partial-width-windows nil
truncate-lines t)
(setq-default comment-column 40) ;Set a standard comment column
(setq-default truncate-partial-width-windows nil
truncate-lines t)
(setq view-read-only t)
(setq whitespace-style '(trailing empty indentation face lines-tail
space-before-tab space-after-tab)
(setq view-read-only t)
(setq whitespace-style '(trailing empty indentation face lines-tail
space-before-tab space-after-tab)
- whitespace-line-column 77)
+ whitespace-line-column mdw-text-width)
(setq woman-use-own-frame nil ;Keep man pages somewhere sensible
woman-fill-column 72) ;Right margin position.
(setq diff-switches "-u" ;I like reading unified diffs
(setq woman-use-own-frame nil ;Keep man pages somewhere sensible
woman-fill-column 72) ;Right margin position.
(setq diff-switches "-u" ;I like reading unified diffs
(setq frame-background-mode (if mdw-black-background 'dark 'light)
default-frame-alist
(setq frame-background-mode (if mdw-black-background 'dark 'light)
default-frame-alist
- `((width . ,(if (>= emacs-major-version 21) 77 78))
+ `((width . ,(+ mdw-column-width
+ (if (>= emacs-major-version 21) 0 1)))
(height . 33)
(vertical-scroll-bars . right)
(cursor-type . bar)
(height . 33)
(vertical-scroll-bars . right)
(cursor-type . bar)
(cursor-color . "red")
(background-mode . ,frame-background-mode))
initial-frame-alist
(cursor-color . "red")
(background-mode . ,frame-background-mode))
initial-frame-alist
- `((width . ,(if (>= emacs-major-version 21) 77 78))
+ `((width . ,(+ mdw-column-width
+ (if (>= emacs-major-version 21) 0 1)))
(menu-bar-lines . ,(if window-system 1 0)))
window-system-default-frame-alist
'((pm (font . "-os2-System VIO-medium-r-normal--*-40-*-*-m-*-cp850")
(menu-bar-lines . ,(if window-system 1 0)))
window-system-default-frame-alist
'((pm (font . "-os2-System VIO-medium-r-normal--*-40-*-*-m-*-cp850")
## e_lineht = height of a character line in pixels
## e_vextra = number of additional vertical cruft pixels
## So an N-line Emacs frame takes N*e_lineht + e_vextra pixels
## e_lineht = height of a character line in pixels
## e_vextra = number of additional vertical cruft pixels
## So an N-line Emacs frame takes N*e_lineht + e_vextra pixels
-e_colwd=492 e_colchars=82 e_lineht=13
+e_colsz=$(mdw-conf emacs-width 77) e_charwd=6 e_colextra=30
+e_colwd=$(( e_colsz*e_charwd + e_colextra ))
+e_colchars=$(( e_colsz + 5 )) e_lineht=13
case "$emacs" in
emacs21 | emacs) e_hextra=34 e_cextra=-2 e_vextra=52 ;;
emacs22 | emacs23) e_hextra=8 e_cextra=-6 e_vextra=46 ;;
case "$emacs" in
emacs21 | emacs) e_hextra=34 e_cextra=-2 e_vextra=52 ;;
emacs22 | emacs23) e_hextra=8 e_cextra=-6 e_vextra=46 ;;
(concat "(" (buffer-string) ")")))))))
(cdr (assq sym mdw-config)))
(concat "(" (buffer-string) ")")))))))
(cdr (assq sym mdw-config)))
+;; Width configuration.
+
+(defvar mdw-column-width
+ (string-to-number (or (mdw-config 'emacs-width) "77"))
+ "Width of Emacs columns.")
+(defvar mdw-text-width mdw-column-width
+ "Expected width of text within columns.")
+(put 'mdw-text-width 'safe-local-variable 'integerp)
+
;; Local variables hacking.
(defun run-local-vars-mode-hook ()
;; Local variables hacking.
(defun run-local-vars-mode-hook ()
(interactive "P")
(setq width (cond (width (prefix-numeric-value width))
((and window-system (mdw-emacs-version-p 22))
(interactive "P")
(setq width (cond (width (prefix-numeric-value width))
((and window-system (mdw-emacs-version-p 22))
+ mdw-column-width)
+ (t (1+ mdw-column-width))))
(let* ((win (selected-window))
(sb-width (mdw-horizontal-window-overhead))
(c (/ (+ (window-width) sb-width)
(let* ((win (selected-window))
(sb-width (mdw-horizontal-window-overhead))
(c (/ (+ (window-width) sb-width)
(setq page-delimiter "\f\\|^.*-\\{6\\}.*$")
(setq comment-column 40)
(auto-fill-mode 1)
(setq page-delimiter "\f\\|^.*-\\{6\\}.*$")
(setq comment-column 40)
(auto-fill-mode 1)
+ (setq fill-column mdw-text-width)
(and (fboundp 'gtags-mode)
(gtags-mode))
(if (fboundp 'hs-minor-mode)
(and (fboundp 'gtags-mode)
(gtags-mode))
(if (fboundp 'hs-minor-mode)
(trap (turn-on-font-lock)))
(defun mdw-post-local-vars-misc-mode-config ()
(trap (turn-on-font-lock)))
(defun mdw-post-local-vars-misc-mode-config ()
+ (setq whitespace-line-column mdw-text-width)
(when (and mdw-do-misc-mode-hacking
(not buffer-read-only))
(setq show-trailing-whitespace t)
(when (and mdw-do-misc-mode-hacking
(not buffer-read-only))
(setq show-trailing-whitespace t)
[ "$xstuff" ] && cppfiles="$cppfiles
Xdefaults"
echo "Hacking files with C preprocessor..."
[ "$xstuff" ] && cppfiles="$cppfiles
Xdefaults"
echo "Hacking files with C preprocessor..."
+defs="-DHOME=$HOME -DPROFILE=$here"
+defs="$defs -DEMACSWD=$(mdw-conf emacs-width 77)"
for c in $cppfiles; do
target=.$c
case $c in
for c in $cppfiles; do
target=.$c
case $c in
ft=$HOME$sub/$target
dir=${ft%/*}
mkdir -p $dir
ft=$HOME$sub/$target
dir=${ft%/*}
mkdir -p $dir
- cpp -P dot/$c -o $ft.new
+ cpp -P $defs dot/$c -o $ft.new
mv $ft.new $ft
echo " $target"
done
mv $ft.new $ft
echo " $target"
done