Yet another wish list...

5 views
Skip to first unread message

Davin Pearson

unread,
Feb 25, 1998, 3:00:00 AM2/25/98
to

Yet Another Emacs Wish List...
------------------------------

(*) Support for different colours on the modeline.

(*) Different colours in the mini-buffer line. Eg: a prompt like
"switch to buffer: game.cc" with the words "game.cc" in bright green.

(*) Facility that allows you to set the modeline colours on a
per-buffer basis. On my Emacs system, I have all buffers in my home
directory appearing with a grey modeline, all buffers from directory
"junk" appearing with a brown modeline, all buffers from my main
programming project "~/skid/3d" in another distinctive colour. This
list goes on and on, but unfortunately my system that implements it is
inelegant and incomplete.

(*) Recover session: I can't get this to work... (I am using Djgpp
Emacs)

(*) A text-editing mode that worked like the major word processors
(eg. MS Word etc). Specifically what I want is support for really
long lines of text, displayed in such a way that lines wrap around the
screen but NO WORD IS EVER SPLIT IN HALF. Auto-fill'ed text-mode mode
goes some way to achieving this, but you still have \n's at the end of
each line which means that if you import the file into MS-word, each
line is considered as a separate paragraph so that you can't print it
with nice justification.

Is there an easy way to print a Postscript file in Windows 3.1. That
way I could avoid using MS-Word and this problem would be solved...

(*) How do I make Emacs respond when I type: "C-x b d RET" by
switching to my buffer called "diary" (assuming that I have no other
buffers beginning with the letter "d" for this example). So what I
want is a way to eliminate the default behaviour whereby it puts me
into a new, empty buffer called "d".

--
Davin Pearson d.pe...@ext.canterbury.ac.nz

Eli Zaretskii

unread,
Feb 25, 1998, 3:00:00 AM2/25/98
to

On Wed, 25 Feb 1998, Davin Pearson wrote:

> (*) Support for different colours on the modeline.

Colors *are* supported on the modeline: you can set fore- and background
colors for the modeline face.

If you want different parts of the modeline to have different colors,
then can you explain why this is needed, and how should these colors be
set by a user? IMHO a feature which is hard to set will not be used
anyway.

> (*) Different colours in the mini-buffer line. Eg: a prompt like
> "switch to buffer: game.cc" with the words "game.cc" in bright green.

This can ve solved by using font-lock that's sensitive to what the prompt
says.

> (*) Facility that allows you to set the modeline colours on a
> per-buffer basis.

You can use existing Emacs facilities to do this. There are hooks which
are run when Emacs switches buffers, which you can use to change the
colors of the modeline.

> (*) Recover session: I can't get this to work... (I am using Djgpp
> Emacs)

Please post the details (see the chapter in the Emacs manual about
submitting bug reports). `recover-session' works for me (in the
DJGPP-compiled Emacs) all the time.

> Auto-fill'ed text-mode mode
> goes some way to achieving this, but you still have \n's at the end of
> each line which means that if you import the file into MS-word, each
> line is considered as a separate paragraph so that you can't print it
> with nice justification.

I fail to understand why would anybody want to import anything into that
monstrosity called MS Word. But if you really need it, the way to go is
probably by making Emacs encode the file when it writes the buffer so
that Word will be able to read it easier. Emacs 20 has a notion of a
coding system, and you should be able to create your own coding systems
to read and write files in any format. Emacs 19 doesn't support coding
systems, but there are hooks it runs when writing the buffer which you
could utilize, and there is a mechanism to define your own customized
handler for operations on files whose names match some pattern.

> Is there an easy way to print a Postscript file in Windows 3.1.

Did you try reading the manual? There is the `ps-print' package which
will allow you to pretty-print buffers to a PostScript printer. If your
printer doesn't support PostScript, the section named "Printing and
MS-DOS" in the manual describes how to set up Emacs to pipe the
PostScript output into Ghostscript (which you will need to download and
install) so you could use `ps-print' with any printer supported by
Ghostscript.

(The above assumes you have Emacs 19.34 or later; if not, you can
download the latest binary of Emacs 19.34 from the DJGPP sites on
SimTel.NET mirrors.)

Eli Zaretskii

unread,
Feb 25, 1998, 3:00:00 AM2/25/98
to

On 24 Feb 1998, Kai Grossjohann wrote:

> Try M-x enriched-mode RET. Does this do something useful?

IMHO, Enriched Mode is *very* useful. I'm using it for small-size word-
processing for years, together with `ps-print' that prints the documents
beautifully. But it isn't a solution to what the original poster wanted,
which is to have lines without `\n' at the end of the line. AFIK, the
latter is impossible in Emacs (but you can have Emacs convert files to
and from such formats during I/O).

steinmar...@si.com

unread,
Feb 25, 1998, 3:00:00 AM2/25/98
to

Davin Pearson wrote:
>Yet Another Emacs Wish List...
>------------------------------

>(*) A text-editing mode that worked like the major word processors
>(eg. MS Word etc). Specifically what I want is support for really
>long lines of text, displayed in such a way that lines wrap around the

>screen but NO WORD IS EVER SPLIT IN HALF. Auto-fill'ed text-mode mode


>goes some way to achieving this, but you still have \n's at the end of
>each line which means that if you import the file into MS-word, each
>line is considered as a separate paragraph so that you can't print it
>with nice justification.
>

I'm sure more experienced emacs lispers can do some of this
much better, but does *this* do what you want?

-Dan
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;; word-wrap-mode (kind of a minor mode)
;; Version: 0.6
;; Modified: 11/18/97
;; Created by Dan Steinmark
;; 4 Sep 97
;;
;; Description:
;; Allows the text to be displayed in auto-fill
;; but the returns within a paragraph are not saved.
;; Paragraphs are defined according to that used by forward-paragraph and
;; backward-paragraph.
;; Use (require 'word-wrap-mode) to load.
;; Turn on and off using M-x word-wrap-mode
;;
;; Also provides the following routines which may be useful:
;; unfill-paragraph For removing soft returns in current paragraph
;; unfill-buffer For removing soft returns in buffer
;; convert-returns-to-soft For converting hard returns in region
;;
;; Configuration variables:
;; ww-force-all-returns-hard defaults to nil, which helps with
;; conversion from non-word-wrapped files,
;; but does not work with a few types of
;; files that have been created with
;; word-wrap. see on-line docs.
;;
;; Would be nice if:
;; it provided a mode hook
;; it did a lazy-lock style fill/unfill so saves & mode changes don't
;; take a long time on large files.
;; fill command was configurable
;; autoload were added (?)
;; etc...
;;
;; Bugs/Side Affects/Limitations (?):
;; User can turn off auto-fill, which doesn't really make much sense.
;; For this to be totally correct, hard vs. soft newlines need to
;; be encoded.
;; Refills buffer after saves.
;; Point repositioning does not accommodate changes.
;; Does not handle fill-prefixes, indented paragraphs, or right margins
;; etc...
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;


(defvar ww-force-all-returns-hard nil
"*Configures word-wrap-mode

Typical usage:
If you need to convert 'filled' files into word-wrapped format
(returns internal to paragraphs displayed during editing, but deleted
upon saving) then
set ww-force-all-returns-hard to nil (the default)
This will make conversion fairly automatic.

If you do not often need to convert 'filled' files, then
set ww-force-all-returns-hard to t
This will work well with files already in word-wrapped format, but
will necessitate you first convert 'filled' files using
M-x unfill-buffer
otherwise there will be hard returns placed within all the
paragraphs.

Description:
On startup, word-wrap-mode converts some or all returns
to hard returns. If there are no lines longer than the screen, and
there are no hard returns in the buffer, (typical of a file using
auto-fill-mode and saved not using word-wrap-mode), and then the
returns are place only the end of paragraphs. Normally, a
word-wrapped file will have long lines, which will cause all returns
to be made hard returns, which are then maintained until saved.

If you have adjacent, short lines, which are not separated by
whitespace, and have no long lines, in your word wrapped file, this
variable may be set to 't' to force all returns to hard, but
conversion of non- word-wrapped files will need to be first unfilled
using M-x unfill-buffer. Otherwise there will be hard returns
inserted within paragraphs.")
(setq ww-force-all-returns-hard nil)

(defvar word-wrap-mode nil
"It is an error to set this value manually. It should be set using
word-wrap-mode, turn-on-word-wrap, or turn-off-word-wrap only.")
(make-variable-buffer-local 'word-wrap-mode)


;;(defvar temp-save-buffer nil)
;;(defvar temp-save-buffer-point nil)
;;(defvar temp-save-buffer-mark)

;;(defvar old-after-save-hook after-save-hook)
;;(defvar old-write-contents-hooks write-contents-hooks)

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;; Add to mode line.
(or (assq 'word-wrap-mode minor-mode-alist)
(setq minor-mode-alist
(cons '(word-wrap-mode (" Wrap"))
minor-mode-alist)))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;(defun store-buffer-temporarily ()
; "saves the current buffer, point, and mark in the global temp-save-buffer...
;variables"
; (interactive)
; (if (not (buffer-live-p temp-save-buffer))
; (setq temp-save-buffer (create-file-buffer "*temp-save-buffer*")))
;
; (copy-to-buffer temp-save-buffer (point-min) (point-max))
; (setq temp-save-buffer-point (point))
; (setq temp-save-buffer-mark (mark))
; )

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;; somehow, the point and mark get clobbered anyway, when used with
;; after-save-hook, even though they are restored prior to finishing.
;(defun restore-current-buffer ()
; "restores the current buffer from the global temp-save-buffer, (if active)
;which is usually created using save-buffer-temporarily"
; (interactive)
; (let ((curr-buffer (current-buffer)))
;
; (if (not (buffer-live-p temp-save-buffer))
; (error "*temp-save-buffer* not active")
; ;; else
; (set-buffer temp-save-buffer)
; (copy-to-buffer curr-buffer (point-min) (point-max))
; (set-buffer curr-buffer)
; (set-mark temp-save-buffer-mark)
; (goto-char temp-save-buffer-point)
; (message "went to char: %d" (point))
; ))
;
; );; end restore-current-buffer

;; Maybe save-excursion should be used, instead.

(defun restore-current-buffer ()
"restores the current buffer for word-wrap-mode for use following a save"

(let ((old-point (point)))
(fill-region (point-min) (point-max) nil t)
(goto-char old-point)
);; end let
);; end restore-current-buffer

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;(defun unfill-and-restore ()
; (interactive)
;
; (store-buffer-temporarily)
;
; (unfill-buffer)
;
; (restore-current-buffer)
; )

(defun store-then-unfill-buffer ()
"Originally store buffer in a temp buffer for later restoration,
then unfills the current buffer.
Now it just unfills the buffer. The restore no longer relies on
the save temp-buffer."

;; (store-buffer-temporarily)
(unfill-buffer)
nil
)

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;; unfill-paragraph looks for return followed by a non-ws char, and then
;; merges the lines with a single space (or possibly a double space for
;; end of sentences and after colons, according to sentence-end-double-space
;; and colon-double-space). Moves point to after paragraph.
;;
(defun unfill-paragraph ()
"unfills the paragraph after or around the point. Does not handle
fill-prefixes."
(interactive)
(let ((end-of-paragraph-loc nil)
(replace-p nil)
(replace-with-spaces 1)
(spaces " "))
(forward-paragraph)
(setq end-of-paragraph-loc (point))
(backward-paragraph)
(while (and (looking-at "[ \t]*\n")
(< (point) end-of-paragraph-loc))
(forward-line))
(while (< (point) end-of-paragraph-loc)

(end-of-line)
(backward-char)
(cond ((looking-at (concat sentence-end ;; end of sentence
"\n[^ \t\n]")) ;; return followed by non ws
(progn
(if sentence-end-double-space
(setq replace-with-spaces 2)
(setq replace-with-spaces 1))
(setq replace-p t)))

((looking-at ":\n[^ \t\n]") ;; a colon, return, non ws
(progn
(if colon-double-space
(setq replace-with-spaces 2)
(setq replace-with-spaces 1))
(setq replace-p t)))

((looking-at ".\n[^ \t\n]") ;; any other char, ret non ws
(progn
(setq replace-with-spaces 1)
(setq replace-p t)))

(t ;; otherwise
(progn
(forward-line)
(setq replace-p nil))))

(if replace-p
(progn
(forward-char)
(if (get-text-property (point) 'hard)
(forward-line) ;; only replace soft returns
;;else
(delete-char 1)
(if (= replace-with-spaces 1)
(setq spaces " ")
(setq spaces " "))
(insert spaces)
(setq end-of-paragraph-loc (+ (- replace-with-spaces 1)
end-of-paragraph-loc))
)))

);; end while
);; end let
);; end unfill-paragraph


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;; convert-returns-to-hard
;;
(defun make-return-hard (hard-p)
"If the point is on a return,
this makes it 'hard' by setting the 'hard' property to t,
if argument HARD-P is t, otherwise it makes it nil"
(interactive)
(if (looking-at "\n")
(put-text-property (point) (1+ (point)) 'hard hard-p))
)

(defun convert-buffer-returns-to-hard (&optional convert-all-p)
"Converts all returns in the buffer to hard returns, if the optional
parameter convert-all-p is non-nil, otherwise, converts only returns
that are at paragraph ends."
(interactive "P")
(let ((old-point (point)))

(goto-char (point-min))

(if convert-all-p
(while (search-forward "\n" nil t)
(goto-char (match-beginning 0))
(make-return-hard t)
(goto-char (match-end 0))
)
;; else
(while (< (point) (point-max))
(forward-paragraph)
(backward-char)
(make-return-hard t) ;; only does it if its a return
(forward-char)))

(goto-char old-point)
)
);; end convert-buffer-returns-to-hard


(defun convert-returns-to-soft ()
"Converts all returns in the region to soft returns."
(interactive)
(let ((old-point (point))
(reg-beg (region-beginning))
(reg-end (region-end)))

(goto-char reg-beg)

(while (search-forward "\n" reg-end t)
(goto-char (match-beginning 0))
(make-return-hard nil)
(goto-char (match-end 0))
)

(goto-char old-point)
)
);; end convert-returns-to-soft


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;; unfill-buffer does the whole buffer, return the point to about the
;; right place
;;
(defun unfill-buffer ()
"unfills every paragraph in the buffer using unfill-paragraph"
(interactive)
(let ((old-point (point))
(point-before nil)
(progress-made-p t))
(goto-char (point-max))

(while (and progress-made-p
(> (point) (point-min)))
(setq point-before (point))
(backward-paragraph)
(unfill-paragraph)
(backward-paragraph)
(if (= (point) point-before)
(setq progress-made-p nil))
)

(goto-char old-point)
)
)

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;; Puts the buffer back to filled, for use with after-save-hook.
;;
(defun wordwrap-after-save-hook ()
(restore-current-buffer)
(set-buffer-modified-p nil)
(message "Wrote %s without soft returns" (buffer-file-name))
)


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(defun long-lines-exist-p ()
"checks to see if there are any lines longer than the fill-column"
(interactive)
(let ((old-point (point))
(long-line-found nil))
(goto-char (point-min))
(while (and (not (eobp))
(not long-line-found))
(end-of-line)
(if (> (current-column) fill-column)
(setq long-line-found t))
(forward-line)
)
(goto-char old-point)
long-line-found
)
);; end long-lines-exist-p


(defun hard-returns-exist-p ()
"checks to see if there are any lines longer than the fill-column"
(interactive)
(let ((old-point (point))
(hard-return-found nil))
(goto-char (point-min))
(while (and (not (eobp))
(not hard-return-found))
(end-of-line)
(if (get-text-property (point) 'hard)
(setq hard-return-found t))
(forward-line)
)
(goto-char old-point)
hard-return-found
)
);; end hard-returns-exist-p


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;; puts the minor mode into word wrap
;; inserts returns
;; changes mode line
;; sets fill-column to full frame width
;; modifies save hooks to save without the returns
;;
;;
;;when going into word-wrap:
;;if long lines (> fill-column) and
;; there exist hard returns ;; an inbetween state, some are not filled
;;then
;; put hard returns only at paragraph ends
;;
;;if no long lines and
;; no hard returns ;; buffer in need of word wrap, but has returns "saved"
;;then
;; put hard returns only at paragraph ends
;;
;;if long lines and
;; no hard returns ;; typical file using word wrap,
;; ;; or a file with some but not all lines wrapped
;;then
;; put hard returns everywhere
;;
;;if no long lines and
;; there exist hard returns ;; should already be set up as ready for wrap
;;then
;; put hard returns only at paragraph ends
;;

(defun turn-on-word-wrap ()
" puts the mode into word wrap
inserts returns
changes mode line
sets fill-column to full frame width
modifies save hooks to save without the returns

word-wrap-mode changes certain returns to hard returns when invoked. If they
wind up where you didn't want them, it is probably because there were long
lines in some places but not others. To prevent this from happening, you
must fill ALL of the paragraphs before going into word-wrap-mode, OR remove
the 'soft' style returns from ALL paragraphs. It must be consistent. If
word-wrap-mode has made returns hard where you didn't want them, and you want
them changed to be soft returns, use convert-returns-to-soft over a
region."

(interactive)

(let ((old-point (point))
(temp-buffer-modified-p (buffer-modified-p)))
(turn-on-auto-fill)
(if (not word-wrap-mode)
(progn
(setq word-wrap-mode t)
(setq fill-column (- (frame-width) 1))

;; convert some or all returns to hard
(if (or ww-force-all-returns-hard
(and (long-lines-exist-p)
(not (hard-returns-exist-p))))
;; typical file using word wrap,
;; or a file with some but not all lines wrapped
(convert-buffer-returns-to-hard t) ;; convert all
;; else
(convert-buffer-returns-to-hard nil) ;; convert only paragraph
;; ends
);; end if

(setq use-hard-newlines t)

(fill-region (point-min) (point-max) nil t)

;; already buffer-local whenever set
;; (make-local-hook 'write-contents-hooks)
(add-hook 'write-contents-hooks 'store-then-unfill-buffer)

(make-local-hook 'after-save-hook)
(add-hook 'after-save-hook 'wordwrap-after-save-hook t t)

(set-buffer-modified-p temp-buffer-modified-p)
(goto-char old-point)
);;end progn
);; end if
);; end let
);; end turn-on-word-wrap

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;; removes word wrap from the minor mode
;; removes the returns within paragraphs
;; changes mode line
;; reverts save hooks
;;

(defun turn-off-word-wrap ()
"Turns off word wrap by removing the save hooks that were added for
word wrap. It also reverts the file to its saved state, i.e. without the
returns."
(interactive)
(let ((temp-buffer-modified-p (buffer-modified-p)))
(if word-wrap-mode
(progn
(setq word-wrap-mode nil)
(unfill-buffer)
(remove-hook 'write-contents-hooks 'store-then-unfill-buffer)
(remove-hook 'after-save-hook 'wordwrap-after-save-hook t)
(set-buffer-modified-p temp-buffer-modified-p)
(auto-fill-mode -1) ;; turn off auto-fill
)))
);; end turn-off-word-wrap

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(defun word-wrap-mode ()
"Toggles word-wrap-mode (a minor mode).
Word wrap mode allows the words to wrap on the screen without the returns
that are internal to a paragraph being saved. Does not handle fill-prefixes.
Use word-wrap-mode to exit the minor mode, and return the buffer to
soft-returns not displayed.

word-wrap-mode changes certain returns to hard returns when invoked. If they
wind up where you didn't want them, it is probably because there were long
lines in some places but not others. To prevent this from happening, you
must fill ALL of the paragraphs before going into word-wrap-mode, OR remove
the 'soft' style returns from ALL paragraphs. It must be consistent. If
word-wrap-mode has made returns hard where you didn't want them, and you want
them changed to be soft returns, use M-x convert-returns-to-soft over a
region.

Also see the documentation for ww-force-all-returns-hard."

(interactive)
(if word-wrap-mode
(turn-off-word-wrap)
;;else
(turn-on-word-wrap))
)

(provide 'word-wrap)

;;; word-wrap.el ends here

Kai Grossjohann

unread,
Feb 25, 1998, 3:00:00 AM2/25/98
to

>>>>> On Thu, 26 Feb 1998, Davin Pearson said:

>> > (*) Facility that allows you to set the modeline colours on a
>> > per-buffer basis.
>>
>> You can use existing Emacs facilities to do this. There are hooks which
>> are run when Emacs switches buffers, which you can use to change the
>> colors of the modeline.
>>

Davin> Is there a single hook that I could use to achieve this?

Apropos is your friend. See M-x apropos RET minibuf.*hook RET for a
list of minibuffer related hooks. Surely the ones you're looking for
are among them.

kai
--
A large number of young women don't trust men with beards.
(BFBS Radio)

Davin Pearson

unread,
Feb 26, 1998, 3:00:00 AM2/26/98
to Eli Zaretskii

To: bug-gn...@prep.ai.mit.edu
Subject: recover-session not working
--text follows this line--
In GNU Emacs 19.34 (i386-unknown-msdos) of Sun Nov 3 1996 on pc
configured using `configure -'

Please describe exactly what actions triggered the bug
and the precise symptoms of the bug:

------------

Steps to reproduce the bug...

(1) M-x find-file RET reply RET

(2) Type a few characters

(3) M-x do-auto-save RET

(4) M-x recover-session RET

And the following appears on the screen:

------------

Move to the session you want to recover,
then type C-c C-c to select it.

You can also delete some of these files;
type d on a line to mark that file for deletion.

c:/djgpp:
wildcard _s*
(No match)
total 0

------------

To following is an extract from my home directory:

c:/djgpp:
total 187
-rw-r--r-- 1 davin root 463 Feb 26 02:52 #reply#
drwxr-xr-x 20 davin root 1056 Jan 26 21:31 .
drwxr-xr-x 13 davin root 1024 Jan 26 11:44 ..
-rw-r--r-- 1 davin root 460 Feb 26 02:24 .bash_history
-rw-r--r-- 1 davin root 792 Feb 9 07:00 _bashrc
-rw-r--r-- 1 davin root 21676 Feb 26 01:49 _emacs
-rw-r--r-- 1 davin root 1090 Jan 12 01:28 _inputrc
-rw-r--r-- 1 davin root 36043 Feb 26 02:42 _places.sav
-rw-r--r-- 1 davin root 327 Feb 26 02:52 _saaaaa~

So I don't understand why it says (No match) for _s* ...

-------------


Recent input:
RET M-x d o - a u t o - s a v e RET M-x r e c o v e
r - s e s s i o n RET insert C-g M-x s u b TAB backspace
backspace backspace r e p TAB C-g f1 l l l RET C-end
n M-x r e p o r t - e m a c s - b u g RET r e c o v
e r - s e s s i o n SPC n o t SPC w o r k i n g RE
T

Recent messages:
Undo! [4 times]
Auto-saving...
Auto-saving...done
Beginning of buffer [2 times]
Mark set [2 times]
Wrote c:/djgpp/bug-report
Auto-saving...
Auto-saving...done
Quit [2 times]
Mark set

--
Davin Pearson d.pe...@ext.canterbury.ac.nz

Davin Pearson

unread,
Feb 26, 1998, 3:00:00 AM2/26/98
to Eli Zaretskii

> On Wed, 25 Feb 1998, Davin Pearson wrote:
>
> > (*) Support for different colours on the modeline.
>
> Colors *are* supported on the modeline: you can set fore- and background
> colors for the modeline face.
>
> If you want different parts of the modeline to have different colors,
> then can you explain why this is needed, and how should these colors be
> set by a user? IMHO a feature which is hard to set will not be used
> anyway.

Alright, I can live without that...

> > (*) Facility that allows you to set the modeline colours on a
> > per-buffer basis.
>
> You can use existing Emacs facilities to do this. There are hooks which
> are run when Emacs switches buffers, which you can use to change the
> colors of the modeline.
>

Is there a single hook that I could use to achieve this?

The commands set-face-background, set-face-foreground cause
the display to glitch so I can't use post-command-hook without having
the display glitch after every keypress!!!

The system I have got at the moment is rather cumbersome, because and
I am constantly discovering cases that I have missed whereby the
modeline colour fails to match my intended modeline colour for the
buffer that I am editing. The function my-set-group-name changes
the modeline colour to match the buffer...

(defadvice my-one-window (after stub activate)
(my-set-group-name))

(defadvice my-save-and-kill (after stub activate)
(my-set-group-name))

(defadvice bury-buffer (after stub activate)
(my-set-group-name))

(global-set-key
"\C-b"
(function
(lambda () (interactive)
(unwind-protect
(call-interactively 'electric-buffer-list)
(my-set-group-name)))))

(defadvice switch-to-buffer (after stub activate)
(my-set-group-name))

(defadvice other-window (after stub activate)
(my-set-group-name))

(defadvice my-f1 (after stub activate)
(my-set-group-name))

(defadvice my-meta-f2 (after stub activate)
(my-set-group-name))

(defadvice my-f9 (after stub activate)
(my-set-group-name))

(defadvice my-shift-f9 (after stub activate)
(my-set-group-name))

(defadvice my-meta-f9 (after stub activate)
(my-set-group-name))

(global-set-key
"\C-l"
(function
(lambda () (interactive)
(my-set-group-name)
(call-interactively 'recenter))))

--
Davin Pearson d.pe...@ext.canterbury.ac.nz

Eli Zaretskii

unread,
Feb 26, 1998, 3:00:00 AM2/26/98
to

On Thu, 26 Feb 1998, Davin Pearson wrote:

> Steps to reproduce the bug...
>
> (1) M-x find-file RET reply RET
>
> (2) Type a few characters
>
> (3) M-x do-auto-save RET
>
> (4) M-x recover-session RET

I followed these steps and didn't see the problem. I use a later
version of Emacs (which was compiled on Dec 14th, 1997), but I didn't
find any changes in Emacs' ChangeLog's which were introduced since
your versionand which could affect `recover-session'

Did you invoke Emacs with -q option? If not, please try that. It
might be that some of your customizations create the problem.

If that doesn't help, please download the latest version from the
DJGPP archives on SimTel.NET and see if the problem goes away.

Kai Grossjohann

unread,
Feb 27, 1998, 3:00:00 AM2/27/98
to

>>>>> On Sat, 28 Feb 1998, Davin Pearson said:

Davin> Regarding fontifying the MINIBUFFER, I tried Eli's suggestion of the
Davin> following, and it didn't work:

Davin> (defun my-minibuffer-prefs ()
Davin> (setq font-lock-mode nil)
Davin> (font-lock-add-keywords
Davin> '(
Davin> ("\\<game.cc\\>" 1 font-lock-reference-face)
Davin> ))
Davin> )
Davin> (add-hook 'minibuffer-setup-hook 'my-minibuffer-prefs)
Davin> (add-hook 'minibuffer-setup-hook 'turn-on-font-lock)

Hm. I think the 1 means to fontify the stuff that was between the
first pair of parentheses in the regexp. But there's no parentheses
in the regexp at all. Try the following regexp:
"\\(\\<game.cc\\>\\)". Does this work?

kai
--
GU1LDO R00LEZ!

Davin Pearson

unread,
Feb 28, 1998, 3:00:00 AM2/28/98
to

> >> > (*) Facility that allows you to set the modeline colours on a
> >> > per-buffer basis.
> >>
> >> You can use existing Emacs facilities to do this. There are hooks which
> >> are run when Emacs switches buffers, which you can use to change the
> >> colors of the modeline.
> >>
>
> Davin> Is there a single hook that I could use to achieve this?
>
> Apropos is your friend. See M-x apropos RET minibuf.*hook RET for a
> list of minibuffer related hooks. Surely the ones you're looking for
> are among them.
>

Note: minibuffer != modeline.

I always confuse these myself too, but in fairness to you I was
discussing both concepts in the same message.

Regarding fontifying the MODELINE, M-x apropos RET mode.*line.*hook
RET returns nothing.

Regarding fontifying the MINIBUFFER, I tried Eli's suggestion of the

following, and it didn't work:

(defun my-minibuffer-prefs ()
(setq font-lock-mode nil)
(font-lock-add-keywords
'(
("\\<game.cc\\>" 1 font-lock-reference-face)
))
)
(add-hook 'minibuffer-setup-hook 'my-minibuffer-prefs)
(add-hook 'minibuffer-setup-hook 'turn-on-font-lock)

I also tried printing fontified text straight to the modeline using
the commands: message and read-from-minibuffer. Unfortunately these
commands do not seem to accept fontified text as arguments, which in
my opinion is something that could be improved upon.

One success I did have is that the list of strings given to
read-from-minibuffer as a "history list" can have its members
fontified (using eg: put-text-property) and the result is displayed
correctly.

--
Davin Pearson d.pe...@ext.canterbury.ac.nz

Davin Pearson

unread,
Mar 1, 1998, 3:00:00 AM3/1/98
to

Nope it didn't work either.

Methinks that this is a bug in Emacs. However, it would be more
convenient to be able to give fontified text to functions message,
read-from-minibuffer than to try and achieve the same result under
font-lock anway.

Either way, it seems like an oversight.

--
Davin Pearson d.pe...@ext.canterbury.ac.nz

Dave Love

unread,
Mar 2, 1998, 3:00:00 AM3/2/98
to

>>>>> "Davin" == Davin Pearson <d.pe...@ext.canterbury.ac.nz> writes:

Davin> Regarding fontifying the MINIBUFFER, I tried Eli's suggestion of the
Davin> following, and it didn't work:

[...]

Did Eli really suggest that? For font-lock you set
`font-lock-defaults' buffer-locally. See the font-lock doc.

Davin Pearson

unread,
Mar 6, 1998, 3:00:00 AM3/6/98
to

This probably


> Davin> Regarding fontifying the MINIBUFFER, I tried Eli's suggestion of the
> Davin> following, and it didn't work:
> [...]
>
> Did Eli really suggest that? For font-lock you set
> `font-lock-defaults' buffer-locally. See the font-lock doc.
>

As far as I can tell, the code that I posted, ie. the code that
appears below *should* work, since I have successfully used a similar
pattern to get different fontifications in C mode, C++ mode,
emacs-lisp mode etc.

Function font-lock-add-keywords is the function for setting a
buffer-local
binding to the variable font-lock-keywords. Based on my learning of
Emacs Lisp, I would assume that this works because
"font-lock-keywords" has somehow already been defined as a variable
that is "buffer-local" in nature.

(defun my-minibuffer-prefs ()
(setq font-lock-mode nil)
(font-lock-add-keywords
'(

("\\(\\<game.cc\\>\\)" 0 font-lock-reference-face)

))
)
(add-hook 'minibuffer-setup-hook 'my-minibuffer-prefs)
(add-hook 'minibuffer-setup-hook 'turn-on-font-lock)

--
Davin Pearson d.pe...@ext.canterbury.ac.nz

Dave Love

unread,
Mar 8, 1998, 3:00:00 AM3/8/98
to

>>>>> "Davin" == Davin Pearson <d.pe...@ext.canterbury.ac.nz> writes:

Davin> Function font-lock-add-keywords is the function for setting a
Davin> buffer-local binding to the variable font-lock-keywords.

Read its documentation and/or the Emacs manual. See the font-lock.el
commentary too.

Reply all
Reply to author
Forward
0 new messages