* Color-theme problems in Emacs 22+ (Ubuntu, Windows)
@ 2007-01-21 6:49 Richard Stallman
2007-01-22 18:06 ` Chong Yidong
0 siblings, 1 reply; 8+ messages in thread
From: Richard Stallman @ 2007-01-21 6:49 UTC (permalink / raw)
I followed up, and he said that this fails the same way with the
latest CVS sources. Would someone please DTRT and ack?
Date: Fri, 12 Jan 2007 10:18:41 +0100
Message-ID: <87vejciowe.fsf@mundaneum.mygooglest.com>
User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: quoted-printable
X-Virus-Scanned: by amavisd-new-20030616-p10 (Debian) at missioncriticalit.com
X-Mailman-Approved-At: Fri, 12 Jan 2007 14:29:25 -0500
Cc: emacs-snapshot@packages.debian.org
Subject: Color-theme problems in Emacs 22+ (Ubuntu, Windows)
X-BeenThere: emacs-pretest-bug@gnu.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "Bug reports for CVS Emacs." <emacs-pretest-bug.gnu.org>
List-Unsubscribe: <http://lists.gnu.org/mailman/listinfo/emacs-pretest-bug>,
<mailto:emacs-pretest-bug-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/pipermail/emacs-pretest-bug>
List-Post: <mailto:emacs-pretest-bug@gnu.org>
List-Help: <mailto:emacs-pretest-bug-request@gnu.org?subject=help>
List-Subscribe: <http://lists.gnu.org/mailman/listinfo/emacs-pretest-bug>,
<mailto:emacs-pretest-bug-request@gnu.org?subject=subscribe>
Sender: emacs-pretest-bug-bounces+rms=gnu.org@gnu.org
Errors-To: emacs-pretest-bug-bounces+rms=gnu.org@gnu.org
X-Spam-Checker-Version: SpamAssassin 3.0.4 (2005-06-05) on monty-python
X-Spam-Level:
X-Spam-Status: No, score=0.1 required=5.0 tests=FORGED_RCVD_HELO
autolearn=failed version=3.0.4
Please describe exactly what actions triggered the bug
and the precise symptoms of the bug:
Hello,
I just installed Ubuntu Edgy 6.10, and still experiences
problems with `color-theme' (versions 6.5.4, 6.5.5 and
6.6.0) under Emacs Snapshot (GTK).
I see some of my colors sometimes (for example, when editing
my .emacs file), but it's never ever applied to my Group
buffer. In other words, I cannot tell anymore which groups
contain or not unread mails (as I expect them to become bold
if they contain unread material).
See an example of Ubuntu 6.10 + Emacs 22.0.50.1 +
color-theme 6.6.0 on http://www.mygooglest.com/sva/Screenshot.png.
Please note I have the same symptoms with the latest
versions of Emacs binaries for Windows (starting from Emacs
22).
As far as I can tell, everything works fine under Emacs 21,
both under Ubuntu and Windows. But it does not with the most
recent versions of Emacs (snapshots 22+).
Please note as well (you can see it on the example) that
`list-colors-display' only returns black on white
characters. Nothing's colored anymore in that results
buffer...
Additional information: my personal color theme (see end of
this mail).
Many thanks to all for the precious support you can bring!
If emacs crashed, and you have the emacs process in the gdb debugger,
please include the output from the following gdb commands:
`bt full' and `xbacktrace'.
If you would like to further debug the crash, please read the file
/usr/share/emacs/22.0.50/etc/DEBUG for instructions.
In GNU Emacs 22.0.50.1 (i486-pc-linux-gnu, GTK+ Version 2.10.3)
of 2006-09-19 on rothera, modified by Debian
(Debian emacs-snapshot package, version 1:20060915-1)
X server distributor `The X.Org Foundation', version 11.0.70101000
configured using `configure '--build' 'i486-linux-gnu' '--host' 'i486-linu=
x-gnu' '--prefix=3D/usr' '--sharedstatedir=3D/var/lib' '--libexecdir=3D/usr=
/lib' '--localstatedir=3D/var' '--infodir=3D/usr/share/info' '--mandir=3D/u=
sr/share/man' '--with-pop=3Dyes' '--enable-locallisppath=3D/etc/emacs-snaps=
hot:/etc/emacs:/usr/local/share/emacs/22.0.50/site-lisp:/usr/local/share/em=
acs/site-lisp:/usr/share/emacs/22.0.50/site-lisp:/usr/share/emacs/site-lisp=
:/usr/share/emacs/22.0.50/leim' '--with-x=3Dyes' '--with-x-toolkit=3Dgtk' '=
build_alias=3Di486-linux-gnu' 'host_alias=3Di486-linux-gnu' 'CFLAGS=3D-DDEB=
IAN -DSITELOAD_PURESIZE_EXTRA=3D5000 -g -O2''
Important settings:
value of $LC_ALL: nil
value of $LC_COLLATE: nil
value of $LC_CTYPE: nil
value of $LC_MESSAGES: nil
value of $LC_MONETARY: nil
value of $LC_NUMERIC: nil
value of $LC_TIME: nil
value of $LANG: en_US.UTF-8
locale-coding-system: utf-8
default-enable-multibyte-characters: t
Major mode: Group
Minor modes in effect:
gnus-topic-mode: t
gnus-undo-mode: t
show-paren-mode: t
strokes-mode: t
recentf-mode: t
auto-image-file-mode: t
shell-dirtrack-mode: t
display-time-mode: t
icomplete-mode: t
tooltip-mode: t
tool-bar-mode: t
mouse-wheel-mode: t
menu-bar-mode: t
file-name-shadow-mode: t
global-font-lock-mode: t
font-lock-mode: t
blink-cursor-mode: t
unify-8859-on-decoding-mode: t
unify-8859-on-encoding-mode: t
utf-translate-cjk-mode: t
auto-compression-mode: t
temp-buffer-resize-mode: t
column-number-mode: t
line-number-mode: t
transient-mark-mode: t
Recent input:
<up> <return> <up> <return> <f5> <down> <down> <down>=20
<down> <down> <down> <down> <down> <down> <down> <down>=20
<down> <down> <down> <down> <down> <down> <down> <down>=20
<down> <down> <down> <down> <down> <down> <down> <down>=20
<down> <down> <down> <down> <down> <down> <down> <down>=20
<down> <down> <down> <down> <f12> y e s <return> <f12>=20
M-x <up> <return> <up> <return> <down> <down> <down>=20
<down> <f5> <down> <down> <down> <down> <down> <down>=20
<down> <down> <down> <down> <down> <down> <down> <down>=20
<down> <down> <down> <down> <down> <down> <down> <down>=20
<down> <down> <down> <down> <down> <down> <down> <down>=20
<down> <f12> y e s <return> q M-x <up> <return>
Recent messages:
Starting new Ispell process...
Checking for library `filladapt'... Found
Ispell process killed
(Next Ispell command will use default dictionary)
Starting new Ispell process...
Ispell process killed
(Next local Ispell command will use francais dictionary)
Using the <SebastienVaubanID> Identity
(Next local Ispell command will use francais dictionary)
Starting new Ispell process...
--
;;; color-theme-sva.el --- my color theme
(require 'color-theme)
(defun color-theme-sva ()
"Initialize faces according to my preferences."
(interactive)
(color-theme-install
'(color-theme-sva
((background-color . "white")
(background-mode . light)
(border-color . "black")
(cursor-color . "rgb:15/FF/00")
(foreground-color . "black")
(mouse-color . "black"))
(default ((t (nil))))
(bold ((t (:bold t :weight bold))))
(bold-italic ((t (:italic t :bold t :slant italic :weight bold))))
(italic ((t (:italic t :slant italic))))
(underline ((t (:underline t))))
(highlight ((t (:foreground "white" :background "rgb:31/6A/C5")))) ;;=
darkolivegreen
;; bbdb
(bbdb-company ((t (:foreground "steel blue" :italic t))))
(bbdb-field-name ((t (:foreground "steel blue" :bold t))))
(bbdb-field-value ((t (:foreground "steel blue"))))
(bbdb-name ((t (:foreground "rgb:FF/66/33" :underline t))))
(calendar-today-face ((t (:bold t :weight bold :background "yellow"))))
(comint-highlight-input ((t (:bold t :weight bold))))
(comint-highlight-prompt ((t (:foreground "blue"))))
;; custom
(custom-saved-face ((t (:underline t))))
(custom-state-face ((t (:foreground "dark green"))))
(custom-button-pressed-face ((t (:background "lightgrey"
:foreground "black"
:box (:line-width 2
:style pressed-button)))))
(custom-modified-face ((t (:background "blue" :foreground "white"))))
(custom-invalid-face ((t (:background "red" :foreground "yellow"))))
(custom-set-face ((t (:background "white" :foreground "blue"))))
(custom-changed-face ((t (:background "blue" :foreground "white"))))
(custom-rogue-face ((t (:background "black" :foreground "pink"))))
(custom-face-tag-face ((t (:underline t))))
(custom-variable-button-face ((t (:bold t :underline t :weight bold))))
;; cvs
(cvs-filename-face ((t (:foreground "blue4"))))
(cvs-handled-face ((t (:foreground "pink"))))
(cvs-header-face ((t (:foreground "blue4" :bold t))))
(cvs-marked-face ((t (:foreground "green3" :bold t))))
(cvs-msg-face ((t (:italic t :foreground "gray55"))))
(cvs-need-action-face ((t (:foreground "orange"))))
(cvs-unknown-face ((t (:foreground "red"))))
;; subversion
(svn-status-marked-face ((t (:foreground "green3" :bold t))))
(svn-status-marked-popup-face ((t (:foreground "green3" :bold t))))
(svn-status-update-available-face ((t (:foreground "orange"))))
(svn-status-directory-face ((t (:foreground "blue" :bold t))))
(svn-status-filename-face ((t (:foreground "magenta3"))))
(svn-status-symlink-face ((t (:foreground "cyan"))))
(svn-status-locked-face ((t (:foreground "red" :bold t))))
(svn-status-switched-face ((t (:italic t :foreground "gray55"))))
;; diary
(diary-face ((t (:foreground "red"))))
;; dircolors
(dircolors-face-asm ((t (:foreground "blue3"))))
(dircolors-face-backup ((t (:foreground "blue3"))))
(dircolors-face-compress ((t (:foreground "red"))))
(dircolors-face-dir ((t (:foreground "blue" :bold t))))
(dircolors-face-doc ((t (:foreground "gold"))))
(dircolors-face-dos ((t (:foreground "green3"))))
(dircolors-face-emacs ((t (:foreground "turquoise3"))))
(dircolors-face-html ((t (:foreground "gold"))))
(dircolors-face-img ((t (:foreground "magenta3"))))
(dircolors-face-lang ((t (:foreground "turquoise3"))))
(dircolors-face-lang-interface ((t (:foreground "turquoise3"))))
(dircolors-face-make ((t (:foreground "green3"))))
(dircolors-face-objet ((t (:foreground "blue3"))))
(dircolors-face-package ((t (:foreground "red"))))
(dircolors-face-paddb ((t (:foreground "blue3"))))
(dircolors-face-ps ((t (:foreground "gold"))))
(dircolors-face-sound ((t (:foreground "magenta3"))))
(dircolors-face-tar ((t (:foreground "red"))))
(dircolors-face-yacc ((t (:foreground "turquoise3"))))
;; dired
(dired-face-boring ((t (:foreground "Gray65"))))
(dired-face-directory ((t (:bold t))))
(dired-face-executable ((t (:foreground "SeaGreen"))))
(dired-face-flagged ((t (:background "LightSlateGray"))))
(dired-face-header ((t (:background "grey75" :foreground "black"))))
(dired-face-marked ((t (:background "PaleVioletRed"))))
(dired-face-permissions ((t (:background "grey75" :foreground "black")=
)))
(dired-face-setuid ((t (:foreground "Red"))))
(dired-face-socket ((t (:foreground "magenta"))))
(dired-face-symlink ((t (:foreground "cyan"))))
;; dired+
(diredp-date-time ((t (:foreground "rgb:33/64/4E"))))
(diredp-dir-heading ((t (:background "yellow" :foreground "blue"
:bold t :weight bold))))
(diredp-dir-priv ((t (:background "yellow" :foreground "blue"
:bold t :weight bold))))
(diredp-file-name ((t (:foreground "black"))))
(diredp-file-suffix ((t (:foreground "rgb:7B/46/8E"))))
(diredp-flag-mark-line ((t (:foreground "red" :bold t :weight bold))))
;; emacs wiki
(emacs-wiki-bad-link-face ((t (:foreground "red" :weight bold))))
(emacs-wiki-header-1 ((t (:bold t :weight bold :height 1.4))))
(emacs-wiki-header-2 ((t (:bold t :weight bold :height 1.3))))
(emacs-wiki-header-3 ((t (:height 1.2))))
(emacs-wiki-header-4 ((t (:height 1.1))))
(emacs-wiki-header-5 ((t (:height 1.0))))
(emacs-wiki-header-6 ((t (:height 0.9))))
(emacs-wiki-link-face ((t (:foreground "blue" :underline t))))
;; flypell
(flyspell-duplicate-face ((t (:foreground "Gold3" :underline t
:weight bold :bold t))))
(flyspell-incorrect-face ((t (:foreground "red" :underline t
:bold t))))
;; LaTeX
(font-latex-math-face ((t (:foreground "black"))))
(font-latex-sedate-face ((t (:foreground "gray45"))))
;;
(font-lock-comment-face ((t (:foreground "red"))))
(font-lock-constant-face ((t (:foreground "dark cyan"))))
(font-lock-function-name-face ((t (:foreground "blue"))))
(font-lock-keyword-face ((t (:foreground "purple1"))))
(font-lock-reference-face ((t (:foreground "dark cyan"))))
(font-lock-string-face ((t (:foreground "green4"))))
(font-lock-type-face ((t (:foreground "forest green"))))
(font-lock-variable-name-face ((t (:foreground "magenta"))))
(font-lock-warning-face ((t (:bold t :foreground "red"))))
(gnus-splash-face ((t (:foreground "blue"))))
;; Gnus group buffer
(gnus-group-mail-1-empty-face ((t (:foreground "rgb:50/50/B0"))))
(gnus-group-mail-1-face ((t (:foreground "rgb:50/50/B0" :bold t))))
(gnus-group-mail-2-empty-face ((t (:foreground "rgb:66/00/66"))))
(gnus-group-mail-2-face ((t (:foreground "rgb:66/00/66" :bold t))))
(gnus-group-mail-3-empty-face ((t (:foreground "rgb:00/77/77"))))
(gnus-group-mail-3-face ((t (:foreground "rgb:00/77/77" :bold t))))
(gnus-group-news-1-empty-face ((t (:foreground "rgb:50/50/B0"))))
(gnus-group-news-1-face ((t (:foreground "rgb:50/50/B0" :bold t))))
(gnus-group-news-2-empty-face ((t (:foreground "rgb:66/00/66"))))
(gnus-group-news-2-face ((t (:foreground "rgb:66/00/66" :bold t))))
(gnus-group-news-3-empty-face ((t (:foreground "rgb:00/77/77"))))
(gnus-group-news-3-face ((t (:foreground "rgb:00/77/77" :bold t))))
(gnus-group-news-4-empty-face ((t (:foreground "rgb:99/00/00"))))
(gnus-group-news-4-face ((t (:foreground "rgb:99/00/00" :bold t))))
(gnus-group-news-5-empty-face ((t (:foreground "rgb:00/00/99"))))
(gnus-group-news-5-face ((t (:foreground "rgb:00/00/99" :bold t))))
(gnus-group-news-6-empty-face ((t (:foreground "rgb:BB/66/00"))))
(gnus-group-news-6-face ((t (:foreground "rgb:BB/66/00" :bold t))))
;; Gnus summary buffer
(gnus-summary-selected-face ((t (:foreground "rgb:FF/66/33" :bold t))))
(gnus-summary-high-unread-face ((t (:foreground "blue" :bold t))))
(gnus-summary-high-read-face ((t (:foreground "rgb:80/00/80" :bold t))=
))
(gnus-summary-high-ticked-face ((t (:foreground "hot pink" :bold t))))
(gnus-summary-high-ancient-face ((t (:foreground "rgb:77/77/99" :bold =
t))))
(gnus-summary-normal-unread-face ((t (:foreground "blue"))))
(gnus-summary-normal-read-face ((t (:foreground "rgb:80/00/80"))))
(gnus-summary-normal-ticked-face ((t (:foreground "hot pink"))))
(gnus-summary-normal-ancient-face ((t (:foreground "rgb:77/77/99"))))
(gnus-summary-low-unread-face ((t (:low t :foreground "blue" :italic t=
))))
(gnus-summary-low-read-face ((t (:low t :foreground "rgb:80/00/80"
:italic t))))
(gnus-summary-low-ticked-face ((t (:low t :foreground "hot pink"
:italic t))))
(gnus-summary-low-ancient-face ((t (:low t :foreground "rgb:77/77/99"
:italic t))))
(gnus-summary-cancelled-face ((t (:italic t :foreground "gray55"
:strike-through t))))
;; Gnus article buffer
(gnus-header-name-face ((t (:foreground "rgb:33/99/CC" :bold t
:family "Arial"))))
(gnus-header-from-face ((t (:foreground "blue" :family "Arial"))))
(gnus-header-subject-face ((t (:foreground "rgb:FF/66/33" :bold t))))
(gnus-header-newsgroups-face ((t (:foreground "rgb:33/99/CC"
:family "Arial"))))
(gnus-header-content-face ((t (:foreground "rgb:33/99/CC"
:family "Arial"))))
(gnus-cite-attribution-face ((t (:foreground "rgb:50/50/B0"))))
(gnus-cite-face-1 ((t (:foreground "rgb:50/50/B0"))))
(gnus-cite-face-2 ((t (:foreground "rgb:66/00/66"))))
(gnus-cite-face-3 ((t (:foreground "rgb:00/77/77"))))
(gnus-cite-face-4 ((t (:foreground "rgb:99/00/00"))))
(gnus-cite-face-5 ((t (:foreground "rgb:00/00/99"))))
(gnus-cite-face-6 ((t (:foreground "rgb:BB/66/00"))))
(gnus-cite-face-7 ((t (:foreground "rgb:50/50/B0"))))
(gnus-cite-face-8 ((t (:foreground "rgb:66/00/66"))))
(gnus-cite-face-9 ((t (:foreground "rgb:00/77/77"))))
(gnus-cite-face-10 ((t (:foreground "rgb:99/00/00"))))
(gnus-signature-face ((t (:foreground "rgb:7F/7F/7F"))))
(gnus-emphasis-bold ((t (:bold t))))
(widget-button-face ((t (:bold t :weight bold))))
(widget-button-pressed-face ((t (:foreground "red"))))
(widget-documentation-face ((t (:foreground "dark green"))))
(widget-field-face ((t (:background "gray85"))))
(widget-inactive-face ((t (:foreground "dim gray"))))
(widget-single-line-field-face ((t (:background "gray85"))))
;; (widget-mouse-face . highlight)
;; when replying
(message-header-name-face ((t (:foreground "rgb:33/99/CC" :bold t
:family "Arial"))))
(message-header-to-face ((t (:foreground "blue" :family "Arial"))))
(message-header-cc-face ((t (:foreground "blue" :family "Arial"))))
(message-header-subject-face ((t (:foreground "rgb:FF/66/33" :bold t))=
))
(message-header-newsgroups-face ((t (:foreground "rgb:33/99/CC"
:family "Arial"))))
(message-header-xheader-face ((t (:foreground "red"))))
(message-header-other-face ((t (:foreground "rgb:33/99/CC"
:family "Arial"))))
(message-separator-face ((t (:foreground "red" :bold t :family "Arial"=
))))
(message-cited-text-face ((t (:foreground "rgb:50/50/B0"))))
(message-mml-face ((t (:foreground "ForestGreen"))))
;; Gnus/Message
(gnus-emphasis-highlight-words ((t (:background "black"
:foreground "yellow"))))
(gnus-picon-face ((t (:background "white" :foreground "yellow"))))
(gnus-picon-xbm-face ((t (:background "white" :foreground "yellow"))))
(gnus-x-face ((t (:background "white" :foreground "black"))))
(html-helper-bold-face ((t (:foreground "black" :bold t))))
(html-helper-italic-face ((t (:foreground "black" :slant italic))))
(html-helper-underline-face ((t (:foreground "black" :underline t))))
(html-tag-face ((t (:foreground "blue"))))
(info-header-node ((t (:foreground "magenta" :underline t)))) ;; node =
name
(info-header-xref ((t (:foreground "dodger blue" :underline t))))
;; node n=
ames
(info-menu-5 ((t (:foreground "dark orange" :underline t)))) ;; specia=
l *
(info-menu-header ((t (:foreground "red" :underline t)))) ;; major top=
ics
(info-node ((t (:foreground "blue" :underline t)))) ;; XEmacs manuals
(info-xref ((t (:bold t :foreground "magenta4" :weight bold))))
;; highlighting matches
(match ((t (:background "yellow" :foreground "rgb:EE/66/00" :bold t))))
(isearch ((t (:background "yellow" :foreground "rgb:EE/66/00" :bold t)=
)))
(isearch-lazy-highlight-face ((t (:background "rgb:CC/FF/FF"
:foreground "blue"
:bold t)))) ;; for GNU Emacs
(isearch-secondary ((t (:background "rgb:CC/FF/FF"
:foreground "blue"
:bold t)))) ;; for XEmacs
;; make
(makefile-space-face ((t (:background "hotpink"))))
;; modeline
(modeline-buffer-id ((t (:background "rgb:39/80/F4"
:foreground "white"))))
(modeline-mousable ((t (:background "rgb:39/80/F4"
:foreground "gray85")))) ;; major mode
(modeline-mousable-minor-mode ((t (:background "rgb:39/80/F4"
:foreground "gray75"))))
(modeline ((t (:background "DeepSkyBlue1"
:foreground "black"
:height 1.25
:family "courier"))) t)
(modeline-inactive ((t (:inherit modeline
:background "PaleTurquoise1"
:foreground "grey20"
:box (:line-width -1 :color "grey75")
:weight light
:family "profontwindows"))) t)
;; org
(org-done ((t (:foreground "green3" :bold t :strike-through t))))
(org-level-1 ((t (:foreground "blue" :bold t :height 1.3))))
(org-level-2 ((t (:foreground "red" :bold t :height 1.1))))
(org-level-3 ((t (:foreground "Purple"))))
(org-scheduled-previously ((t (:foreground "blue" :bold t))))
(org-scheduled-today ((t (:foreground "blue"))))
(org-upcoming-deadline ((t (:foreground "DarkOrange" :bold t))))
;; selection
(region ((t (:background "seashell2")))) ;; for GNU Emacs
(zmacs-region ((t (:background "seashell2")))) ;; for XEmacs
(secondary-selection ((t (:background "paleturquoise"))))
;; for cat <<EOF in shell scripts
(sh-heredoc-face ((t (:foreground "gray50"))))
;; parentheses
(paren-face-match ((t (:background "chartreuse" :bold t))))
(paren-face-mismatch ((t (:background "purple" :foreground "white"
:bold t))))
(paren-face-no-match ((t (:background "purple" :foreground "white"
:bold t))))
(show-paren-match-face ((t (:background "chartreuse" :bold t))))
(show-paren-mismatch-face ((t (:background "purple" :foreground "white"
:bold t))))
;; shell
(shell-prompt-face ((t (:bold t :foreground "yellow"))))
(shell-option-face ((t (:foreground "forest green"))))
(shell-output-face ((t (:foreground "black"))))
(shell-output-2-face ((t (:foreground "blue"))))
(shell-output-3-face ((t (:foreground "purple"))))
;; speedbar
(speedbar-button-face ((t (:foreground "green4"))))
(speedbar-directory-face ((t (:foreground "blue4"))))
(speedbar-file-face ((t (:foreground "cyan4"))))
(speedbar-highlight-face ((t (:background "green"))))
(speedbar-selected-face ((t (:underline t :foreground "red"))))
(speedbar-tag-face ((t (:foreground "brown"))))
;; tool-bar
(tool-bar ((t (:background "grey75" :foreground "black" :box
(:line-width 1 :style released-button)))))
;; tooltip
(tooltip ((t (:background "lightyellow" :foreground "black"))))
;; w3m
(w3m-anchor-face ((t (:foreground "blue" :underline t))))
(w3m-arrived-anchor-face ((t (:foreground "purple1" :underline t))))
(w3m-bold-face ((t (:bold t :weight bold))))
(w3m-current-anchor-face ((t (:foreground "blue" :bold t :underline t =
:weight bold))))
(w3m-form-button-face ((t (:background "lightgrey" :foreground "black"=
))))
(w3m-form-button-mouse-face ((t (:background "orange"))))
(w3m-form-button-pressed-face ((t (:background "yellow"))))
(w3m-form-face ((t (:foreground "green4" :underline t))))
(w3m-header-line-location-content-face ((t (:foreground "lightsteelblu=
e"))))
(w3m-header-line-location-title-face ((t (:foreground "gainsboro"))))
(w3m-history-current-url-face ((t (:background "SkyBlue4" :foreground =
"LightSkyBlue"))))
(w3m-image-face ((t (:foreground "PaleGreen"))))
(w3m-strike-through-face ((t (:strike-through t))))
(w3m-tab-background-face ((t (:background "rgb:21/36/4B"))))
(w3m-tab-selected-face ((t (:background "Gray85" :foreground "black" :=
box (:line-width 1 :style nil)))))
(w3m-tab-selected-retrieving-face ((t (:background "Gray85" :foregroun=
d "white" :box (:line-width -1 :style nil)))))
(w3m-tab-unselected-face ((t (:background "Gray70" :foreground "Gray20=
" :box (:line-width 1 :style nil)))))
(w3m-tab-unselected-retrieving-face ((t (:background "Gray50" :foregro=
und "white" :box (:line-width -1 :style nil)))))
(w3m-underline-face ((t (:underline t))))
)))
(provide 'color-theme-sva)
;;; color-theme-sva.el ends here
--=20
S=E9bastien Vauban
_______________________________________________
emacs-pretest-bug mailing list
emacs-pretest-bug@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-pretest-bug
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Color-theme problems in Emacs 22+ (Ubuntu, Windows)
2007-01-21 6:49 Color-theme problems in Emacs 22+ (Ubuntu, Windows) Richard Stallman
@ 2007-01-22 18:06 ` Chong Yidong
2007-01-25 8:49 ` Sébastien Vauban
2007-01-30 12:21 ` Sébastien Vauban
0 siblings, 2 replies; 8+ messages in thread
From: Chong Yidong @ 2007-01-22 18:06 UTC (permalink / raw)
Cc: emacs-devel
> I just installed Ubuntu Edgy 6.10, and still experiences
> problems with `color-theme' (versions 6.5.4, 6.5.5 and
> 6.6.0) under Emacs Snapshot (GTK).
>
> I see some of my colors sometimes (for example, when editing
> my .emacs file), but it's never ever applied to my Group
> buffer. In other words, I cannot tell anymore which groups
> contain or not unread mails (as I expect them to become bold
> if they contain unread material).
I can't reproduce this. I did the following:
- downloaded the latest version of color-theme (color-theme-6.6.0.tar.gz)
- moved all the elisp files in the tarfile into ~/.emacs.d/lisp
(which is in my load-path)
- M-: (setq color-theme-libraries "~/.emacs.d/lisp") RET
- M-x load-file RET ~/color-theme-sva.el RET
(the color-theme file provided in the original bug report)
- M-x gnus RET
The resulting group buffer is displayed in purple and black, with
groups containing unread messages in bold, as expected. This is on
GNU Emacs 22.0.92.36 (i686-pc-linux-gnu, GTK+ Version 2.8.20), on
Ubuntu Dapper.
Please make sure you have color-theme.el installed correctly, and try
to simplify your color-theme file to the smallest possible testcase
that can produce this bug.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Color-theme problems in Emacs 22+ (Ubuntu, Windows)
2007-01-22 18:06 ` Chong Yidong
@ 2007-01-25 8:49 ` Sébastien Vauban
2007-01-30 12:21 ` Sébastien Vauban
1 sibling, 0 replies; 8+ messages in thread
From: Sébastien Vauban @ 2007-01-25 8:49 UTC (permalink / raw)
To: re.2YV9XX9BLMAAX; +Cc: rms, emacs-devel
Hello Chong,
First of all, sorry for my late reply.
>> I just installed Ubuntu Edgy 6.10, and still experiences
>> problems with `color-theme' (versions 6.5.4, 6.5.5 and
>> 6.6.0) under Emacs Snapshot (GTK).
>
> I can't reproduce this. [...]
>
> The resulting group buffer is displayed in purple and black, with
> groups containing unread messages in bold, as expected. This is on
> GNU Emacs 22.0.92.36 (i686-pc-linux-gnu, GTK+ Version 2.8.20), on
> Ubuntu Dapper.
Second, as cvs access is blocked here by the firewall, I've to
make the update from home, to try the same new Emacs version as
the one you used.
I'll try as well to cut different parts of my .emacs and my
.gnus files, to try isolating the problem.
I keep you posted in the next days.
Thank you,
Seb
--
Sébastien Vauban
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Color-theme problems in Emacs 22+ (Ubuntu, Windows)
2007-01-22 18:06 ` Chong Yidong
2007-01-25 8:49 ` Sébastien Vauban
@ 2007-01-30 12:21 ` Sébastien Vauban
2007-01-30 17:21 ` Chong Yidong
1 sibling, 1 reply; 8+ messages in thread
From: Sébastien Vauban @ 2007-01-30 12:21 UTC (permalink / raw)
To: cyd, re.2YV9XX9BLMAAX; +Cc: rms, emacs-devel
[-- Attachment #1: Type: text/plain, Size: 4415 bytes --]
Hello Chong,
>> I just installed Ubuntu Edgy 6.10, and still experiences
>> problems with `color-theme' (versions 6.5.4, 6.5.5 and
>> 6.6.0) under Emacs Snapshot (GTK).
>>
>> I see some of my colors sometimes (for example, when
>> editing my .emacs file), but it's never ever applied to
>> my Group buffer. In other words, I cannot tell anymore
>> which groups contain or not unread mails (as I expect
>> them to become bold if they contain unread material).
>
> I can't reproduce this. I did the following:
>
> - downloaded the latest version of color-theme (color-theme-6.6.0.tar.gz)
> - moved all the elisp files in the tarfile into ~/.emacs.d/lisp
> (which is in my load-path)
> - M-: (setq color-theme-libraries "~/.emacs.d/lisp") RET
> - M-x load-file RET ~/color-theme-sva.el RET
> (the color-theme file provided in the original bug report)
> - M-x gnus RET
>
> The resulting group buffer is displayed in purple and black, with
> groups containing unread messages in bold, as expected.
It's weird you tell me you see it in purple. Following my
color-theme, you should see `gnus-group-mail-3-*-face' in dark
green.
See http://www.mygooglest.com/sva/Emacs21.png.
> This is on GNU Emacs 22.0.92.36 (i686-pc-linux-gnu, GTK+
> Version 2.8.20), on Ubuntu Dapper.
To be sure to be better sync'ed with your configuration, I made
another checkout of Emacs 22 a couple of days ago, and I rebuilt
everything yesterday.
The resulting version string is:
This is GNU Emacs 22.0.93.1 (i686-pc-linux-gnu)
of 2007-01-29 on mundaneum.
> Please make sure you have color-theme.el installed correctly, and try
> to simplify your color-theme file to the smallest possible testcase
> that can produce this bug.
I've done the following:
o ultra-simplified my .emacs file - see attachment;
o ultra-simplified my .gnus file - see attachment;
o triple-checked that I'm loading the last version of
color-theme - see the Messages buffers attached.
What I did:
o launched emacs21 with the simplified config file (this
calls color-theme, and uses my own theme - see
attachment);
o launched gnus (the default one, here 5.9) with the
simplified config file;
o opened an article;
o added a window with `M-x list-colors-display'.
You see the resulting view in the screenshot to be found at:
http://www.mygooglest.com/sva/Emacs21.png
You can see that everything is pretty normal, with `GNU Emacs
21.4.1 (i486-pc-linux-gnu, X toolkit, Xaw3d scroll bars) of
2006-09-15 on rothera, modified by Debian'.
Next steps:
o launched the version of Emacs 22 that I built yesterday
with the *same config file*;
o launched gnus (the default one, here 5.11) with the *same*
*config file*;
o opened an article;
o added a window with `M-x list-colors-display'.
Now, while everything was the same from my point of view (my
Emacs and Gnus config files, my color-theme) - with the
exception of the version of Gnus [but, from older tests, I can
say this is not the problem], you can see that the layout is
very very different, on the following screenshot:
http://www.mygooglest.com/sva/Emacs22.png
You can notice that even the `list-colors-display' buffer is
completely "black on white only" (with the exception of the
tabulations that I always visualize in yellow, as asked in my
.emacs file).
Though, as I already said, I cannot say that nothing is applied
from my color-theme. For example:
o the subject title is well displayed in bold orange, but
that's more or less the only thing...
o the contents of my Emacs file is correctly displayed,
with my favorite colors (but this is not shown here on
the screenshot).
To summarize, why I tend to say that there is a problem inside
Emacs 22+, it's because the only real change is the version of
Emacs. None of my config files are changing between the
different tests. And, to remind you, I also have the exact same
problems under Windows, with versions 22+.
But I guess we tackle here a very complex interaction between
many different components...
Thank you for all the support you already have and will
provide to me!
Seb
--
Sébastien Vauban
[-- Attachment #2: .emacs-sva --]
[-- Type: application/octet-stream, Size: 163685 bytes --]
;;; .emacs --- my Emacs Init File
;; Copyright (C) 1999-2006 Fabrice Niessen
;; Time-stamp: "Tue 2007-01-30 11:09 sva on mundaneum"
;; Author: Fabrice Niessen <fni@missioncriticalit.com>
;; Keywords: emacs, dotfile, config
;; $Revision: 743 $
;; $Date: 2007-01-25 10:17:09 +0100 (Thu, 25 Jan 2007) $
;;
;; ___ _ __ ___ __ _ ___ ___
;; / _ \ '_ ` _ \ / _` |/ __/ __|
;; | __/ | | | | | (_| | (__\__ \
;; (_)___|_| |_| |_|\__,_|\___|___/
;;
;; This file is NOT part of GNU Emacs.
;; This file is free software; you can redistribute it and/or
;; modify it under the terms of the GNU General Public License as
;; published by the Free Software Foundation; either version 2 of
;; the License, or (at your option) any later version.
;; This file 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 along with this file; if not, write to the Free
;; Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
;; MA 02111-1307, USA.
;;; Commentary:
;; Pre-Requisites
;;
;; You should use the `folding.el' package to see this file properly.
;; `folding.el' hides sections by folding them into a single line.
;;
;; Sequence of Files Loaded at GNU Emacs Start Up
;;
;; 1. Library `site-start.el' (site-run-file)
;; `M-: (find-file (locate-library site-run-file)) RET'
;;
;; 2. File `~/.emacs' (user-init-file)
;;
;; 3. Library `default.el' ("default init file" for local site
;; customizations)
;;
;; Help
;;
;; For help on The Emacs Editor, see:
;; (info "(emacs)")
;; Place the cursor right after `)' and press `C-x C-e'
;;
;; TODO
;;
;; o Look at the following packages
;; * which.el
;; * nt-bash.el
;; * cgi.el
;; * httpd.el (run Emacs as a Web server)
;;; Code:
;; Emacs is like a laser guided missile. It only has to be slight
;; mis-configured to ruin your whole day. [Sean McGrath]
;; modify to taste!
(message "{{{ --[ Loading my Emacs init file ]--")
;; Les gros bosseurs préféreront sans doute démarrer Emacs dès le début de
;; la session de travail sous X11, par exemple grâce au `~/.xinitrc' ou bien
;; aux fonctions de mise en place de l'environnement offertes par le
;; gestionnaire de fenêtres.
;;{{{ --[ Environment determination ]---------------------------------------
;; OS type -- are we running Microsoft Windows?
(defvar running-ms-windows (eq system-type 'windows-nt))
;; Emacs type -- are we running XEmacs (or GNU Emacs)?
(defvar running-xemacs (string-match "XEmacs\\|Lucid" emacs-version))
(if running-xemacs
;; don't offer migration of the init file
(setq load-home-init-file t))
;;}}}
;;{{{ --[ Variables ]-------------------------------------------------------
;; limit on number of Lisp variable bindings & unwind-protects
;; (30 times its default value)
(setq max-specpdl-size (* 30 1000))
;; limit serving to catch infinite recursions for you before they
;; cause actual stack overflow in C, which would be fatal for Emacs
(setq max-lisp-eval-depth (* 100 300))
;;}}}
;;{{{ --[ Macros ]----------------------------------------------------------
(defmacro GNUEmacs (&rest body)
"Execute any number of forms if running under GNU Emacs."
(list 'if (not running-xemacs) (cons 'progn body)))
(defmacro XEmacs (&rest body)
"Execute any number of forms if running under XEmacs."
(list 'if running-xemacs (cons 'progn body)))
;;}}}
;;{{{ --[ Loading Libraries of Lisp Code for Emacs ]------------------------
;; make loaded files give a message
(defadvice load (before debug-log activate)
(message "Loading %s..." (locate-library (ad-get-arg 0))))
;; load-path enhancement
(defun my-add-to-load-path (this-directory &optional with-subdirs recursive)
"Add THIS-DIRECTORY at the beginning of the load-path, if it exists.
Add all its subdirectories not starting with a '.' if the
optional argument WITH-SUBDIRS is not nil.
Do it recursively if the third argument is not nil."
(when this-directory
(when (file-directory-p this-directory)
(let* ((this-directory (expand-file-name this-directory))
(files (directory-files this-directory t "^[^\\.]")))
;; completely canonicalize the directory name
(while (not (string= this-directory (expand-file-name this-directory)))
(setq this-directory (expand-file-name this-directory)))
(message "Adding `%s' to load-path..." this-directory)
(add-to-list 'load-path this-directory)
(if with-subdirs
(progn
(while files
(setq dir-or-file (car files))
(when (file-directory-p dir-or-file)
(if recursive
(my-add-to-load-path dir-or-file 'with-subdirs)
(my-add-to-load-path dir-or-file)))
(setq files (cdr files)))))))))
;; `M-x list-load-path-shadows RET'
;;; ----[ Library Search
(defvar my-site-lisp-directory "~/emacs/site-lisp/"
"Name of directory where my personal additional Emacs Lisp files reside.")
(defvar other-local-site-lisp-directory
(concat (or (getenv "LOCAL_SHARE") "/home/sva/media/Downloads") "/emacs/site-lisp/")
"Name of directory where additional Emacs goodies Lisp files (from the
Internet) reside.")
;; local site-lisp is there so that you have an easy way of installing your
;; own (possibly not distro packaged) Emacs add ons which are specific to
;; the version of Emacs your running. This keeps your local add-ons apart
;; from distro supplied ones. If your have a /usr/local partition, it also
;; means you can do a complete re-install of Emacs (or even your Linux
;; distro) without impacting on stuff you have added by hand.
;;
;; If you put stuff you have installed from tar balls etc within the same
;; directory hierarchy as the distro packaged Emacs, you can get problems
;; when upgrading the distro version as many package systems will assume
;; once all the packaged stuff is removed, directories are empty. If they
;; are not, the package management scripts can fail or possibly get into a
;; "confused" state.
(defvar other-site-lisp-directory
(concat (or (getenv "SHARE") "/usr/share") "/emacs/site-lisp/")
"Name of directory where additional Emacs goodies Lisp files (from the
distro optional packages) reside.")
;; ATTENTION!
;; My lisp directories should go before the Emacs installation ones.
;; Example with the outdated org mode file (that's called instead of my
;; version):
;; c:/Program Files/Emacs/emacs/lisp/textmodes/org.elc
;; Lisp libraries (most important directories last)
;; 1.
(my-add-to-load-path other-site-lisp-directory
'with-subdirs)
(GNUEmacs
(my-add-to-load-path
(concat (or (getenv "SHARE") "/usr/share") "/emacs21/site-lisp/")
'with-subdirs))
(XEmacs
(when running-ms-windows
(my-add-to-load-path
(concat (or (getenv "SHARE") "/usr/share") "/emacs/site-lisp/")
'with-subdirs 'recursive)))
;; 2.
(my-add-to-load-path other-local-site-lisp-directory
'with-subdirs 'recursive)
;; 3.
(my-add-to-load-path my-site-lisp-directory
'with-subdirs)
;; Where to find Emacs packages installed by Ubuntu?
;; o /usr/share/emacs/site-lisp/ (source version)
;; o /usr/share/emacs21/site-lisp/ (byte-compiled version for GNU Emacs)
;; o /usr/share/xemacs21/site-lisp/ (byte-compiled version for XEmacs)
(defun my-create-directory-if-needed (dir)
"Make sure the directory DIR exists; otherwise, create it."
(if dir
(if (not (file-directory-p dir))
(if (yes-or-no-p (concat "The directory `" dir
"' does not exist. Create it? "))
(make-directory dir t)
(error
(concat "Cannot continue without directory `" dir "'"))))
(error "my-create-directory-if-needed: Void directory")))
(defun my-file-executable-p (file)
"Make sure the file FILE exists and is executable."
(if file
(unless (file-executable-p file)
(message "Can't find `%s'" file)
;; sleep 3 s so that you can read the warning
(sit-for 3))
(error "my-file-executable-p: Void file")))
;; useful Common Lisp macros (`push', `case', ...)
(require 'cl)
;;; ----[ Bin Search
;; external programs from Emacs
(setenv "PATH" (concat (getenv "PATH")
";"
"D:/users/share/emacs/bin"))
;;; ----[ Features
;; ;; redefine require to leave a trace of packages being loaded
;; (if (not (fboundp 'orig-require))
;; (fset 'orig-require (symbol-function 'require))
;; (message "The code to redefine `require' should not be loaded twice"))
;;
;; (defvar my-require-depth 0)
;;
;; (defun require (feature &optional file)
;; "Leave a trace of packages being loaded."
;; (cond ((member feature features)
;; (message "%sRequiring `%s' (already loaded)"
;; (concat (make-string (* 2 my-require-depth) ?-) "> ")
;; feature)
;; (sit-for 0))
;; (t
;; (message "%sRequiring `%s'"
;; (concat (make-string (* 2 my-require-depth) ?-) "> ")
;; feature)
;; (sit-for 0)
;; (let ((my-require-depth (+ 1 my-require-depth)))
;; (cond (file
;; (orig-require feature file))
;; (t
;; (orig-require feature))))
;; (message "%sRequiring `%s'...done"
;; (concat (make-string (* 2 my-require-depth) ?-) "> ")
;; feature)
;; (sit-for 0))))
(defvar missing-packages-list nil
"List of packages that `try-require' can't find.")
;; attempt to load a feature/library, failing silently
(defun try-require (feature)
"Attempt to load a library or module. Return true if the
library given as argument is successfully loaded. If not, instead
of an error, just add the package to a list of missing packages."
(condition-case err
;; protected form
(progn
(message "Checking for library `%s'..." feature)
(if (stringp feature)
(load-library feature)
(require feature))
(message "Checking for library `%s'... Found" feature))
;; error handler
(file-error ; condition
(progn
(message "Checking for library `%s'... Missing" feature)
(add-to-list 'missing-packages-list feature))
nil)))
;;}}}
;;{{{ --[ Debugging ]-------------------------------------------------------
;; get the resulting backtrace when bugs such as `Wrong type argument' occur
(setq debug-on-error t) ; will be cleared at end of buffer
(XEmacs
(setq stack-trace-on-error t))
;; ;; hit C-g while it's frozen to get an ELisp backtrace
;; (setq debug-on-quit t)
;;}}}
;;{{{ Important General Concepts ###########################################
;;{{{ --[ 1 The Organization of the (info "(emacs)Screen") ]----------------
(message "1 The Organization of the Screen...")
;;; ----[ 1.2 The Echo Area
;; maximum number of lines to keep in the message log buffer
(setq message-log-max (* 30 50))
;; the `*Messages*' buffer is called the ` *Message-Log*' on XEmacs (note
;; the initial space). To display the message log, execute the command
;; `show-message-log'
(message "1 The Organization of the Screen... Done")
;;}}}
;;{{{ --[ 2 Kinds of User Input ]-------------------------------------------
(message "2 Kinds of User Input...")
(message "2 Kinds of User Input... Done")
;;}}}
;;{{{ --[ 3 Keys ]----------------------------------------------------------
(message "3 Keys...")
(message "3 Keys... Done")
;;}}}
;;{{{ --[ 4 Keys and Commands ]---------------------------------------------
(message "4 Keys and Commands...")
(message "4 Keys and Commands... Done")
;;}}}
;;{{{ --[ 5 Character Set for Text ]----------------------------------------
(message "5 Character Set for Text...")
(message "5 Character Set for Text... Done")
;;}}}
;;{{{ --[ 6 Entering and Exiting Emacs ]------------------------------------
(message "6 Entering and Exiting Emacs...")
(message "6 Entering and Exiting Emacs... Done")
;;}}}
;;{{{ --[ 7 Exiting Emacs ]-------------------------------------------------
(message "7 Exiting Emacs...")
(message "7 Exiting Emacs... Done")
;;}}}
;;}}}
;;{{{ Fundamental Editing Commands #########################################
;;{{{ --[ 8 (info "(emacs)Basic") Editing Commands ]------------------------
(message "8 Basic Editing Commands...")
;;; ----[ 8.2 Changing the Location of Point
;; don't add newlines to end of buffer when scrolling
(setq next-line-add-newlines nil)
;; XEmacs default for moving point to a given line number
(GNUEmacs
(global-set-key [(meta g)] 'goto-line))
(global-set-key [(meta G)] 'what-line)
;;{{{ screen-lines
;; point motion by screen lines (as opposed to text lines)
(when (try-require 'screen-lines)
;; following lines commented out for keeping the original `kill-line'
;; in `screen-lines' minor mode
(add-hook 'screen-lines-load-hook
'(lambda ()
(ad-disable-advice 'kill-line 'around 'screen-lines)
(ad-activate 'kill-line)))
;; screen lines mode enabled by default for all buffers
;; HOW ??? (Right now, it's done via `custom.el')
;; nothing should appear in the mode line, when the `screen-lines' mode
;; is enabled in a buffer
(setq screen-lines-minor-mode-string ""))
;;}}}
;;; ----[ 8.4 Undoing Changes
;; undo some previous changes
(global-set-key [(f11)] 'undo)
;;{{{ redo
;; redo the most recent undo
(when (try-require 'redo)
(global-set-key [(shift f11)] 'redo))
;;}}}
;;; ----[ 8.8 Continuation Lines
;; (setq default-truncate-lines nil)
;; (setq truncate-partial-width-windows nil)
(defun my-wrap-mode-on ()
"Minor mode for making buffer not wrap long lines to next line."
(interactive)
(setq truncate-lines nil))
(defun my-wrap-mode-off ()
"Minor mode for making buffer wrap long lines to next line."
(interactive)
(setq truncate-lines t))
(defun my-toggle-wrap-mode ()
"Switch wrap mode from wrap to non-wrap, or vice-versa."
(interactive)
(if (eq truncate-lines nil)
(wrap-mode-off)
(wrap-mode-on)))
(message "8 Basic Editing Commands... Done")
;;}}}
;;{{{ --[ 9 The (info "(emacs)Minibuffer") ]--------------------------------
(message "9 The Minibuffer...")
;;; ----[ 9.1 (info "(emacs)Minibuffer File") Names
;; ignore case when reading a file name completion
(setq read-file-name-completion-ignore-case t)
;; ;; dim the ignored part of the file name
;; (file-name-shadow-mode)
;;; ----[ 9.2 (info "(emacs)Minibuffer Edit")ing
;; minibuffer window expands vertically as necessary to hold the text that
;; you put in the minibuffer
(setq resize-mini-windows t)
;; resize-minibuffer-mode makes the minibuffer automatically resize as
;; necessary when it's too big to hold its contents
(XEmacs
(autoload 'resize-minibuffer-mode "rsz-minibuf" nil t)
(resize-minibuffer-mode)
(setq resize-minibuffer-window-exactly nil))
;;; ----[ 9.3 (info "(emacs)Completion")
;; minibuffer completion incremental feedback
(icomplete-mode)
;; do not consider case significant in completion (GNU Emacs default)
(setq completion-ignore-case t)
;; To execute in Emacs 22+
;; ;; restore old behavior of SPC in minibuffer to complete file names
;; (define-key minibuffer-local-filename-completion-map " "
;; 'minibuffer-complete-word)
;; (define-key minibuffer-local-must-match-filename-map " "
;; 'minibuffer-complete-word)
(message "9 The Minibuffer... Done")
;;}}}
;;{{{ --[ 10 Running Commands by Name ]-------------------------------------
(message "10 Running Commands by Name...")
(message "10 Running Commands by Name... Done")
;;}}}
;;{{{ --[ 11 (info "(emacs)Help") ]-----------------------------------------
(message "11 Help...")
;; > I'm trying to teach myself Emacs Lisp, but can't figure out how to
;; > prompt for a string. I found the "read-key-sequence-vector" function,
;; > but that only takes in one character. Does anyone know how to prompt
;; > for a string? Thanks.
;; I don't know. Or do you think I'm a super genius?
;; Let's see:
;; M-x apropos RET read RET
;; C-v
;; C-s read-string RET C-s C-s C-s
;; Yep, seems like this could be useful:
;; read-string
;; Function: Read a string from the minibuffer, prompting with string PROMPT.
;; C-h f read-string RET
;; Yep, sounds promising.
;; term
;; (eval-after-load "term"
;; '(defadvice term-char-mode (after swap-del-and-backspace activate)
;; (define-key term-raw-map [delete] 'term-send-backspace)
;; (define-key term-raw-map [backspace] 'term-send-del)))
;;
;; (define-key function-key-map "\e[7~" [home])
;; (define-key function-key-map "\e[8~" [end])
;; (defun bug-evil-term-process-coding-system ()
;; "Fix a term bug; the `process-coding-system' should always be `binary'."
;; (set-buffer-process-coding-system 'binary 'binary))
;;
;; (add-hook 'term-exec-hook 'bug-evil-term-process-coding-system)
;;; ----[ 11.4 Apropos
;; check all variables and non-interactive functions as well
(setq apropos-do-all t)
;; add apropos help about variables (bind `C-h A' to `apropos-variable')
(GNUEmacs
(define-key help-map [(shift a)] 'apropos-variable))
;;; ----[ 11.8 Other Help Commands
;; Info documentation browse
(when (try-require 'info)
;; enter Info
(global-set-key [(f1)] 'info)
;; list of directories to search for Info documentation files
;; (in the order they are listed)
(if running-ms-windows
(setq Info-directory-list
(append Info-default-directory-list
`(,(concat (getenv "SHARE") "/info/")
"C:/cygwin/usr/info/"))))
;; display symbol definitions, as found in the relevant manual
;; (for C, Lisp, and other languages that have documentation in Info)
(global-set-key [(control f1)] 'info-lookup-symbol))
(try-require 'info+)
;; get a Unix manual page and put it in a buffer
(global-set-key [(shift f1)] 'man-follow)
;; (defun jump-man-page ()
;; (interactive)
;; (manual-entry (current-word)))
;; same behavior as woman when manpage is ready
(setq Man-notify-method 'newframe)
;;{{{ WoMan
;; browse Unix manual pages "W.o. (without) Man"
(autoload 'woman "woman"
"Decode and browse a UN*X man page." t)
(autoload 'woman-find-file "woman"
"Find, decode and browse a specific UN*X man-page file." t)
;; list of directory trees to search for Unix manual files
(setq woman-manpath
(if running-ms-windows
`(,(concat (getenv "SHARE") "/man/")
"C:/cygwin/usr/man/"
"C:/cygwin/usr/share/man"
"C:/cygwin/usr/local/man")
'("/usr/share/man/"
"/usr/local/man/")))
;;}}}
;;; ----[ Documentation Basics
;; jump to section in XEmacs Lisp Reference manual
(autoload 'lispref-search "lispref")
(define-key help-map [(L)] 'lispref-search)
(message "11 Help... Done")
;;}}}
;;}}}
;;{{{ Important Text-Changing Commands #####################################
;;{{{ --[ 12 The (info "(emacs)Mark") and the Region ]----------------------
(message "12 The Mark and the Region...")
;;; ----[ 12.2 Transient Mark Mode
;; when the mark is active, the region is highlighted
(GNUEmacs
(when window-system
(transient-mark-mode 1)))
(message "12 The Mark and the Region... Done")
;;}}}
;;{{{ --[ 13 Deletion and (info "(emacs)Killing") ]-------------------------
(message "13 Killing and Moving Text...")
(message "13 Killing and Moving Text... Done")
;;}}}
;;{{{ --[ 14 (info "(emacs)Yanking") ]--------------------------------------
(message "14 Yanking...")
(message "14 Yanking... Done")
;;}}}
;;{{{ --[ 15 (info "(emacs)Accumulating Text") ]----------------------------
(message "15 Accumulating Text...")
(message "15 Accumulating Text... Done")
;;}}}
;;{{{ --[ 16 (info "(emacs)Rectangles") ]-----------------------------------
(message "16 Rectangles...")
(message "16 Rectangles... Done")
;;}}}
;;{{{ --[ 17 (info "(emacs)Registers") ]------------------------------------
(message "17 Registers...")
;;; ----[ 17.1 Saving Positions in Registers
(when (try-require 'saveplace)
;; automatically save place in each file
(setq save-place t)
;; name of the file that records `save-place-alist' value
(setq save-place-file (convert-standard-filename "~/.emacs.d/places.txt"))
;; do not make backups of master save-place file
(setq save-place-version-control "never"))
;;; ----[ 17.7 Bookmarks
;; where to save the bookmarks
(setq bookmark-default-file "~/.emacs.d/bookmarks.txt")
;; each command that sets a bookmark will also save your bookmarks
(setq bookmark-save-flag 1)
(message "17 Registers... Done")
;;}}}
;;{{{ --[ 18 Controlling the (info "(emacs)Display") ]----------------------
(message "18 Controlling the Display...")
;;; ----[ 18.2 Font Lock
;; make buffer size irrelevant for fontification
(setq font-lock-maximum-size nil)
;; use the maximum decoration
(setq font-lock-maximum-decoration t)
;; turn Font Lock mode on in many modes
(GNUEmacs
(global-font-lock-mode t))
;; stop showing that annoying progress bar (in separate widget) when fontifying
(XEmacs
(setq progress-feedback-use-echo-area t))
;; color syntax highlighting definitions
;; TODO Make it work with XEmacs
;;! TODO Enable it only in some buffers (not in dired, not in cvs annotate)
(defface my-font-lock-tab-face
'((t (:background "Gold")))
"Face for highlighting tab characters.")
(defface my-font-lock-trailing-space-face
'((t (:background "LemonChiffon")))
"Face for highlighting trailing spaces.")
(defface my-font-lock-long-line-face
'((t (:background "lavender")))
"Face for highlighting long lines.")
;; warning font lock (80 columns, tabs, trailing spaces)
(defvar font-lock-keywords nil)
(add-hook 'font-lock-mode-hook
'(lambda ()
(setq font-lock-keywords
(append font-lock-keywords
'(
;; ("^.\\{81,\\}$"
;; (0 'my-font-lock-long-line-face t))
("\t+"
(0 'my-font-lock-tab-face t))
("[ \t]+$"
(0 'my-font-lock-trailing-space-face t)))))))
;; (my-add-to-load-path
;; "D:/users/share/emacs/site-lisp/x-symbol/lisp/x-symbol/")
;;; ----[ 18.5 (info "(emacs)Scrolling")
;; scroll line by line
(setq scroll-step 1)
;; better scrolling in Emacs
(when (try-require 'pager)
(global-set-key [(meta v)] 'pager-page-up)
(global-set-key [prior] 'pager-page-up)
(global-set-key [(control v)] 'pager-page-down)
(global-set-key [next] 'pager-page-down)
(global-set-key [(meta up)] 'pager-row-up)
(GNUEmacs (global-set-key '[(meta kp-8)] 'pager-row-up))
(global-set-key [(meta down)] 'pager-row-down)
(GNUEmacs (global-set-key '[(meta kp-2)] 'pager-row-down)))
;;; ----[ 18.8 (info "(emacs)Useless Whitespace")
(defun my-delete-trailing-whitespaces-and-untabify ()
"Delete all the trailing white spaces, and convert all tabs to multiple
spaces across the current buffer."
(interactive "*")
(delete-trailing-whitespace (point-min) (point-max))
(untabify (point-min) (point-max)))
;;; ----[ 18.11 (info "(emacs)Optional Mode Line") Features
;; show the line number in each mode line
(line-number-mode 1)
;; show the column number in each mode line
(column-number-mode 1)
;; enable display of time (0 <= hh <= 23) in mode line
(setq display-time-24hr-format t)
(display-time)
;; use inactive face for mode-line in non-selected windows
(setq mode-line-in-non-selected-windows t)
;; code for including abbreviated file paths in mode line
(GNUEmacs
(when (try-require 'mode-line)
(mode-line-toggle-display nil)))
;;; ----[ 18.12 How (info "(emacs)Text Display")ed
;; convert a buffer from DOS ^M end of lines to Unix end of lines
(defun dos-to-unix ()
"Cut all visible ^M."
(interactive)
(save-excursion
(goto-char (point-min))
(while (search-forward "\r" nil t)
(replace-match ""))))
(global-set-key [(control c) (d)] 'dos-to-unix)
;; convert a buffer from Unix end of lines to DOS ^M end of lines
(defun unix-to-dos ()
(interactive)
(save-excursion
(goto-char (point-min))
(while (search-forward "\n" nil t)
(replace-match "\r\n"))))
;; Bad interaction with CVSNT/diff/... (not yet understood)
;; ;; Remove or convert trailing ctrl-M
;; (defun remove-trailing-ctrl-M ()
;; "Propose to remove trailing ^M from a file."
;; (interactive)
;; (save-excursion
;; (goto-char (point-min))
;; (if (and (not (string-match ".gz$" (buffer-file-name)))
;; (search-forward-regexp "\015$" nil t))
;; ;: a ^M is found
;; (if (or (= (preceding-char) ?\^J)
;; (= (following-char) ?\^J) )
;; (if (y-or-n-p (format "Remove trailing ^M from %s? "
;; (buffer-file-name)))
;; (progn (goto-char (point-min))
;; (perform-replace "\015" "" nil nil nil)
;; (pop-mark)
;; (save-buffer))
;; (message "No transformation."))))))
;; (add-hook 'find-file-hooks 'remove-trailing-ctrl-M)
;;; ----[ 18.14 The (info "(emacs)Cursor Display")
(GNUEmacs
;; using cursor color to indicate some modes (read-only, insert and
;; overwrite modes)
(setq hcz-set-cursor-color-color "")
(setq hcz-set-cursor-color-buffer "")
(defun hcz-set-cursor-color-according-to-mode ()
"Change cursor color according to some minor modes."
(let ((color
(if buffer-read-only "blue"
(if overwrite-mode "red"
"rgb:15/FF/00")))) ;; insert mode
(unless (and (string= color hcz-set-cursor-color-color)
(string= (buffer-name) hcz-set-cursor-color-buffer))
(set-cursor-color (setq hcz-set-cursor-color-color color))
(setq hcz-set-cursor-color-buffer (buffer-name)))))
(add-hook 'post-command-hook 'hcz-set-cursor-color-according-to-mode))
;; ;; conflicts with the above!
;; (when (try-require 'wide-column)
;; (setq wide-column-start-width 60)
;; (setq wide-column-default-cursor-colour "rgb:15/FF/00"))
;; ;; (add-hook 'text-mode-hook 'wide-column-mode)
;;; ----[ Temporary Displays
(GNUEmacs
(temp-buffer-resize-mode t))
;; enhanced display of temporary windows (such as help buffers)
;; (try-require 'show-temp-buffer) [bug with XEmacs 21.5]
(message "18 Controlling the Display... Done")
;;}}}
;;{{{ --[ 19 (info "(emacs)Search")ing and Replacement ]--------------------
(message "19 Searching and Replacement...")
;;; ----[ 19.4 (info "(emacs)Regexp Search")
;; list the input line, followed by the first nine substrings matches,
;; to debug regexp searches (in IELM)
;; example: ELISP> (save-excursion (set-buffer "BUFFER")
;; (re-search-forward "REGEXP" nil t)
;; (my-buffer-matched-strings))
(defun my-buffer-matched-strings ()
(interactive)
(mapcar 'my-buffer-matched-string-nth '(0 1 2 3 4 5 6 7 8 9)))
(defun my-buffer-matched-string-nth (n)
"Return the Nth pattern-matched string from the current buffer"
(if (and (match-beginning n) (match-end n))
(if (> (match-end n) (match-beginning n))
(buffer-substring (match-beginning n) (match-end n))
"")
nil))
;; to build Regexps with visual feedback, use `re-builder'
;; or KiKi, a Python RegEx Editor under Windows
;;; ----[ 19.6 (info "(emacs)Search Case")
;; searches and matches should ignore case
(setq case-fold-search t)
(message "19 Searching and Replacement... Done")
;;}}}
;;{{{ --[ 20 Commands for (info "(emacs)Fixit") Typos ]---------------------
(message "20 Commands for Fixing Typos...")
;;; ----[ 20.4 Checking and Correcting (info "(emacs)Spelling")
;; use GNU Aspell instead of (port of) ispell
(setq ispell-program-name
(if running-ms-windows
"C:/Program Files/Aspell/bin/aspell.exeTMP"
"/usr/bin/aspell"))
(my-file-executable-p ispell-program-name)
(when (and ispell-program-name
(file-executable-p ispell-program-name))
(require 'ispell)
;; aspell extensions should be used
(setq ispell-really-aspell t)
;; remove un-installed dictionaries from the default list
;; DOES NOT WORK IN ALL CONTEXTS YET!
;; as it does not always consider my list, I created .alias files for
;; nederlands and castellano
(setq ispell-dictionary-alist
'((nil ; default (English.aff)
"[A-Za-z]" "[^A-Za-z]" "[']" nil ("-B") nil iso-8859-1)
("american" ; Yankee English
"[A-Za-z]" "[^A-Za-z]" "[']" nil ("-B") nil iso-8859-1)
("british" ; British version
"[A-Za-z]" "[^A-Za-z]" "[']" nil ("-B" "-d" "british") nil iso-8859-1)
("castellano" ; Spanish mode
"[A-Z\301\311\315\321\323\332\334a-z\341\351\355\361\363\372\374]"
"[^A-Z\301\311\315\321\323\332\334a-z\341\351\355\361\363\372\374]"
"[-]" nil ("-B" "-d" "spanish") nil iso-8859-1)
;; ^^^^^^ name of .alias file
("english" ; make English explicitly selectable
"[A-Za-z]" "[^A-Za-z]" "[']" nil ("-B") nil iso-8859-1)
("francais" ; Francais.aff
"[A-Za-z\300\302\306\307\310\311\312\313\316\317\324\331\333\334\340\342\347\350\351\352\353\356\357\364\371\373\374]"
"[^A-Za-z\300\302\306\307\310\311\312\313\316\317\324\331\333\334\340\342\347\350\351\352\353\356\357\364\371\373\374]"
"[-']" t nil "~list" iso-8859-1)
("nederlands" ; Nederlands.aff
"[A-Za-z\300-\305\307\310-\317\322-\326\331-\334\340-\345\347\350-\357\361\362-\366\371-\374]"
"[^A-Za-z\300-\305\307\310-\317\322-\326\331-\334\340-\345\347\350-\357\361\362-\366\371-\374]"
"[']" t ("-C" "-d" "dutch") nil iso-8859-1)))
;; ispell
(autoload 'ispell-word "ispell" "Check the spelling of word in buffer." 't)
(autoload 'ispell-region "ispell" "Check the spelling of region." 't)
(autoload 'ispell-buffer "ispell" "Check the spelling of buffer." t)
;; save the personal dictionary without confirmation
(setq ispell-silently-savep t)
;; ;; consider using the `ispell-parser' to check your text
;; ;; Warning! Assignment to free variable ispell-parser!!
;; (add-hook 'tex-mode-hook
;; '(lambda ()
;; (setq ispell-parser 'tex)))
;; ;; TODO Problems in *mail*: checking all the headers!!
;; ;; turn on flyspell for all text modes
;; (add-hook 'text-mode-hook
;; '(lambda ()
;; (flyspell-mode 1)))
;; ;; start Flyspell when editing LaTeX source files
;; (add-hook 'LaTeX-mode-hook 'flyspell-mode)
;; ;; ignore the \citep and \citet commands of the NatBib bibliography style
;; (eval-after-load "ispell"
;; '(let ((list (car ispell-tex-skip-alists)))
;; (add-to-list 'list '("\\\\cite[tp]" ispell-tex-arg-end))
;; (setcar ispell-tex-skip-alists list)))
;; on-the-fly spelling checking
(autoload 'flyspell-mode "flyspell" "On-the-fly spelling checking" t)
;; enable the likeness criteria
(setq flyspell-sort-corrections nil)
;;
(setq flyspell-auto-correct-previous-word t)
;; dash character (`-') is considered as a word delimiter
(setq flyspell-consider-dash-as-word-delimiter-flag t)
;; solve the problem of words separated by `-' flagged as erroneous
;; by removing the `-' from the value of otherchars
(defun ispell-get-otherchars ()
(replace-regexp-in-string "-" "" (ispell-get-decoded-string 3)))
(defun my-turn-on-flyspell-french ()
"Unconditionally turn on Flyspell mode (in French)."
(interactive)
(flyspell-mode 1) ;; extra
(ispell-change-dictionary "francais")
(flyspell-buffer)) ;; extra
(global-set-key [(shift f7)] 'my-turn-on-flyspell-french)
(defun my-turn-on-flyspell-english ()
"Unconditionally turn on Flyspell mode (in English)."
(interactive)
(flyspell-mode 1)
(ispell-change-dictionary "english")
(flyspell-buffer))
(global-set-key [(control f7)] 'my-turn-on-flyspell-english)
;; turn flyspell-mode on [instead of just toggling the mode
;; by calling it like: (add-hook 'text-mode-hook 'flyspell-mode)]
(add-hook 'message-mode-hook 'my-turn-on-flyspell-french)
;; (defun activate-flyspell ()
;; "Turn on flyspell-mode and call flyspell-buffer."
;; (interactive)
;; ;; This next line REALLY slows buffer switching.
;; (flyspell-mode)
;; (flyspell-buffer))
;; (defvar customised-hooks-alist
;; '(emacs-lisp-mode-hook
;; nxml-mode-hook
;; python-mode-hook
;; sh-mode-hook
;; text-mode-hook)
;; "An alist of hooks that require customisations.")
;; (unless noninteractive
;; ;; Activate flyspell for various major modes.
;; (add-hook-list customised-hooks-alist 'activate-flyspell))
;; turn on flyspell-prog-mode instead, in emacs-lisp-mode, python-mode,
;; and sh-mode?
(defun my-turn-off-flyspell ()
"Unconditionally turn off Flyspell mode."
(interactive)
(flyspell-mode -1))
;; from Alex Schroeder
(defun my-change-dictionary ()
"Change the dictionary."
(interactive)
(let ((dict (or ispell-local-dictionary ispell-dictionary)))
(setq dict (if (string= dict "francais") "american" "francais"))
(message "Switched to %S" dict)
(sit-for 0.4)
(ispell-change-dictionary dict)
(when flyspell-mode
(flyspell-delete-all-overlays))))
;; key bindings
(global-set-key [(meta $)] 'ispell-word)
(global-set-key [(f7)] 'ispell-word)
(global-set-key [(shift f7)] 'my-change-dictionary)
(global-set-key [(control f7)] 'ispell-change-dictionary)
;; ;;* flyspell comments and strings in programming modes
;; ;; From: "Stefan Monnier <foo @ acm.com>"
;; (defun flyspell-generic-progmode-verify ()
;; "Used for `flyspell-generic-check-word-p' in programming modes."
;; (let ((f (get-text-property (point) 'face)))
;; (memq f '(font-lock-comment-face font-lock-string-face))))
;; (defun flyspell-prog-mode ()
;; "Turn on `flyspell-mode' for comments and strings."
;; (interactive)
;; (setq flyspell-generic-check-word-p 'flyspell-generic-progmode-verify)
;; (flyspell-mode 1))
;; (add-hook 'c-mode-common-hook 'flyspell-prog-mode t)
;; (add-hook 'java-mode-common-hook 'flyspell-prog-mode t)
(add-hook 'emacs-lisp-mode-hook 'flyspell-prog-mode)
;; LaTeX-sensitive spell checking
(setq ispell-enable-tex-parser t)
;; > J'ai ispell-maybe-find-aspelle-dictionnaries « Symbol definition
;; > function is void » à chaque lancement de flyspell...
;; Oui, c'est le package dictionaries-common de Debian qui installe un
;; ispell.el trop vieux dans emacs-snapshot, et ça provoque ce bug.
;; TODO Take a look at diction (grammar)
)
;; (add-to-list 'mm-charset-synonym-alist '(iso8859-15 . iso-8859-15))
;;{{{ Dictionary
(when (try-require 'dictionary)
(load "dictionary-init")
;; connect via a HTTP proxy (using the CONNECT command)
(setq dictionary-use-http-proxy nil)
;; name of the HTTP proxy to use
(setq dictionary-proxy-server "proxy")
;; port of the proxy server
(setq dictionary-proxy-port 80)
;; key bindings to invoke the dictionary client
(global-set-key [(control c) (s)] 'dictionary-search)
(global-set-key [(control c) (m)] 'dictionary-match-words)
;; ;; popup menu
;; (GNUEmacs
;; (global-set-key [mouse-3] 'dictionary-mouse-popup-matching-words))
;; (XEmacs
;; (global-set-key [(control button3)]
;; 'dictionary-mouse-popup-matching-words))
;;
;; ;; WordNet tool-tip support (for GNU Emacs 21)
;; (setq dictionary-tooltip-dictionary "wn")
;;
;; ;; global dictionary-mode
;; (GNUEmacs
;; (global-dictionary-tooltip-mode 1))
;;
;; ;; activate for all text-based modes
;; (add-hook 'text-mode-hook 'dictionary-tooltip-mode)
)
(defun my-leo (word)
(interactive "sWord: ")
(browse-url (format "http://dict.leo.org/?search=%s" word)))
;;}}}
(message "20 Commands for Fixing Typos... Done")
;;}}}
;;{{{ --[ 21 Keyboard Macros ]---------------------------------------------
(message "21 Keyboard Macros...")
;;; ----[ 21.1 Basic Use
;; execute the most recent keyboard macro
(global-set-key [(f8)] 'call-last-kbd-macro)
;; assign a name to the last keyboard macro defined
(global-set-key [(shift f8)] 'name-last-kbd-macro)
;; insert in visited buffer the definition of a named kbd macro
(global-set-key [(control f8)] 'insert-kbd-macro)
(message "21 Keyboard Macros... Done")
;;}}}
;;}}}
;;{{{ Major Structures of Emacs ############################################
;;{{{ --[ 22 (info "(emacs)Files") Handling ]-------------------------------
(message "22 Files Handling...")
;;; ----[ 22.2 Visiting Files
;; change the default directory (if it exists)
;; (it is also the default directory when attaching files to mails)
(setq my-default-dir
(cond (t
"~/")))
(if (file-directory-p my-default-dir)
(cd my-default-dir)
(cd (getenv "HOME")))
;; open my Emacs init file
(defun my-open-dot-emacs ()
"Opening ~/.emacs"
(interactive)
(find-file "~/.emacs"))
(global-set-key [(shift f3)] 'my-open-dot-emacs)
;; open my Gnus Configuration File
(defun my-open-dot-gnus ()
"Opening ~/.gnus"
(interactive)
(find-file "~/.gnus"))
(global-set-key [(control f3)] 'my-open-dot-gnus)
;;; ----[ 22.3 Saving Files
;; make your changes permanent
(global-set-key [(f2)] 'save-buffer)
;; (add-hook 'after-save-hook
;; 'executable-make-buffer-file-executable-if-script-p)
;; offer save of *scratch* buffer on exit
(save-excursion
(set-buffer "*scratch*")
(setq buffer-file-name "~/*scratch*"))
;; (setq buffer-offer-save t) does not have its intended effect in my
;; .emacs file (i.e. `buffer-offer-save' still has its global default
;; value of nil in the *scratch* buffer). But if I immediately evaluate it
;; in the *scratch* buffer, it works.
;; That is because at startup, Emacs sets the major mode of `*scratch*'
;; according to `initial-major-mode', _after_ my .emacs is read. Changing
;; major modes kills all local variables that are not permanently local,
;; including `buffer-offer-save'.
;; ensure a file ends in a newline when it is saved
(setq require-final-newline t)
;; directory used for temporary files
(XEmacs
(setq temporary-file-directory (or (getenv "TEMP") "/tmp/")))
;; one annoyance is that Emacs scatters autosave files (#foo#) and backup
;; files (foo~) all over the filesystem.
;; put autosave files (ie #foo#) in one place, *not* scattered all over the
;; file system! (The `make-autosave-file-name' function is invoked to
;; determine the filename of an autosave file.)
;; put backup files (i.e. foo~ or foo.~i~) in one place too
(GNUEmacs
;; regexp => directory mappings
;; filenames matching a regexp are backed up in the corresponding directory
(setq backup-directory-alist
'(("." . "~/.emacs_backups/")))) ;; '(("." . "~/.saves"))
;; Emacs will mkdir it if necessary
(XEmacs
(require 'backup-dir)
(make-variable-buffer-local 'backup-inhibited)
(setq bkup-backup-directory-info
'((t "~/.saves" ok-create full-path prepend-name))))
;; ;; The auto-save.el and backup.el packages collect files in one place
;; ;; I added the following to my crontab:
;; ;; # Cleanup the autosave and backup directories (24 * 7 = 168)
;; ;; 0 4 * * * /usr/sbin/tmpwatch 168 $HOME/.autosave $HOME/.backup
;; (when (try-require 'auto-save)
;; (setq auto-save-directory "~/.autosave/")
;; ;; Now that we have auto-save-timeout, let's crank this up
;; ;; for better interactive response.
;; (setq auto-save-interval 2000))
;; (try-require 'backup)
;; always use copying to create backup files (don't clobber symlinks)
(setq backup-by-copying t)
;; make numeric backup versions unconditionally
(setq version-control t)
;; delete excess backup versions silently
(setq delete-old-versions t)
;; automatically update the time stamp string (either Time-stamp: <>
;; or Time-stamp: "" occurring within the first 8 lines of a file) every
;; time you save a buffer
(add-hook 'write-file-hooks 'time-stamp)
(setq time-stamp-format
"%3a %:y-%02m-%02d %02H:%02M %u on %s")
;; weekday yyyy-mm-dd hh:mm user on system
;; insert a time stamp string
(defun my-insert-time-stamp ()
"Insert a time stamp."
(interactive "*")
(insert (format "%s %s - %s %s"
comment-start
(current-time-string)
(user-login-name)
comment-end)))
;;{{{ PCL-CVS
;; allow commit on whole directories
(setq cvs-allow-dir-commit t)
;; when to reuse an existing cvs buffer
(setq cvs-reuse-cvs-buffer 'always) ;; subdir
;; examine
(global-set-key [(control x) (v) (e)] 'cvs-examine)
;; examine without asking for a directory
(global-set-key [(control f9)]
'(lambda ()
(interactive)
(cvs-examine (file-name-directory (buffer-file-name))
nil)))
;; messages that should be ignored by the parser
;; should only ADD the last one to the default value of cvs-parse-...
(setq cvs-parse-ignored-messages
'("Executing ssh-askpass to query the password.*$"
".*Remote host denied X11 forwarding.*$"
".*-m wrapper option is not supported remotely.*$"))
;; change the CVS Id marker to reflect that a source file was edited
;; (from Brady Montz)
(defun my-mark-cvs-modified ()
"Called when a file has changed. Updates any RCS Id and Header keywords it
finds to show that the file is modified."
(let ((buffer-undo-list t))
; don't let this change get into the undo list
; because of this, we must ensure that the edit is in-place, and doesn't
; move any text
(when (and (buffer-modified-p) (boundp 'vc-mode) vc-mode)
(save-excursion
(goto-char (point-min))
(while (re-search-forward
(concat "\\(\\$\\(?:Id\\|Header\\): "
"[^\"'#;$]* \\)\\(Exp \\$\\)")
nil t)
(replace-match "\\1Mod $" t))))))
(defadvice basic-save-buffer (before my-basic-save-buffer first activate)
(my-mark-cvs-modified))
(defun run (command &optional to-buffer)
"A variation of shell-command.
With no optional argument this runs the command creating
a special buffer to put the output in. The buffer is named
after the first word in the command.
The optional argument to-buffer allows the target
buffer to be specified.
With the interactive-prefix the target buffer is the
current buffer (as in shell-command)."
(interactive (list (read-from-minibuffer "Shell command: "
nil nil nil 'shell-command-history)
current-prefix-arg))
(shell-command command (or to-buffer
(get-buffer-create
(car (split-string command " "))))))
(defun run-eval (command &optional func)
"Evaluate the shell command optionally passing results to a function.
Without the optional func this returns the result of
running the command, as a string.
With the function the results of the shell command are passed as
a string to the function, the value of calling the function is
returned.
If you supply func then it must either be a function taking
one string argument or a string which can be evaluated to a
function taking one string argument.
Interactively the prefix argument will cause a function to be
prompted for."
(interactive (list (read-from-minibuffer "Shell command: "
nil nil nil 'shell-command-history)
(if current-prefix-arg
(read-from-minibuffer "Function: "))))
(with-temp-buffer
;; This turns off the open window behavior of shell-command
(let ((pop-up-windows nil))
(shell-command command (current-buffer)))
(let ((str (buffer-substring-no-properties (point-min) (- (point-max) 1))))
(cond
((functionp func)
(funcall func str))
((stringp func)
(funcall (eval (read func)) str))
('t
str)))))
(defun map-files (thunk filename-list)
"Read in each file as a buffer and execute thunk on them.
If any file does not already exist in the buffer list then that
buffer is destroyed after thunk has been executed.
If filename-list is a list then it's used directly, if it's
a string we run string-to-words on it."
(mapcar (lambda (filename)
(if (not (get-file-buffer filename))
(let ((buf (find-file filename)))
(with-current-buffer buf
(funcall thunk)
(kill-buffer buf)))
(with-current-buffer (get-buffer filename)
(funcall thunk))))
(if (listp filename-list)
filename-list
(split-string filename-list))))
;; switch the entire module from one location to another, using the same
;; code base when being at different physical sites
(defun my-cvs-hack ()
"Toggle the CVS between local and remote"
(interactive)
(run-eval "find . -name 'Root'"
(lambda (list-of-files)
(map-files (lambda ()
(if (re-search-forward ":localhost:" nil 't)
(replace-match ":netfinity:")
(progn
(re-search-forward ":netfinity:" nil 't)
(replace-match ":localhost:")))
(save-buffer))
list-of-files))))
;;}}}
;;{{{ Subversion
;; Subversion interface for Emacs
(when (try-require 'psvn)
;; hide unmodified files
(setq svn-status-hide-unmodified t)
;; use longer phrases
(setq svn-status-short-mod-flag-p nil)
(define-key svn-log-edit-mode-map [f6] 'svn-log-edit-svn-diff)
;; examine
(global-set-key [(control x) (v) (e)] 'svn-status))
;;}}}
;;; ----[ 22.4 Reverting a Buffer
;; replace current buffer text with the text of the visited file on disk
(defun my-revert-buffer ()
"Unconditionally revert buffer"
(interactive)
(flet ((yes-or-no-p (msg) t))
(revert-buffer)))
;; key binding
(global-set-key [(control f12)] 'my-revert-buffer)
;;; ----[ 22.5 Auto Saving: Protection Against Disasters
;; how to get Emacs to auto-save to your local disk [#file#]
;; auto-save every 150 input events
(setq auto-save-interval 150)
;; auto-save after 15 seconds idle time
(setq auto-save-timeout 15)
;; Check out Kevin's ebackup.el
;; for saving in a specified common directory (not in local dir)
;; and handling saving of buffers with spaces in their name...
;; (otherwise, problems when composing *mail replies to ...* )
;;; ----[ 22.9 Comparing Files
;; ediff, a comprehensive visual interface to diff & patch
;; setup for Ediff's menus and autoloads
(require 'ediff-hook)
;; run `diff' in compilation-mode
(autoload 'diff-mode "diff-mode" "Diff major mode" t)
;; allow use of the ComponentSoftware Diff tool
;; (GNUEmacs
;; (when (try-require 'csdiff-setup)
;; (setq csdiff-program
;; "C:/Program Files/ComponentSoftware/HTMLDiff/HTMLDiff.exe")))
;; begin in side by side split
;; (setq ediff-split-window-function 'split-window-horizontally)
;;; ----[ 22.11 Accessing Compressed Files
;; easy editing of arc/zip/zoo/lhz archives
(GNUEmacs
(require 'arc-mode)
;; use the Cygwin gzip utility
(setq archive-zip-use-pkzip nil)) ;; no effect???
;; simple editing of tar files as a dired-like listing of its contents
(require 'tar-mode)
;;{{{ crypt++
;; code for handling all sorts of compressed and encrypted files
(try-require 'crypt++)
;; allows you to encrypt/decrypt files within Emacs. I use it regularly and
;; it works very reliably. When I use C-x C-f to access an encrypted file,
;; Emacs asks me for the passphrase and then decrypts the file before
;; displaying it. When I save the file, Emacs automatically encrypts it
;; again.
;;}}}
(custom-set-variables
'(auto-compression-mode t nil (jka-compr)))
;;; ----[ 22.13 Remote Files
;;{{{ Tramp - Transparent Remote Access, Multiple Protocols
;; (others than just FTP)
;; Tramp works very well in NTEmacs v22, with PuTTY (see `plink' and `pscp')
;; On me l'avait conseillé ici il y a quelques mois pour un autre usage :
;; travailler en remote avec une liaison n'offrant pas la possibilité de
;; l'export du DISPLAY... Je l'ai largement adopté tant ce machin est
;; pratique...
;;
;; On peut avoir autant de tampons que d'utilisateurs ou de machines et dès
;; que la session ssh (je l'utilise à travers cela) est terminée, il
;; redemande simplement le mot de passe et cela repart...
;; examples: C-x C-f /ssh:guestuser@shiva:/home/guestuser/.bash_history
;; /sudo:root@localhost:/home/others/.bashrc
;; use scpwrapper on win32 to get around NTEmacs paths vs. cygwin paths
(when (try-require 'tramp)
;; default transfer method (issues with Cygwin ssh)
(setq tramp-default-method "ssh") ; sshx
;; default user
(setq tramp-default-user "fni")
;; faster auto saves
(setq tramp-auto-save-directory temporary-file-directory)
;; help debugging
(setq tramp-verbose 9)
(setq tramp-debug-buffer t)
;; After adding
;; (setq coding-system-for-read 'utf-8)
;; (setq coding-system-for-write 'utf-8)
;; to my .emacs, tramp works correctly with UTF-8 files.
;; new proxy system (instead of the old multi-hop filename syntax)
;; For instance, there are two machines ("jail1", "web2") that I can only
;; access by first ssh'ing to a third ("janus").
;;
;; (add-to-list 'tramp-default-proxies-alist
;; '("jail1\\|web2" "kirk" "/ssh:kirk@janus:"))
;;
;; Then you can simply access "/jail1:" or "/web2:", given
;; tramp-default-method is set to "ssh", and tramp-default-user is set to
;; "kirk".
;; The trick is to think from the end.
;;{{{ Open a file as root, easily [from Alex Schroder]
(defvar find-file-root-prefix "/sudo:root@localhost:"
"*The filename prefix used to open a file with `find-file-root'.
This should look something like \"/sudo:root@localhost:\" (new style
TRAMP) or \"/[sudo:root@localhost]/\" (XEmacs or old style TRAMP).")
(defvar find-file-root-history nil
"History list for files found using `find-file-root'.")
(defvar find-file-root-hook nil
"Normal hook for functions to run after finding a \"root\" file.")
(defun find-file-root ()
"*Open a file as the root user.
Prepends `find-file-root-prefix' to the selected file name so that it
maybe accessed via the corresponding tramp method."
(interactive)
(require 'tramp)
(let* (;; We bind the variable `file-name-history' locally so we can
;; use a separate history list for "root" files.
(file-name-history find-file-root-history)
(name (or buffer-file-name default-directory))
(tramp (and (tramp-tramp-file-p name)
(tramp-dissect-file-name name)))
path dir file)
;; If called from a "root" file, we need to fix up the path.
(when tramp
(setq path (tramp-file-name-path tramp)
dir (file-name-directory path)))
(when (setq file (read-file-name "Find file (UID = 0): " dir path))
(find-file (concat find-file-root-prefix file))
;; If this all succeeded save our new history list.
(setq find-file-root-history file-name-history)
;; allow some user customization
(run-hooks 'find-file-root-hook))))
(defface find-file-root-header-face
'((t (:foreground "white" :background "red3")))
"*Face use to display header-lines for files opened as root.")
(defun find-file-root-header-warning ()
"*Display a warning in header line of the current buffer.
This function is suitable to add to `find-file-root-hook'."
(let* ((warning "WARNING: EDITING FILE AS ROOT!")
(space (+ 6 (- (frame-width) (length warning))))
(bracket (make-string (/ space 2) ?-))
(warning (concat bracket warning bracket)))
(setq header-line-format
(propertize warning 'face 'find-file-root-header-face))))
(add-hook 'find-file-root-hook 'find-file-root-header-warning)
(global-set-key [(control x) (control g)] 'find-file-root))
;;}}}
;;}}}
;;; ----[ 22.16 Convenience Features for Finding Files
;; show image files as images (not as semi-random bits)
(GNUEmacs
(auto-image-file-mode 1))
;; visit a file
(global-set-key [(f3)] 'find-file)
;; setup a menu of recently opened files
(when (try-require 'recentf)
;; to protect from tramp not correctly supported (yet) under Win32
(setq recentf-auto-cleanup 'never)
(recentf-mode 1)
;; maximum number of items in the recentf menu
(setq recentf-max-menu-items 20)
;; save file names relative to my current home directory
(setq recentf-filename-handlers '(abbreviate-file-name))
;; add key binding
(global-set-key [(control x) (control r)] 'recentf-open-files))
(message "22 Files Handling... Done")
;;}}}
;;{{{ --[ 23 Using Multiple (info "(emacs)Buffers") ]-----------------------
(message "23 Using Multiple Buffers...")
;;; ----[ 23.2 (info "(emacs)List Buffers")
;; rebind `C-x C-b'
;; `buffer-menu' (moves point in the window which lists your buffers)
;; `electric-buffer-list' (pops up a buffer describing the set of buffers)
(global-set-key [(control x) (control b)] 'electric-buffer-list)
;; customizable buffer-selection with multiple menus
(GNUEmacs
(when window-system
(require 'msb)))
;; buffer selection
(GNUEmacs
(try-require 'ibs))
;; cyclebuffer.el
;; put the current buffer at the end of the list of all buffers
(global-set-key [(shift f12)] 'bury-buffer)
;;; ----[ 23.4 (info "(emacs)Kill Buffer")
;; kill buffer without confirmation (if not modified)
(defun my-kill-this-buffer ()
"Kill the current buffer without confirmation"
(interactive)
(kill-buffer nil))
;; key binding
(global-set-key [(f12)] 'my-kill-this-buffer)
;;; ----[ 23.7 (info "(emacs)Buffer Convenience") and Customization of Buffer Handling
(when (require 'uniquify)
(setq uniquify-buffer-name-style 'forward))
;; (setq uniquify-after-kill-buffer-p t)
;; (setq uniquify-non-file-buffer-names t)
;; (setq uniquify-ignore-buffers-re " \\`\\ <file://\\`\\>*")
(message "23 Using Multiple Buffers... Done")
;;}}}
;;{{{ --[ 24 Multiple (info "(emacs)Windows") ]-----------------------------
(message "24 Multiple Windows...")
;; turn off this horrible tab thingy in XEmacs
(XEmacs
(when (boundp 'default-gutter-visible-p)
(set-specifier default-gutter-visible-p nil)))
;; look at ido
;;; ----[ 24.3 Using (info "(emacs)Other Window")
;; cycle through all windows on current frame
;; (global-set-key [(control tab)] 'other-window)
(global-set-key [(f6)] 'other-window)
;; ----[ 24.6 Deleting and (info "(emacs)Change Window")
;; delete all windows in the selected frame except the selected window
(global-set-key [(f5)] 'delete-other-windows)
;; delete the selected window and kill the buffer that was showing in it
;;(global-set-key [(f12)] 'kill-buffer-and-window)
;; enlarge or shrink windows more easily
(global-set-key [(control shift up)] 'enlarge-window)
(global-set-key [(control shift down)] 'shrink-window)
(global-set-key [(control shift left)] 'enlarge-window-horizontally)
(global-set-key [(control shift right)] 'shrink-window-horizontally)
;; make all visible windows the same height (approximately)
(global-set-key [(control f6)] 'balance-windows)
(message "24 Multiple Windows... Done")
;;}}}
;;{{{ --[ 25 (info "(emacs)Frames") and X Windows ]-------------------------
(message "25 Frames and X Windows...")
;;; ----[ 25.1 (info "(emacs)Mouse Commands") for Editing
;;{{{ Copy/Paste with Gnome desktop
(GNUEmacs
;; make Cut, Copy and Paste (keys and menu bar items) use the clipboard
(menu-bar-enable-clipboard)
;; cutting and pasting uses the clipboard
(setq x-select-enable-clipboard t))
;;}}}
;;; ----[ 25.7 (info "(emacs)Creating Frames")
;; o resize the frame to the size you want
;; o enter `(frame-parameters)' in the `*scratch*' buffer
;; o evaluate the form: place the cursor after the closing paren, and
;; type `C-j', so that the output goes right into the `*scratch*' buffer
;; put Emacs exactly where you want it, every time it starts up, by
;; auto-detecting the screen dimensions and computing where it should be
(when window-system
;; list of default values for frame creation (in font 9pt)
(setq default-frame-alist
(cond ((= (x-display-pixel-height) 1200)
'((left . 610) (height . 74)))
((= (x-display-pixel-height) 1024)
'((left . 610) (height . 63)))
((= (x-display-pixel-height) 800)
(if running-ms-windows
'((left . 610) (height . 48))
'((left . 610) (height . 53)
(vertical-scroll-bars . right)))) ;; under Ubuntu
((= (x-display-pixel-height) 768)
'((left . 610) (height . 46)))))
;; list of frame parameters for creating the initial frame
(setq initial-frame-alist '((top . 0) (left . 0))))
(XEmacs
(set-frame-width (buffer-dedicated-frame) 80)
(set-frame-height (buffer-dedicated-frame) 42)
(set-frame-position (buffer-dedicated-frame) 0 0))
;; title bar display of visible frames
(setq frame-title-format "Emacs - %b")
;; background color is frame-specific (not window!)
;; (setq special-display-buffer-names
;; (cons "*shell*" special-display-buffer-names))
;; (let ((special-display-frame-alist
;; (cons '(background-color . "dark") special-display-frame-alist)))
;; (shell))
;;; From sample .emacs
;;; local Emacs background: default
;;; remote Emacs background: palegreen1
;;; root Emacs background: coral2
;(cond
; ((and (string-match "XEmacs" emacs-version)
; (eq window-system 'x)
; (boundp 'emacs-major-version)
; (= emacs-major-version 19)
; (>= emacs-minor-version 12))
; (let* ((root-p (eq 0 (user-uid)))
; (dpy (or (getenv "DISPLAY") ""))
; (remote-p (not
; (or (string-match "^\\(\\|unix\\|localhost\\):" dpy)
; (let ((s (system-name)))
; (if (string-match "\\.\\(netscape\\|mcom\\)\\.com" s)
; (setq s (substring s 0 (match-beginning 0))))
; (string-match (concat "^" (regexp-quote s)) dpy)))))
; (bg (cond (root-p "coral2")
; (remote-p "palegreen1")
; (t nil))))
; (cond (bg
; (let ((def (color-name (face-background 'default)))
; (faces (face-list)))
; (while faces
; (let ((obg (face-background (car faces))))
; (if (and obg (equal def (color-name obg)))
; (set-face-background (car faces) bg)))
; (setq faces (cdr faces)))))))))
;;; ----[ 25.9 Making and Using a (info "(emacs)Speedbar") Frame
(require 'speedbar)
;; number of spaces used for indentation
(setq speedbar-indentation-width 2)
;; expand/collapse latex sections
(speedbar-add-supported-extension '(".tex" ".bib" ".w"))
;; jump to speedbar frame
(global-set-key [(f4)] 'speedbar-get-focus)
;; bind the arrow keys in the speedbar tree
;; [http://www.uweb.ucsb.edu/~dreamtheorist/emacs.html]
(define-key speedbar-key-map [(right)] 'speedbar-expand-line)
(define-key speedbar-key-map [(left)] 'speedbar-contract-line)
;; parameters to use when creating the speedbar frame in Emacs
(setq speedbar-frame-parameters '((width . 30)
(height . 45)
(foreground-color . "green")
(background-color . "white")))
;;; ----[ 25.16 (info "(emacs)Menu Bars")
;; turn menus off
(unless window-system
(menu-bar-mode 0))
;;; ----[ 25.20 (info "(emacs)Mouse Avoidance")
;; make mouse pointer stay out of the way of editing
(when window-system
(mouse-avoidance-mode 'animate))
;; mouse gestures
(when (try-require 'strokes)
(strokes-mode 1))
;; mouse wheel support
(GNUEmacs
(mwheel-install))
;;; ----[ Add-ons
(GNUEmacs
(when running-ms-windows
(defun w32-minimize-frame ()
"Minimize the current frame"
(interactive)
(w32-send-sys-command 61472))
(defun w32-maximize-frame ()
"Maximize the current frame"
(interactive)
(w32-send-sys-command 61488)
(global-set-key [(meta return)] 'w32-restore-frame))
(global-set-key [(meta return)] 'w32-maximize-frame)
(defun w32-restore-frame ()
"Restore a minimized frame"
(interactive)
(w32-send-sys-command 61728)
(global-set-key [(meta return)] 'w32-maximize-frame))
(defun w32-simulate-alt-tab ()
(interactive)
(w32-send-sys-command 61696))
(defun w32-start-screen-saver ()
(interactive)
(w32-send-sys-command 61760))
(defun w32-simulate-pressing-start-button ()
(interactive)
(w32-send-sys-command 61744))))
(message "25 Frames and X Windows... Done")
;;}}}
;;{{{ --[ 26 (info "(emacs)International") Character Set Support ]----------
(message "26 International Character Set Support...")
;; When using Latin-1, Windows (and Mac users) should stick to Official ISO
;; Latin-1 and not use the Windows CP 1252 codepage, which is (lamentably)
;; sometimes called "Latin-1". In real ISO Latin-1, character codes in the
;; range 127-159 are undefined. The Microsoft CP 1252 ("Windows Latin-1")
;; has assigned these undefined codes to glyphs listed on their codepage CP
;; 1252. For example, in Windows Latin-1, the Euro symbol has the code
;; 128. As long as the user creates and applies networks on his own machine
;; or some other Windows machine, everything seems to work fine, but the
;; networks cannot be shared with users on other platforms and cannot be
;; used in Xerox utf8-mode. In Latin-1 mode, xfst does not map the Microsoft
;; euro symbol to its proper Unicode representation \u20AC. This is the same
;; problem that happens with users whose environment is ISO-8859-15 (also
;; known as Latin-9).
;; Bottom Line: Users of the Xerox finite-state software need to understand
;; that ISO-8859-1 in xfst and the other applications means the REAL TRUE
;; ISO-8859-1 STANDARD and not some altered variant such as Latin-9 or CP
;; 1252 ("Windows Latin-1"). For any user who needs symbols that are not in
;; the 7-bit ASCII set, our recommendation is to move to Unicode UTF-8. That
;; is the only encoding that is the same across all platforms and operating
;; systems that support it.
;;; ----[ 26.3 (info "(emacs)Language Environments")
(set-language-environment "French")
;;; ----[ 26.5 (info "(emacs)Select Input Method")
;; M-x describe-coding-system RET RET
;; ;; default input method for multilingual text
;; (setq default-input-method "latin-1-prefix")
;;; ----[ 26.8 (info "(emacs)Recognize Coding") Systems
(add-to-list 'file-coding-system-alist
'("\\.owl\\'" utf-8 . utf-8))
;; and all the rest is utf-8:
;; '("" . utf-8)
;; In GNU Emacs, when you specify the coding explicitly in the file, that
;; overrides `file-coding-system-alist'. Not in XEmacs?
;; The variable `auto-coding-alist' is the strongest way to specify the
;; coding system for certain patterns of file names, or for files containing
;; certain patterns; this variable even overrides `-*-coding:-*-' tags in
;; the file itself.
;; default coding system (for new files),
;; also moved to the front of the priority list for automatic detection
(GNUEmacs
(prefer-coding-system 'iso-latin-1))
;; or set environment variables like LC_CTYPE, LANG or LC_ALL
;;; ----[ 26.9 (info "(emacs)Specify Coding") System
;; ;; priority order for recognizing coding systems when reading files
;; (GNUEmacs
;; (set-coding-priority (list 'coding-category-utf-8)))
(GNUEmacs
;; to copy and paste to and from Emacs through the clipboard
(set-selection-coding-system 'iso-latin-1))
;; (set-selection-coding-system 'compound-text-with-extensions)
;;; ----[ 26.13 (info "(emacs)Single-Byte Character Support")
;; unify the Latin-N charsets, so that Emacs knows that the é in Latin-9
;; (with the euro) is the same as the é in Latin-1 (without the euro)
;; [avoid the small accentuated characters]
(when (try-require 'ucs-tables)
(unify-8859-on-encoding-mode 1) ;; harmless
(unify-8859-on-decoding-mode 1)) ;; may unexpectedly change files if they
;; contain different Latin-N charsets
;; which should not be unified
;; (when window-system
;; ;; functions for dealing with char tables
;; (require 'disp-table))
;; (XEmacs
;; (require 'iso-syntax))
(message "26 International Character Set Support... Done")
;;}}}
;;}}}
;;{{{ Advanced Features ####################################################
;;{{{ --[ 27 (info "(emacs)Major Modes") ]----------------------------------
(message "27 Major Modes...")
;;; ----[ 27.1 How Major Modes are Chosen
;; list of filename patterns
;; vs corresponding major mode functions
;;{{{ DTD mode
(autoload 'dtd-mode "tdtd" "Major mode for SGML and XML DTDs." t)
(autoload 'dtd-etags "tdtd"
"Execute etags on FILESPEC and match on DTD-specific regular expressions."
t)
(autoload 'dtd-grep "tdtd" "Grep for PATTERN in files matching FILESPEC." t)
;; Turn on font lock when in DTD mode
(add-hook 'dtd-mode-hooks 'turn-on-font-lock)
(setq auto-mode-alist
(append
(list
'("\\.dcl$" . dtd-mode)
'("\\.dec$" . dtd-mode)
'("\\.dtd$" . dtd-mode)
'("\\.ele$" . dtd-mode)
'("\\.ent$" . dtd-mode)
'("\\.mod$" . dtd-mode))
auto-mode-alist))
;;}}}
(autoload 'html-helper-mode "html-helper-mode" "Yay HTML" t)
(autoload 'sql-mode "sql" nil)
;;{{{ css-mode
(autoload 'css-mode "css-mode")
(push '("\\.css\\'" . css-mode) auto-mode-alist)
;;}}}
;; use the (add-to-list 'auto-mode-alist '("\\.F\\'" . f90-mode)) form?
(push '("\\.\\(diffs?\\|patch\\|rej\\)\\'" . diff-mode) auto-mode-alist)
(push '("\\(\\.htm\\(l\\)?\\|.xsl\\)$" . html-helper-mode) auto-mode-alist)
(push '(".*\\.txt$" . indented-text-mode) auto-mode-alist)
(push '("\\.tex$" . LaTeX-mode) auto-mode-alist)
(push '("[mM]akefile" . makefile-mode) auto-mode-alist)
(push '("\\.cgi$" . perl-mode) auto-mode-alist)
(push '("\\.bash$" . shell-script-mode) auto-mode-alist)
(push '("\\.sql$" . sql-mode) auto-mode-alist)
(push '("\\.expect$" . tcl-mode) auto-mode-alist)
(push '("\\.js$" . java-mode) auto-mode-alist)
;; list of interpreters specified in the first line (starts with `#!')
;; vs corresponding major mode functions
(push '("expect" . tcl-mode) interpreter-mode-alist)
(autoload 'ssh-config-mode "ssh-config-mode" t)
(add-to-list 'auto-mode-alist '(".ssh/config\\'" . ssh-config-mode))
(add-to-list 'auto-mode-alist '("sshd?_config\\'" . ssh-config-mode))
(add-hook 'ssh-config-mode-hook 'turn-on-font-lock)
(autoload 'owl-mode "owl-mode" "OWL mode." t)
(push '("\\.owl$" . owl-mode) auto-mode-alist)
;; (push (cons "\\.owl$" 'owl-mode) auto-mode-alist)
;; ;;
;; ;; MMM mode, multimode stuff sdf
;; ;; Java - XML/JSP
;; ;;
;; (require 'mmm-auto)
;; (setq mmm-global-mode 'maybe)
;; (mmm-add-mode-ext-class nil "\\.xml?\\'" 'xml-java)
;; (mmm-add-mode-ext-class nil "\\.jsp\\'" 'java-html)
;; (mmm-add-classes
;; '((xml-java
;; :submode java-mode
;; :front "<xsp:logic>"
;; :back "</xsp:logic>")))
;; (mmm-add-classes
;; '((java-html
;; :submode java-mode
;; :front "<%"
;; :back "%>")))
;; load generic modes which support e.g. batch files
(try-require 'generic-x)
(message "27 Major Modes... Done")
;;}}}
;;{{{ --[ 28 (info "(emacs)Indentation") ]----------------------------------
(message "28 Indentation...")
;; indentation can't insert tabs
(setq-default indent-tabs-mode nil)
(message "28 Indentation... Done")
;;}}}
;;{{{ --[ 29 Commands for (info "(emacs)Text") Human Languages ]------------
(message "29 Commands for Human Languages...")
;;; ----[ 29.1 Words
;; GNU Emacs default for killing back to the beginning of a word
(XEmacs
(global-set-key [(control backspace)] 'backward-kill-word))
;;; ----[ 29.5 Filling Text
;; try longlines.el
;; turn on my text setup
(add-hook 'text-mode-hook 'my-text-mode-setup)
(defun my-text-mode-setup ()
"Turn on filling modes in text mode."
(turn-on-auto-fill)
;; adaptative filling
(when (try-require 'filladapt)
(setq-default filladapt-mode nil)
;; turn on filladapt mode everywhere but in ChangeLog files
(cond ((equal mode-name "Change Log")
t)
(t
(turn-on-filladapt-mode)))))
;; string for filling to insert at front of new line
(setq fill-prefix " ")
;; default value of `fill-column' for buffers that do not override it
(setq default-fill-column 76)
;; automatic line-wrapping beyond that column
(setq fill-column 76)
;; auto-refilling minor modes
(GNUEmacs
;; restrict refilling only when you insert characters, so
;; paragraphs will not get reformatted if the cursor moves over it
(try-require 'refill))
(XEmacs
;; refill.el does not work with XEmacs
(try-require 'maniac))
;;; ----[ 29.6 Case Conversion Commands
;; enable the use of the commands `downcase-region' and `upcase-region'
;; without confirmation
(put 'downcase-region 'disabled nil)
(put 'upcase-region 'disabled nil)
;;; ----[ 29.8 Outline Mode
;; bind the outline minor mode functions to an easy to remember prefix key
;; (more accessible than the horrible prefix C-c @)
(setq outline-minor-mode-prefix [(control o)])
;; bind the function `open-line' to M-o instead of C-o (by default)
(global-set-key [(meta o)] 'open-line)
;; outline mode commands for Emacs
(require 'outline)
;; makes other outline-minor-mode files feel like org files
(when (try-require 'outline-magic)
(add-hook 'outline-minor-mode-hook
(lambda ()
(define-key outline-minor-mode-map
(kbd "<backtab>") 'outline-cycle)
(define-key outline-minor-mode-map
[(meta left)] 'outline-promote)
(define-key outline-minor-mode-map
[(meta right)] 'outline-demote)
(define-key outline-minor-mode-map
[(meta up)] 'outline-move-subtree-up)
(define-key outline-minor-mode-map
[(meta down)] 'outline-move-subtree-down))))
;;{{{ Folding Editing
(when (try-require 'folding)
(folding-mode-add-find-file-hook))
(when (try-require 'fold-dwim)
(global-set-key [(control c) (f) (t)] 'fold-dwim-toggle)
(global-set-key [(control c) (f) (h)] 'fold-dwim-hide-all)
(global-set-key [(control c) (f) (s)] 'fold-dwim-show-all))
;;}}}
;;; ----[ (info "(emacs-goodies-el)boxquote")
;; to quote text with a semi-box
(when (try-require 'boxquote)
(global-set-key [(control c) (b) (r)] 'boxquote-region)
(global-set-key [(control c) (b) (t)] 'boxquote-title))
;;; ----[ Chapter 21 - Annex
;; http://users.bigpond.net.au/sryoungs/XEmacs/init-files/latex-sy.html
;; = useful examples for XEmacs
;; Having a toolbar only makes sense if we're in a windowing environment.
(XEmacs
(eval-and-compile
(when (device-on-window-system-p)
(try-require 'latex-toolbar))))
;; Take a look at Peter Gacs's macros for italic, ...
(defun my-LaTeX-insert-underscore ()
"Inserts an underscore depending on the close context (tbd)
If needed a backslash is inserted before"
(interactive)
(insert "\\_"))
(defun my-LaTeX-mode-setup ()
"Customize my LaTeX-mode."
(local-set-key "_" 'my-LaTeX-insert-underscore))
(add-hook 'LaTeX-mode-hook 'my-LaTeX-mode-setup)
;;; ----{ Emacs latex mode
;; (Emacs built-in latex-mode, not related to AUCTeX)
;; Use a saner viewer. Try xpdf, for example. It won't reload
;; automatically, but a quick tap on the R key will force it to reload the
;; file. No need to close & reopen.
;; (setq tex-dvi-view-command "xpdf")
;;; ----[ (info "(auctex)Top")
;; Note -- AUCTeX aliases tex-mode to TeX-mode
;; NB: invoking (la)tex-mode also runs text-mode-hook
;;{{{ 2 - (info "(auctex)Installation") of AUCTeX
;; (eval-after-load "latex" ;; or "tex"?
;; '(progn
;; (add-to-list 'TeX-expand-list
;; '("%a"
;; (lambda nil
;; asy-command-location)) t)
;; (add-to-list 'TeX-command-list
;; '("asy-LaTeX" "%l \"%(mode)\\input{%t}\" && %aasy ..."
;; TeX-run-interactive nil (latex-mode)
;; :help "Run LaTeX && Asymptote && LaTeX"))))
;; Press C-c C-c FILE <Return> <Return> to run dvips (Note that the command
;; is FILE and not Dvips as one might expect)
;; Press C-c C-c Print <Return> <Return> to run GSview (Also somewhat
;; misleading name)
;; If you want to print the document, do it from GSview.
;; list of commands to execute on the current document
(setq TeX-command-list
;; to avoid the `! I can't find file `'.tex'' message, I had to
;; replace the single quotes ' by " (the cause is that I was using
;; a shell that does not understand single quotes)
(list (list "2UpLF"
"dvips -t landscape -Php4000n %s -f | psnup -2 -r > %s-2up.ps"
'TeX-run-LaTeX nil t)
(list "2UpF" "dvips -Php4000n %s -f | psnup -2 > %s-2up.ps"
'TeX-run-LaTeX nil t)
(list "Z" "latex \"\\nonstopmode\\input{%s}\"& dvips %d -o %f"
'TeX-run-LaTeX nil t)
(list "TeX" "tex \"\\nonstopmode\\input %t\""
'TeX-run-TeX nil t)
(list "TeX Interactive" "tex \"%t\""
'TeX-run-interactive nil t)
(list "LaTeX" "%l --src \"\\nonstopmode\\input{%t}\""
'TeX-run-LaTeX nil t)
(list "Pdf" "pdflatex \"\\nonstopmode\\input{%s}\""
'TeX-run-LaTeX nil t)
(list "LaTeX Interactive" "%l \"%t\""
'TeX-run-interactive nil t)
(if (or window-system (getenv "DISPLAY"))
(list "View" "%v "
'TeX-run-background t nil)
(list "View" "dvi2tty -q -w 132 %s "
'TeX-run-command t nil))
(list "Print" "%p "
'TeX-run-command t nil)
(list "Queue" "%q"
'TeX-run-background nil nil)
(list "File" "dvips %d -o %f "
'TeX-run-command t nil)
(list "BibTeX" "bibtex \"%s\"" ;; Very Important Package
;; avec Reftex
'TeX-run-BibTeX nil nil)
(list "Index" "makeindex \"%s\""
'TeX-run-command nil t)
(list "Check" "lacheck %s"
'TeX-run-compile nil t)
(list "Spell" "<ignored>"
'TeX-run-ispell nil nil)
(list "Other" ""
'TeX-run-command t t)
;; Not part of standard TeX.
(list "Makeinfo" "makeinfo %t"
'TeX-run-compile nil t)
(list "AmSTeX" "amstex \"\\nonstopmode\\input %t\""
'TeX-run-TeX nil t)))
;;}}}
;;{{{ 5 - (info "(auctex)Advanced Features")
;;{{{ 5.2 (info "(auctex)Completion")
;; if this is non-nil when AUC TeX is loaded, the TeX escape character `\'
;; will be bound to `TeX-electric-macro'
(setq TeX-electric-escape t)
;;}}}
;;{{{ 5.4 (info "(auctex)Indenting")
;; number of spaces to add to the indentation for each `\begin' not matched
;; by a `\end'
(setq LaTeX-indent-level 4)
;; number of spaces to add to the indentation for `\item''s in list
;; environments
(setq LaTeX-item-indent -4)
;; number of spaces to add to the indentation for each `{' not matched
;; by a `}'
(setq TeX-brace-indent-level 4)
;; function to be called upon pressing `RET'
;; `return' indents the current line, then inserts a new line and moves
;; the cursor to an appropriate position by the left margin
(setq TeX-newline-function 'newline-and-indent)
;;}}}
;;}}}
;;{{{ 7 - (info "(auctex)Running TeX and friends") Processors, Viewers and Other Programs
;;{{{ 7.1 Executing Commands
;; enable Tex-Pdf mode
(setq TeX-PDF-mode t)
;; (setq TeX-view-format "pdf")
;; ;-- (remove ".pdf" completion-ignored-extensions))
;; (setq pdf-previewer-program "texdoc")
;; '(dired-view-command-alist (quote (("\\.\\(ps\\|ps_pages\\|eps\\)\\'" .
;; "texdoc %s") ("\\.pdf\\'" . "texdoc %s") ("\\.\\(jpe?g\\|gif\\|png\\)\\'"
;; . "xv %s") ("\\.dvi\\'" . "texdoc %s"))))
;; (setq latex-run-command "pdflatex")
;;}}}
;;{{{ 7.2 Viewing the formatted output
;; list of style options and view options
(setq TeX-view-style '(("^epsf$" "ghostview %f")
("^ncs$" "ghostview %f")
("^a5$" "yap %d")
("^landscape$" "yap %d")
("." "yap %d")))
;;}}}
;;{{{ 7.3 Catching the errors
;; don't show output of TeX compilation in other window
(setq TeX-show-compilation nil)
;;}}}
;;}}}
;;{{{ 8 - (info "(auctex)Multifile") Documents
;; AUC TeX will will assume the file is a master file itself
(setq-default TeX-master t)
;;}}}
;;{{{ 9 - Automatic (info "(auctex)Parsing Files")
;; enable parse on load (if no style hook is found for the file)
(setq TeX-parse-self t)
;; enable automatic save of parsed style information when saving
;; the buffer
(setq TeX-auto-save t)
;;}}}
;;{{{ 11 - (info "(auctex)Automatic") Customization
;;{{{ 11.1 (info "(auctex)Automatic Global") Customization for the Site
;; (try-require 'tex-site) should not be used with current AUCTeX releases
;; directory containing automatically generated TeX information. Must end
;; with a slash
(setq TeX-auto-global
"~/.emacs.d/auctex-auto-generated-info/")
;;}}}
;;{{{ 11.3 (info "(auctex)Automatic Local") Customization for a Directory
;; directory containing automatically generated TeX information. Must end
;; with a slash
(setq TeX-auto-local
"~/.emacs.d/auctex-auto-generated-info/")
;;}}}
;;}}}
;; support for LaTeX documents
(try-require 'latex)
;; extra support for outline minor mode
(try-require 'out-xtra)
;;{{{ (info "(preview-latex)Top")
;; (add-hook 'LaTeX-mode-hook 'LaTeX-preview-setup)
;; (autoload 'LaTeX-preview-setup "preview")
;; how to call gs for conversion from EPS
(setq preview-gs-command "C:/Program Files/gs/gs8.54/bin/gswin32c.exe")
(my-file-executable-p preview-gs-command)
;;}}}
;;{{{ nuweb
;; define what's needed to properly call nuweb
(make-variable-buffer-local 'outline-prefix-char)
(make-variable-buffer-local 'outline-regexp)
(make-variable-buffer-local 'outline-level-function)
(setq AucTeX-used t) ;; defined in major mode to edit nuweb files with AucTex
(setq nuweb-comment-leader "@%")
(autoload 'nuweb-mode "nuweb" nil t)
(add-hook 'nuweb-mode-hook 'nuweb-compute-d-u)
(add-hook 'nuweb-mode-hook
'(lambda()
(imenu-add-to-menubar "Nuweb")))
(push '("\\.w$" . nuweb-mode) auto-mode-alist)
(when (try-require 'nuweb) ;; depends on TeX-lisp-directory
(push (list "PWeb"
"nuweb %s & pdflatex \"\\nonstopmode\\input{%s}\""
'TeX-run-LaTeX nil t) TeX-command-list)
(push (list "Web"
"nuweb %s & latex --src \"\\nonstopmode\\input{%s}\""
'TeX-run-LaTeX nil t) TeX-command-list)
;; Weave generates Tex output then runs LaTeX
(push (list "Weave"
"nuweb -o %s"
'TeX-run-LaTeX nil t) TeX-command-list)
;; Tangle generates only the source file compile not done
(push (list "Tangle"
"nuweb -t %s & echo \"Sources updated\""
'TeX-run-LaTeX nil t) TeX-command-list))
;;}}}
(message "29 Commands for Human Languages... Done")
;;}}}
;;; ----[ Chapter 17 - Annex
;; LaTeX fontification for Font Lock mode
(if window-system
(when (try-require 'font-latex)
(add-hook 'latex-mode-hook 'turn-on-font-lock 'append)
(add-hook 'LaTeX-mode-hook 'turn-on-font-lock 'append)))
;;;;;;;; MUST BE AFTER LaTeX stuff to work, right now...
;;{{{ latex add-ons (reftex, ...)
;; get more appropriate values for MikTeX
;; (default configuration of AUCTeX is not the best fit for Windows systems)
(when running-ms-windows
(try-require 'tex-mik))
(try-require 'reftex)
;; ;; reftex
;; (autoload 'reftex-mode "reftex" "RefTeX Minor Mode" t)
;; (autoload 'turn-on-reftex "reftex" "RefTeX Minor Mode" nil)
;; (autoload 'reftex-citation "reftex-cite" "Make citation" nil)
;; (autoload 'reftex-index-phrase-mode "reftex-index" "Phrase mode" t)
;; (add-hook 'LaTeX-mode-hook 'turn-on-reftex) ; with AUCTeX LaTeX mode
;; (add-hook 'latex-mode-hook 'turn-on-reftex) ; with Emacs latex mode
;; (setq reftex-plug-into-AUCTeX t)
;; ; M-x customize-variable RET reftex-plug-into-AUCTeX RET
;;}}}
;;{{{ --[ 30 Editing (info "(emacs)Programs") ]-----------------------------
(message "30 Editing Programs...")
;;; ----[ 30.1 Major Modes for Programming Languages
(autoload 'awk-mode "cc-mode" "Awk editing mode." t)
;; or use a new AWK Mode for AWK files, rather than the older mode contained
;; in the file awk-mode.el [from http://people.smu.edu/zwang/awk-mode.html]??
;; (try-require 'graphviz-dot-mode)
;;; ----[ 30.3 Indentation for Programs
;; turn on auto-fill mode in Lisp modes
(add-hook 'lisp-mode-hook 'turn-on-auto-fill)
(add-hook 'emacs-lisp-mode-hook 'turn-on-auto-fill)
;; use one of several different indentation styles for C-like modes
(setq c-default-style
'((awk-mode . "stroustrup")
(other . "stroustrup")))
(defun my-c-mode-setup ()
"Customize my c/c++-mode and awk-mode."
;; indent properly source and non-source buffers
(local-set-key [(return)] 'newline-and-indent) ; (control m)
(local-set-key [(linefeed)] 'newline)) ; (control j)
(add-hook 'c-mode-hook 'my-c-mode-setup)
(add-hook 'c++-mode-hook 'my-c-mode-setup)
(add-hook 'awk-mode-hook 'my-c-mode-setup)
(defun back-to-indentation-or-beginning ()
(interactive)
(if (/= (point) (line-beginning-position))
(beginning-of-line)
(back-to-indentation)))
;;; ----[ 30.4 Commands for Editing with Parentheses
;; highlight matching parenthesis
(GNUEmacs
(require 'paren)
(show-paren-mode t)
(setq show-paren-ring-bell-on-mismatch t))
(XEmacs
(paren-set-mode 'paren))
;; if the matching paren is offscreen, show the matching line in the echo
;; area + many other useful things
(when window-system
(when (try-require 'mic-paren)
;; activating
(paren-activate)))
;; from hall@grumpy.nl.nuwc.navy.mil
;; goto-matching-paren
;;; ----[ 30.5 Manipulating Comment
(XEmacs
(defun my-comment-region (beg end)
"Comment a region of text"
(interactive "r")
(comment-region beg end)
(global-set-key [(meta \;)] 'my-uncomment-region))
(defun my-uncomment-region (beg end)
"Uncomment a region of text"
(interactive "r")
(comment-region beg end -1)
(global-set-key [(meta \;)] 'my-comment-region))
(global-set-key [(meta \;)] 'my-comment-region))
(defun my-?comment-region ()
(save-excursion
(let ((r-b (region-beginning))
(r-e (region-end)))
(funcall
(if (progn
(goto-char r-b)
(beginning-of-line)
(looking-at (format "\\s-*%s" (regexp-quote comment-start))))
(function uncomment-region)
(function comment-region))
r-b r-e))))
(defun my-?comment ()
(interactive)
(save-excursion
(if mark-active
(my-?comment-region)
(funcall
(if (progn
(beginning-of-line)
(looking-at (format "\\s-*%s" (regexp-quote comment-start))))
(function uncomment-region)
(function comment-region))
(progn (beginning-of-line) (point))
(progn (end-of-line) (point))))))
;;; ----[ 30.8 Completion for Symbol Names
;; dynamic word-completion code
(load "completion") ;; a.o., add completion-c-mode-hook
(initialize-completions)
;; (global-set-key [(control return)] 'complete)
;; > Does Emacs support keyword autocompletion like VI's
;; > Control+P ? If yes, what is the key combo?
;; > Would you perhaps be referring to M-/ , for certain modes (css-mode
;; > for instance there also is M-TAB which is a little more intelligent)
;; M-/ runs the command dabbrev-expand [dabbrev]
;; = cycling behavior
;; C-M-/ runs the command dabbrev-completion [dabbrev]
;; = completion buffer behavior
;; > I'm trying to have code completion in Emacs, but i don't know what to
;; > do. In eclipse, when we writing a java code line, for example:
;; > System.out., we do C^SPACE to show a window with several methods
;; > associated (printl, print,etc).
;; > I would like to have something similar in Emacs. Can anybody help me?
;; Try M-TAB with cursor on the symbol; is that what you are looking for?
;;; ----[ 30.9 Glasses
;; face to be put on capitals of an identifier looked through glasses
(setq glasses-face 'bold)
;; string to be displayed as a visual separator in unreadable identifiers
(setq glasses-separator "")
;;{{{ Collection of Emacs Development Environment Tools
;; ;; add Semantic Bovinator's directory to the load path
;; (my-add-to-load-path
;; "D:/users/share/emacs/site-lisp/semantic-1.4.4/")
;; ;; add speedbar's directory to the load path
;; (my-add-to-load-path
;; "D:/users/share/emacs/site-lisp/speedbar-0.14beta4/")
;; ;; add Enhanced Integration of Emacs Interpreted Objects' directory to the
;; ;; load path
;; (my-add-to-load-path
;; "D:/users/share/emacs/site-lisp/eieio-0.17/")
;; ;; must be before the command that actually loads semantic
;; (setq semantic-load-turn-everything-on t)
;; (require 'semantic-load)
;; ;;!! Package speedbar does not define speedbar-version
;; ;; Source parsing/code browsing
;;;; (my-add-to-load-path "y:/site-lisp/cedet/")
;; (my-add-to-load-path "y:/site-lisp/cedet/common/")
;; (try-require 'cedet)
;; (GNUEmacs
;; (semantic-load-enable-code-helpers))
;; (my-add-to-load-path "y:/site-lisp/ecb/")
(try-require 'ecb-autoloads)
;; (try-require 'ecb)
;; FROM DDW
;; ;;Source parsing/codebrowsing
;; (load-library "cedet/common/cedet.el")
;; (semantic-load-enable-code-helpers)
;; (push (concat site-lisp "/ecb-2.31") load-path)
;; (try-require 'ecb)
;; (custom-set-variables
;; '(ecb-directories-menu-user-extension-function nil)
;; '(ecb-history-menu-user-extension-function nil)
;; '(ecb-methods-menu-user-extension-function nil)
;; '(ecb-options-version "2.31")
;; '(ecb-sources-menu-user-extension-function nil))
;; If you've installed CEDET and ECB, eassist is worth trying out:
;; http://www.mail-archive.com/gnu-emacs-sources@gnu.org/msg00292.html
;;
;; It uses CEDET to provide a handy symbols browser for the current file, that
;; narrows down the list as you type substrings. Tastes differ, but I for one
;; really like this.
;;}}}
(message "30 Editing Programs... Done")
;;}}}
;;{{{ --[ 31 (info "(emacs)Building") Compiling and Testing Programs ]------
(message "31 Compiling and Testing Programs...")
;; >> It's possible to see, while we are programming, if we did a mistake. In
;; >> eclipse, when we do an error, for example, forget a ; , an underline
;; >> appears in the line indicating that something is wrong. It's possible to
;; >> have something like this in Emacs?
;; >
;; > There's a CWarn mode for C and C++, but I don't know about similar
;; > features for Java. Anyone?
;; flymake can compile in the background and colorize lines with errors/warnings
;; http://flymake.sourceforge.net/
;; http://www.emacswiki.org/cgi-bin/wiki/JdeeFlymake
;;; ----[ 31.1 Running Compilations under Emacs
;; invoke a compiler with the same command as in the last invocation of
;; `compile'
(global-set-key [(f9)] 'recompile)
;; scroll the *compilation* buffer window as output appears
(setq compilation-scroll-output t)
;; compile the program including the current buffer
(setq compilation-window-height 4)
(defvar make-clean-command "make clean all"
"*Command used by the `make-clean' function.")
(defun make-clean (&optional arg)
"Run a make clean."
(interactive "P")
(require 'compile) ;; needed for compile-internal
(if arg
(setq make-clean-command (read-string "Command: " make-clean-command)))
(save-some-buffers (not compilation-ask-about-save) nil)
(compile-internal make-clean-command "No more errors"))
(global-set-key [(shift f9)] 'make-clean)
;;; ----[ 31.2 Searching with Grep under Emacs
;; ignore case distinctions in the default grep command
(setq grep-command "grep -n -i -e ")
;; grep+emacs 22 + cygwin does not follow file links
;; try adding "-nH" to your grep options.
;;; ----[ 31.3 Compilation Mode
;; display the next compiler error message
(global-set-key [(f10)] 'next-error)
;; display the previous compiler error message
(global-set-key [(shift f10)] 'previous-error)
;; display the first compiler error message
(global-set-key [(control f10)] 'first-error)
;; highlight and parse the whole compilation output as soon as it arrives
(setq compile-auto-highlight t)
;;; ----[ 31.5 Running Debuggers Under Emacs
;;{{{ Debugging Mercury programs
;; 1. Put these lines in your .emacs file:
;; (setq mercury-dir (getenv "MERCURY_DIR"))
;; (load-file (concat mercury-dir "/lib/mercury/elisp/gud.el"))
;; (setq mdb-command-name "bash.exe mdb ./mas_server.exe -c
;; ../online/mas_server/mas_config_local.xml -d ../data"))
;; 2. To start the debugger, open a file in your build directory,
;; e.g. build/Makefile
;; 3. Run M-x and then type mdb
;; 4. At the prompt you should see the command from the .emacs file:
;; "bash.exe mdb ./mas_server.exe -c
;; ../online/mas_server/mas_config_local.xml -d ../data"
;; Change if necessary and hit the 'Return' key
;; 5. Find your bugs.
;; Known problems:
;; - tab completion doesn't work
;;}}}
;;{{{ Debugging Lisp programs
;; Emacs has the basic debugger/stack trace, but it also has edebug, which
;; is very powerful, for the more complex situation.
;; You can cause the debugger to be called at a certain point in your
;; program by writing the expression `(debug)' at that point. To do this,
;; visit the source file, insert the text `(debug)' at the proper place,
;; and type `C-M-x'.
;; `c' Exit the debugger and continue execution
;; `d' Continue execution, but enter the debugger the next time any Lisp
;; function is called.
(define-key emacs-lisp-mode-map [(control x) (x)] 'edebug-eval-top-level-form)
(define-key emacs-lisp-mode-map [(control x) (x)] 'edebug-defun)
(autoload 'edebug-eval-top-level-form "edebug")
(setq edebug-global-prefix "\C-xX")
(add-hook 'cl-load-hook
'(lambda ()
(add-hook 'edebug-setup-hook
'(lambda ()
(load-library "cl-specs")))))
;; toggle whether to enter Lisp debugger when an error is signaled
;; (global-set-key [(super c) (d)] 'toggle-debug-on-error)
;;}}}
;;; ----[ 31.6 Executing Lisp Expressions
;; show function arglist or variable docstring in echo area
(add-hook 'emacs-lisp-mode-hook 'turn-on-eldoc-mode)
(add-hook 'lisp-interaction-mode-hook 'turn-on-eldoc-mode)
(add-hook 'ielm-mode-hook 'turn-on-eldoc-mode)
;;; ----[ 31.8 Evaluating Emacs-Lisp Expressions
;; enable the use of the command `eval-expression' without confirmation
(put 'eval-expression 'disabled nil)
;;; ----[ 31.9 Lisp Interaction Buffers
;; to evaluate a non-interactive command, simply use IELM!
;; interaction mode for Emacs Lisp
(autoload 'ielm "ielm" "Start an inferior Emacs Lisp session" t)
;; !if `comint-min-history-size' is not initialised, IELM will fail!?
(setq comint-min-history-size 5)
(make-variable-buffer-local 'comint-min-history-size)
;;; ----[ 31.10 Running an External Lisp
;; Just as in C, C++, Java, Perl, Python, etc, Lisp code is kept in
;; files. All the normal editing operations are performed on files. In this
;; respect, hacking in Lisp is like hacking in any other language that you
;; are used to. What's different is that what you are hacking is a running
;; Lisp program. When you edit a function definition or add a new one, you
;; compile it into a running program. There is no compile, link, run, debug
;; cycle as you know it from C or Java.
;; Ponder that for a minute.
;; When you fix a bug in a C function, you have to recompile, relink, and
;; reload your program before you can test the fix. You don't do that in
;; Lisp. You make the fix and then go straight to testing it. This process
;; can be even faster than fixing a bug in a scripting language like Perl.
;; superior lisp inferior mode extension
(when (try-require 'slimeXXX)
;; indentation
(slime-setup)
(add-hook 'lisp-mode-hook
'(lambda ()
(slime-mode t)))
(add-hook 'inferior-lisp-mode-hook
'(lambda ()
(inferior-slime-mode t)))
;; Gnu CLISP - Inferior Lisp Mode & ILISP (switches for ANSI & no banner)
(defvar clisp-dir
(if running-ms-windows
"e:/vmware-home/bin/win32/clisp-2.31/full/"
"/usr/bin"))
(defvar clisp-exe
(if running-ms-windows
(concat clisp-dir "lisp.exe")
(concat clisp-dir "/" "clisp")))
;; optionally, specify the lisp program you are using. Default is "lisp".
;; include the full linking set with `-K full'
(setq inferior-lisp-program
(if running-ms-windows
(concat clisp-exe
" -B " clisp-dir
" -M " clisp-dir "lispinit.mem"
" -ansi -q")
(concat clisp-exe
" -B " clisp-dir
" -ansi -q"))) ;; "clisp -K full"
;; connect automatically to my lisp when opening a lisp file
(defun cliki:start-slime ()
(unless (slime-connected-p)
(save-excursion (slime))))
(add-hook 'slime-mode-hook 'cliki:start-slime)
;; automatically show documentation for code near the point
(add-hook 'slime-mode-hook
(lambda ()
(slime-autodoc-mode t)))
;; ;; GNU CLISP - http://clisp.cons.org/
;; (defun clisp-start ()
;; (interactive)
;; (shell-command (concat "c:/bin/clisp-2.32/full/lisp.exe "
;; "-B c:/bin/clisp-2.32/full/ "
;; "-M c:/bin/clisp-2.32/full/lispinit.mem "
;; "-i c:/usr/home/.slime.lisp "
;; "-ansi -q&"))))
; Functions and key bindings for getting Emacs to interact with GCL.
; Thomas R. Ioerger, Dept of Computer Science, Texas A&M University
; see http://www.cs.tamu.edu/faculty/ioerger/emacs-gcl.html for more details
(global-set-key "\C-t" (make-keymap))
(defun run-gcl ()
(interactive)
(split-window)
(other-window 1)
(inferior-lisp "gcl"))
(defun gcl-debug-quit ()
(interactive)
(comint-send-string "*inferior-lisp*" ":q\C-M"))
(defun gcl-quit ()
(interactive)
(comint-send-string "*inferior-lisp*" "(bye)\C-M"))
(defun gcl-eval-buffer ()
(interactive)
(set-mark 0)
(end-of-buffer)
(lisp-eval-region 1 (point))
(exchange-point-and-mark))
(global-set-key "\C-tl" 'run-gcl)
(global-set-key "\C-te" 'lisp-eval-defun)
(global-set-key "\C-tw" 'switch-to-lisp) ; split screen!
(global-set-key "\C-tq" 'gcl-debug-quit)
(global-set-key "\C-tb" 'gcl-eval-buffer)
(global-set-key "\C-tx" 'gcl-quit)
; commands (after prefix of control-t)
; l = start lisp
; e = eval current expression
; w = switch to lisp buffer
; q = quit from debugger back to top-level
; b = eval buffer
; x = kill lisp process
)
(message "31 Compiling and Testing Programs... Done")
;;}}}
;;{{{ --[ 32 (info "(emacs)Maintaining") Programs ]-------------------------
(message "32 Maintaining Programs...")
;;; ----[ 32.1 Change Logs
;; don't make a new entry, when the last entry was made by you and on the
;; same date
(setq add-log-always-start-new-record nil)
;; adds the file's version number to the change log entry
(setq change-log-version-info-enabled t)
;;; ----[ 32.2 Tags Tables
;; find the definition of the Emacs Lisp function or variable near point
(GNUEmacs
(find-function-setup-keys))
;;; ----[ 32.3 Merging Files with Emerge
;; merge file diffs under Emacs control
(try-require 'emerge)
(message "32 Maintaining Programs... Done")
;;}}}
;;{{{ --[ 33 (info "(emacs)Abbrevs") ]--------------------------------------
(message "33 Abbrevs...")
;;; ----[ 33.7 Customizing Dynamic Abbreviation
;; preserve case when expanding the abbreviation
(setq dabbrev-case-replace nil)
(message "33 Abbrevs... Done")
;;}}}
;;{{{ --[ 34 Editing (info "(emacs)Picture") ]------------------------------
(message "34 Editing Pictures...")
(message "34 Editing Pictures... Done")
;;}}}
;;{{{ --[ 35 (info "(emacs)Sending Mail") (with Gnus) ]---------------------
(message "35 Sending Mail...")
;; perform Caesar ciphers
(when (try-require 'rot13)
(defvar rot13-translate-table
(let ((str (make-string 127 0)) (i 0))
(while (< i 127)
(aset str i i) (setq i (1+ i)))
(setq i 0)
(while (< i 26)
(aset str (+ i ?a) (+ (% (+ i 13) 26) ?a))
(aset str (+ i ?A) (+ (% (+ i 13) 26) ?A))
(setq i (1+ i))) str)
"String table for rot 13 translation.")
(defun rot13-string (string)
"Return Rot13 encryption of STRING."
(with-temp-buffer
(insert string)
(rot13-region (point-min) (point-max))
(buffer-string)))
(defun rot13-region (start end)
"Rot13 encrypt the region between START and END in current buffer."
(interactive "r")
(translate-region start end rot13-translate-table))
;; full name of this user
(setq user-full-name "Fabrice Niessen")
;; full mailing address of this user
;; (used in MAIL envelope FROM, and to select the default personality ID)
(setq user-mail-address (rot13-string "sav@zvffvbapevgvpnyvg.pbz")))
(when (try-require 'gnus)
;; Gnus startup file name
(setq gnus-init-file "~/.gnus")
(global-set-key [(control f5)] 'gnus)
(setq mail-user-agent 'gnus-user-agent)
(XEmacs
(setq toolbar-mail-reader 'gnus)))
;;{{{ rs-info
;; to insert such link: (info "(message)Insertion Variables")
(when (try-require 'rs-info)
(autoload 'rs-info-insert-current-node "rs-info"
"Insert reference to current Info node using STYPE in buffer." t nil)
(autoload 'rs-info-boxquote "rs-info"
"Yank text (from an info node), box it and use current info node as title."
t nil)
(autoload 'rs-info-reload "rs-info" "Reload current info node." t nil)
(autoload 'rs-info-insert-node-for-variable "rs-info"
"Insert a custom style info node for the top level form at point." t nil)
(defalias 'boxquote-info 'rs-info-boxquote))
;;}}}
(message "35 Sending Mail... Done")
;;}}}
;;{{{ --[ 36 (info "(emacs)Rmail") Reading Mail (with Gnus) ]---------------
(message "36 Reading Mail with Gnus...")
(when (try-require 'gnus)
;; reading mail with Gnus
(setq read-mail-command 'gnus))
(message "36 Reading Mail with Gnus... Done")
;;}}}
;;{{{ --[ 37 (info "(emacs)Dired"), the Directory Editor ]------------------
(message "37 Dired, the Directory Editor...")
;; directory-browsing commands
(require 'dired)
;; ;; switches passed to `ls' for dired
;; (setq dired-listing-switches "-alt --time-style=long-iso")
;; enable the use of the command `dired-find-alternate-file'
;; without confirmation
(put 'dired-find-alternate-file 'disabled nil)
;; recursive deletes allowed, after asking for each directory at top level
(setq dired-recursive-deletes 'top)
;; copy recursively without asking
(setq dired-recursive-copies 'always)
;;{{{ limit each dired buffer to 1 buffer instead of opening a million buffers
(defun dired-follow-file ()
"In dired, visit the file or directory on this line.
If a directory is on the current line, replace the current
dired buffer with one containing the contents of the directory.
Otherwise, invoke `dired-find-file' on the file."
(interactive)
(let ((filename (dired-get-filename)))
;; if the file is a directory, replace the buffer with the
;; directory's contents
(if (file-directory-p filename)
(find-alternate-file filename)
;; otherwise simply perform a normal `dired-find-file'
(dired-find-file))))
(add-hook 'dired-mode-hook
'(lambda ()
(local-set-key [(control m)] 'dired-follow-file)
(local-set-key [(e)] 'dired-follow-file)
(local-set-key [(f)] 'dired-follow-file)))
;;}}}
(add-hook 'dired-mode-hook
'(lambda ()
(try-require 'dired-x)
(define-key dired-mode-map [(V)] 'cvs-examine)
(turn-on-font-lock)))
(try-require 'dired-x)
;; C-x C-j runs the command dired-jump
;; Jump to dired buffer corresponding to current buffer.
;; If in a file, dired the current directory and move to file's line.
;; If in Dired already, pop up a level and goto old directory's line.
;; Subject: Re: Mouse selection in dired
;; > > just like <return> does in dired. Right now it opens a new window, so
;; > > I'm constantly doing a C-x-1 which gets old real fast.
;; > >
;; > > Is there a command I can add to my .emacs file for this?
;; >
;; > (add-hook 'dired-mode-hook
;; > (lambda ()
;; > (local-set-key [mouse-2] 'dired-advertised-find-file)))
;;; ----[ 37.15 Dired and `find'
;; search for files with names matching a wild card pattern and dired the
;; output
(global-set-key [(control c) ?1] 'find-name-dired)
;; search for files with contents matching a wild card pattern and dired the
;; output
(global-set-key [(control c) ?2] 'find-grep-dired)
;; run grep via find, with user-specified arguments
(global-set-key [(control c) ?3] 'grep-find)
;;; ----[ Add-Ons
;; dired stuff to open files a la Windows (from Howard Melman):
;; execute file using windows associations
(GNUEmacs (when running-ms-windows
(defun dired-is-dir()
(file-directory-p (dired-get-filename)))
(defun dired-execute-file (&optional arg)
(interactive "P")
(mapcar #'(lambda (file)
(w32-shell-execute "open" (convert-standard-filename file)))
(dired-get-marked-files nil arg)))
(defun dired-mouse-execute-file (event)
"In dired, execute the file or goto directory name you click on."
(interactive "e")
(set-buffer (window-buffer (posn-window (event-end event))))
(goto-char (posn-point (event-end event)))
(if (dired-is-dir)
(dired-find-file)
(dired-execute-file)))
(global-set-key [?\C-x mouse-2] 'dired-mouse-execute-file)
(defun hrm-dired-mode-hook ()
"Hook run when entering dired-mode."
(define-key dired-mode-map [(X)] 'dired-execute-file)
(define-key dired-mode-map [M-down-mouse-1] 'dired-mouse-execute-file))
(add-hook 'dired-mode-hook 'hrm-dired-mode-hook)))
;;{{{ dired-find-w3m
;; add a binding "w" -> `dired-find-w3m' to dired
(defun dired-find-w3m () (interactive)
"In dired, visit (with find-w3m) the file named on this line."
(w3m-find-file (file-name-sans-versions (dired-get-filename) t)))
(eval-after-load "dired"
'(progn (define-key dired-mode-map "w" 'dired-find-w3m)))
;;}}}
;; On top of the traditional ways, there's also an add-on called Extview
;; which opens files using outside programs, such as XPDF, based on their
;; extension. It does this both from Dired and with `find-file'. One
;; advantage is that using the traditional ! switch with dired locks up
;; Emacs until you close the other program. Extview does not and leaves
;; Emacs free for continued used.
;; If you need to open a file in Emacs that has an extension that Extview
;; will open in another viewer, like HTML, you use `find-file-literally' to
;; open it in Emacs.
(try-require 'extview)
;;;;;;; problem with Emacs 22
;;;;;;;(try-require 'dired+)
;; sort directories first in any ordering
(when (try-require 'ls-lisp)
(setq ls-lisp-dirs-first t))
;; emulate famos ms-dog file browser (norton commander)
(GNUEmacs
(autoload 'nc "nc" "Emulate MS-DOG file shell" t))
;; See news "Opening html-File in Dired with w3m" for extra info
;;{{{ dircolors
;; provide the same facility of ls --color inside Emacs
(try-require 'dircolors)
;;}}}
;;{{{ (info "(emacs-goodies-el)wdired") - Rename files editing their names in dired buffers
;; wdired mode lets you treat a directory listing like a text file and edit
;; it at will. Great when you have a lot of filenames to modify (just
;; search-and-replace!)
;; It's great for renaming files in a directory, as it allows editing the
;; dired buffer using all the power of Emacs. That is, one can use keyboard
;; macros, search and replace, rectangle mode (great for adding prefixes to
;; file names), flip mode bits with the mouse,etc.
;; (when (try-require 'wdired)
;; (autoload 'wdired-change-to-wdired-mode "wdired")
;; (add-hook 'dired-load-hook
;; '(lambda ()
;; (define-key dired-mode-map "r" 'wdired-change-to-wdired-mode)
;; (define-key dired-mode-map
;; [menu-bar immediate wdired-change-to-wdired-mode]
;; '("Edit File Names" . wdired-change-to-wdired-mode)))))
;;}}}
;; file-props.el --- Add tags to your files
(message "37 Dired, the Directory Editor... Done")
;;}}}
;;{{{ --[ 38 The (info "(emacs)Calendar/Diary") ]---------------------------
(message "38 The Calendar and the Diary...")
;;; ----[ 38.1 Movement in the Calendar
;; interpret the date 1/2/1990 as February 1, 1990
(setq european-calendar-style t) ; before using any calendar or diary command
;; week in the calendar begins on Monday
(setq calendar-week-start-day 1)
;; mark all visible dates that have diary entries
(setq mark-diary-entries-in-calendar t)
;; (add-hook 'initial-calendar-window-hook 'mark-diary-entries)
;; marks the current date, by changing its face
(add-hook 'today-visible-calendar-hook 'calendar-mark-today)
;; fix foolish calendar-mode scrolling
(add-hook 'calendar-load-hook
'(lambda ()
(setq mark-holidays-in-calendar t)
(define-key calendar-mode-map [(>)] 'scroll-calendar-left)
(define-key calendar-mode-map [(<)] 'scroll-calendar-right)
(define-key calendar-mode-map [(control x) (>)]
'scroll-calendar-left)
(define-key calendar-mode-map [(control x) (<)]
'scroll-calendar-right)))
;; bind calendar to C-c c
(global-set-key [(control c) (c)] 'calendar)
;;; ----[ 38.6 Holidays
;; remove some holidays
(setq general-holidays nil) ; get rid of too U.S.-centric holidays
(setq hebrew-holidays nil) ; get rid of religious holidays
(setq islamic-holidays nil) ; get rid of religious holidays
(setq oriental-holidays nil)
;; add Belgian holidays
(setq local-holidays
'(
(holiday-fixed 01 01 "New Year's Day")
(holiday-fixed 02 14 "Valentine's Day")
(holiday-fixed 04 01 "April Fools' Day")
(holiday-fixed 05 01 "Labor Day")
(holiday-fixed 07 21 "Independence Day")
(holiday-fixed 08 15 "Assumption")
(holiday-fixed 10 31 "Halloween")
(holiday-fixed 11 01 "Toussaint")
(holiday-fixed 11 11 "Armistice 1918")
(holiday-fixed 12 25 "Christmas")
;; holidays with variable dates
(holiday-float 5 0 2 "Mother's Day")
(holiday-float 6 0 3 "Father's Day")))
;; (easter-monday)
;; mark dates of holidays in the calendar
(setq mark-holidays-in-calendar t)
;;; ----[ 38.7 Times of Sunrise and Sunset
(setq calendar-latitude [50 88 north])
(setq calendar-longitude [4 71 east])
(setq calendar-location-name "Leuven, BE")
;; (setq calendar-latitude [43 41 north])
;; (setq calendar-longitude [6 81 east])
;; (setq calendar-location-name "Boulouris, FR")
;;; ----[ 38.10 The Diary
(when (try-require 'diary-lib)
;; copy the diary entries into a special buffer
(add-hook 'diary-display-hook 'fancy-diary-display)
;; sort each day's diary entries by their time of day ???
(add-hook 'diary-display-hook 'sort-diary-entries)
(add-hook 'list-diary-entries-hook 'sort-diary-entries t)
;; allow #includes in ~/diary
(add-hook 'list-diary-entries-hook 'include-other-diary-files)
;; desk calendar style extensions to Emacs' Calendar/Diary
(when (try-require 'cal-desk-calendar)
(add-hook 'diary-display-hook 'fancy-schedule-display-desk-calendar t))
;; generate the diary window for 4 days starting with the current date
(diary 4)
;; snarf MS Outlook appointments into Emacs diary
(try-require 'diary-outlook) ;; DOES NOT WORK?
;; How do you arrange the entries of diary? Can they be automatically
;; arranged according to date and not just according to when they were
;; entered into the diary?
)
;;; ----[ 38.11 Appointments
;; enable appointment notification, several minutes beforehand
(add-hook 'diary-hook 'appt-make-list)
;;; ----[ 38.14 Summing Time Intervals
;; if you want to log your daily schedules for review, you need schedule.el
;; and timeclock.el to record your daily works
;; timeclock.el
(when (try-require 'timeclock)
(setq timeclock-file "~/.timeclock/default.log")
(global-set-key [(control x) (t) (i)] 'timeclock-in)
(global-set-key [(control x) (t) (o)] 'timeclock-out)
(global-set-key [(control x) (t) (c)] 'timeclock-change)
(if (try-require 'timeclock-x)
(progn
;; bind interactive timeclock functions to a "C-x t-" prefix
(timeclock-setup-keys)
;; ask if the user wants to clock out before exiting Emacs
(add-hook 'kill-emacs-query-functions 'timeclock-query-out)
;; ask the user if they wish to clock in
(timeclock-query-in))
;; clock in, recording the current time moment in the timelog
(timeclock-in))
;; display of the amount of time left today in the mode line
(timeclock-modeline-display 1))
;; Tracker. This mode keeps a list of projects and associated billing
;; entity. A single project can be selected and it will be marked in a file
;; as active until a new command is made to stop it. A project is
;; automatically terminated when Emacs exits. If somehow this fails, the
;; tracking data file is touched at regular intervals, so the next time the
;; tracker is started if there is an open project a reasonable guess can be
;; made as to when to mark it as closed. Each session can have multiple
;; comments associated with it, in which you can mark accomplishments or
;; whatever. It will generate informal daily summary reports and a report of
;; total hours for a particular billee.
;;; ----[ Add-Ons
;; Getting Things Done
;;{{{ (info "(org)Top") Mode
;; After all the configuration has been done, you can easily manage your
;; daily work and tasks with org-mode.
;; Press `C-c a a' to jump you to this week's task page from anywhere.
;; Use "M-x planner-create-task-from-buffer" to link buffers to your daily
;; planner files. Soon you'll find that your daily work files are
;; conveniently linked together in daily tasks. Just use it to improve your
;; efficiency.
;; Comme planner, org-mode peut s'intégrer/interfacer avec d'autres
;; modes comme bbdb, remember, gnus, vm, calendar, diary et planner
;;
;; Le gros avantage par rapport à planner ? Il fait parti depuis
;; quelques temps déjà de la distribution standard GNU Emacs (pas
;; besoin donc de l'installer à part). Son second point fort est la
;; facilité d'utilisation. C'est vraiment très simple à prendre en
;; main et la documentation permet de vite s'y retrouver en cas de
;; pépin.
;;
;; Une des raisons de la complexité de Planner provient du fait que planner
;; est étroitement associé à emacs-wiki, et que emacs-wiki a basculé vers
;; muse.
(when (try-require 'org)
(add-to-list 'auto-mode-alist '("\\.org$" . org-mode))
(define-key global-map [(control c) (l)] 'org-store-link)
(define-key global-map [(control c) (a)] 'org-agenda)
;;{{{ 2 (info "(org)Document Structure")
;; don't switch to OVERVIEW at startup
(setq org-startup-folded nil)
;;}}}
;;{{{ 5 (info "(org)Hyperlinks")
;; directory with org files (used by the hooks for remember.el)
(setq org-directory "~/Notes/")
;; remember
(when (try-require 'remember)
(define-key global-map [(control c) (r)] 'remember)
(setq org-default-notes-file "~/Notes/Remember.org")
(autoload 'org-remember-annotation "org")
(autoload 'org-remember-handler "org")
(setq remember-annotation-functions '(org-remember-annotation))
(setq remember-handler-functions '(org-remember-handler)))
;;}}}
;;{{{ 6 (info "(org)Timestamps")
;; insert a special time stamp each time a TODO entry is marked done
(setq org-log-done t)
;;}}}
;;{{{ 7 Timeline and (info "(org)Agenda Views")
;; set which files to search for TODOs and scheduled items
;; (avoiding hidden files)
(setq org-agenda-files (directory-files "~/Notes" t "^[^\\.].*\\.org$"))
;; include entries from the Emacs diary into Org-mode's agenda
(setq org-agenda-include-diary t)
;; generate the agenda buffer for this week
(org-agenda-list)
(delete-other-windows))
;;}}}
;; timeclock integration for the Emacs OrgMode
(when (try-require 'org-timeclock)
(global-set-key [(shift f4)] 'org-timeclock-in)
(global-set-key [(shift f5)] 'org-timeclock-out))
;; open my work org file
(defun my-open-org-work ()
"Opening ~/Notes/Work.org"
(interactive)
(find-file "~/Notes/Work.org"))
(global-set-key [(shift f2)] 'my-open-org-work)
;; open my home org file
(defun my-open-org-home ()
"Opening ~/Notes/Home.org"
(interactive)
(find-file "~/Notes/Home.org"))
(global-set-key [(control f2)] 'my-open-org-home)
;;}}}
;;{{{ Muse
;; http://www.xshi.org/notes/WebPage.html
(when (try-require 'muse) ; load generic module
(try-require 'muse-mode) ; load authoring mode
(try-require 'muse-html) ; load (X)HTML publishing style
(try-require 'muse-latex) ; load LaTeX/PDF publishing styles
(try-require 'muse-texinfo) ; load Info publishing style
(try-require 'muse-docbook) ; load DocBook publishing style
;; initialize
(try-require 'outline) ; I like outline-style faces
(try-require 'muse-colors) ; load coloring/font-lock module
(try-require 'muse-blosxom) ; load blosxom module
(try-require 'muse-wiki) ; load Wiki support
(try-require 'muse-xml) ; load XML support
;; listing of all directories that should be published with muse
;; (customize your directory, head and foot files, etc.)
(setq muse-project-alist
`(
("Home"
("~/Personal/website/source/front/" :default "index")
(:base "xhtml"
:path "~/Personal/website/public_html/"
;; :header "~/Personal/website/source/front/header.html"
:footer "~/Personal/website/source/front/footer.html"))
)))
(setq base-dir "")
(setq server "www.mygooglest.com")
(defun muse-xhtml-menu (items)
;; was using menu, menuhead, menubody and menuitem div classes
(concat "<ul id=\"menu\">Website sections"
(mapconcat (function (lambda (x) (concat "<li>\n"
(cadr (cdr x))
"<a href=\"http://"
server
(cadr x)
"\">\n"
(car x)
"</a>"
"</li>")))
items
"\n"
)
"</ul>"))
(setq muse-project-menu-list
`(("Home" ,(concat base-dir "/blog/index.html") "")
("Projects" ,(concat base-dir "/projects/index.html") "")
("Personal Wiki" ,(concat base-dir "/wiki/index.html") "")
("Private" ,(concat base-dir "/tools/private.html") "")
("Contact me" ,(concat base-dir "/blog/contact") "")))
(defun muse-publish-content ()
(let ((depths (muse-publishing-directive "contentdepth")))
(when depths
(let ((depth (string-to-number depths)))
(when (not (eq depth 0))
(insert "<td class='contents'><div class='contenthead'>
Table of contents</div><div class='contentbody'>")
(set (make-local-variable 'muse-publish-generate-contents)
(cons (copy-marker (point) t) depth))
(forward-char)
(insert "</div></td>"))))))
(setq muse-xhtml-header ;; was xhtml
"
<lisp>muse-xhtml-doctype</lisp>
<html xmlns=\"http://www.w3.org/1999/xhtml\">
<lisp>muse-xhtml-head</lisp>
<body>
<div id=\"header\">
<h1>
<lisp>muse-xhtml-headline</lisp>
</h1>
</div>
<table id=\"body\"><tr>
<td id=\"left\">
<lisp>(muse-xhtml-menu muse-project-menu-list)</lisp>
</td>
<td id=\"content\">
<table class=\"headline\">
<tr class=\"headline\">
<td class=\"leftheadline\">
<div class=\"info\">
<div class=\"title\">
<lisp>(muse-publishing-directive \"title\")</lisp>
</div>
<div class=\"lastchange\">
Last changed: <lisp>(muse-publishing-directive \"lastchange\")</lisp>
</div>
<div class=\"about\">
<strong>Content:</strong><br /><hr />
<lisp>(muse-publishing-directive \"about\")</lisp>
</div>
<div class=\"backto\">
<lisp>(muse-publish-backto \"backlink\" base-dir)</lisp>
</div>
</div>
</td>
<lisp>(muse-publish-content)</lisp>
</tr>
</table>
<!-- Page -->\n
")
(setq muse-xhtml-doctype
"<?xml version=\"1.0 encoding=\"<lisp>(muse-html-encoding)</lisp> \"?>
<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\"
\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">")
(setq muse-html-style-sheet
(concat "<link rel=\"stylesheet\" type=\"text/css\" charset=\"utf-8\" media=\"all\" href=\""
base-dir
"css/common.css\"/>"))
(setq muse-xhtml-head
" <head>
<title><lisp>(muse-publishing-directive \"title\")</lisp></title>
<meta name=\"generator\" content=\"muse.el\" />
<meta http-equiv=\"<lisp>muse-html-meta-http-equiv</lisp>\"
content=\"<lisp>muse-html-meta-content-type</lisp>\" />
<lisp>
(let ((maintainer (muse-style-element :maintainer)))
(when maintainer
(concat \"<link rev=\\\"made\\\" href=\\\"\" maintainer \"\\\" />\")))
</lisp>
<lisp>muse-html-style-sheet</lisp>
</head>")
(defun muse-publish-backto (class base-dir)
(let ((backto (muse-publishing-directive "backto")))
(when backto
(let ((primary (split-string backto ","))
backlink)
(dolist
(secondary primary backlink)
(setq tmp (split-string secondary "|"))
(setq backlink
(concat backlink (concat "<div class='"
class
"'><img src='"
base-dir
"/base/images/list_item.gif' /> Back to <a href="
(pop tmp)
".html>"
(pop tmp)
"</a></div>"))))
backlink))))
(setq muse-xhtml-headline "Fabrice Niessen")
;;}}}
(message "38 The Calendar and the Diary... Done")
;;}}}
;;{{{ --[ 39 (info "(emacs)Gnus") ]-----------------------------------------
(message "39 Gnus...")
;;; ----[ Insidious (info "(bbdb)Top")
(when (try-require 'bbdb)
;; avoid BBDB getting confused by 8 bit characters
(add-to-list 'file-coding-system-alist
'("\\.bbdb\\'" iso-latin-9 . iso-latin-9))
;; since BBDB 2.35
(setq bbdb-file-coding-system 'iso-latin-9)
;;{{{ (info "(bbdb)Installation")
;; enable the various package-specific BBDB functions
(bbdb-initialize 'gnus 'message)
;; add bindings for the default keys to Gnus and configure Gnus to
;; notify the BBDB when new messages are loaded (required if the BBDB is
;; to be able to display BBDB entries for messages displayed in Gnus)
(add-hook 'gnus-startup-hook 'bbdb-insinuate-gnus)
;; add a binding for M-TAB to Message mode
;; this will enable completion of addresses based on BBDB records
(add-hook 'gnus-startup-hook 'bbdb-insinuate-message)
;; customizable completion in message headers
;; (to avoid conflict between flyspell and BBDB)
(try-require 'message-x)
;;}}}
;;{{{ (info "(bbdb)Interfaces")
;; mail aliases (local mailing lists)
(add-hook 'message-setup-hook 'bbdb-define-all-aliases)
;; always use full name when sending mail
;; (even if User Name has an address of the form <user.name@somedomain>)
(setq bbdb-dwim-net-address-allow-redundancy t)
;; no popup on auto-complete
(setq bbdb-completion-display-record nil)
;; completion is done across the set of all full-names and user-ids
(setq bbdb-completion-type nil)
;;}}}
;;{{{ (info "(bbdb)Reader-specific Features")
;; marking posters with records in the BBDB
(setq bbdb/gnus-summary-mark-known-posters t)
;; mark authors in the Summary Buffer who have records in the BBDB
(setq bbdb/gnus-summary-known-poster-mark "B")
;; display the poster's name from the BBDB if we have one
(setq bbdb/gnus-summary-prefer-real-names t)
;; replace the information provided in the From header with data from
;; the BBDB if we have one
(setq bbdb/gnus-summary-prefer-bbdb-data t)
(setq bbdb/gnus-summary-show-bbdb-names t)
;;}}}
;;{{{ (info "(bbdb)Options")Options
;; name of the file which contains your personal database
(setq bbdb-file "~/.bbdb")
;; no default area code to use when prompting for a new phone number
(setq bbdb-default-area-code nil)
;; default country to use if none is specified
(setq bbdb-default-country "")
;; disable syntax-checking of telephone numbers
(setq bbdb-north-american-phone-numbers-p nil)
;; restoration of the window configuration
(setq bbdb-electric-p t)
;; ;; to add the author of a mail or posting to the BBDB, hit `:'
;; (setq bbdb/mail-auto-create-p t)
;; don't display a continuously-updating BBDB window while in GNUS
;; (setq bbdb-use-pop-up nil)
;; desired number of lines in a GNUS pop-up BBDB window
(setq bbdb-pop-up-target-lines 1)
;; default display layout
(setq bbdb-display-layout 'multi-line)
;; default display layout pop-up BBDB buffers
(setq bbdb-pop-up-display-layout 'one-line)
;; omit creation-date and timestamp from BBDB display
(setq bbdb-display-layout-alist
'((one-line (order . (phones notes))
(name-end . 24)
(toggle . t)
(omit . (net AKA mail-alias gnus-private
creation-date timestamp)))
(multi-line (indention . 14)
(toggle . t)
(omit . (AKA creation-date timestamp)))
(pop-up-multi-line (indention . 14))))
;; allow cycling of email addresses while completing them
(setq bbdb-complete-name-allow-cycling t)
;; save the database without asking (any time it would ask)
(setq bbdb-offer-save 'auto)
;; automatically add some text to the notes field of the BBDB record
(add-hook 'bbdb-notice-hook 'bbdb-auto-notes-hook)
;; capture auto-notes
(setq bbdb-auto-notes-alist
;; organization
`(("Organization" (".*" Organization 0))
;; mailer
("User-Agent" (".*" mailer 0 t)) ;; t = overwrite
("X-Mailer" (".*" mailer 0 t))
("X-Newsreader" (".*" mailer 0 t))
;; X-Face bitmaps of the people
("x-face" ,(list (concat "[ \t\n]*\\([^ \t\n]*\\)"
"\\([ \t\n]+\\([^ \t\n]+\\)\\)?"
"\\([ \t\n]+\\([^ \t\n]+\\)\\)?"
"\\([ \t\n]+\\([^ \t\n]+\\)\\)?")
'face
"\\1\\3\\5\\7"))))
;;}}}
;;{{{ (info "(bbdb)Utilities")
;; search the bbdb
(global-set-key [(control f11)] 'bbdb)
;; search the bbdb by regexp
(when (try-require 'bbdb-query)
(global-set-key [(control f11)] 'bbdb-query))
;; use BBDB to store PGP preferences
(when (try-require 'bbdb-pgp)
;; what to do if the recipient is not in the BBDB
(setq bbdb/pgp-default-action nil)))
;;}}}
(message "39 Gnus... Done")
;;}}}
;;{{{ --[ 40 Running (info "(emacs)Shell") Commands from Emacs ]------------
(message "40 Running Shell Commands from Emacs...")
;; > I was wondering if it is possible to run a bash shell inside an Emacs
;; > buffer (where the up and down keys recall commands executed
;; > in .bash_history and do not move the cursor around -- the problem with the
;; > native shell available in Emacs, tab results in command completion, etc.).
;; (term "/bin/bash") does this.
;; If you do `M-x term' /bin/bash is offered as the default as well.
;; You're debugging bash code? I normally use mode-compile.el for
;; this. Basically, it runs bash with lots of debug output.
;; See w32-settings.el for more!
;; M-s comint-next-matching-input
;; M-r comint-previous-matching-input
;; M-n comint-next-input
;; M-p comint-previous-input
;; C-up last command
;; coding system to use for a process I/O operation (end-of-line handling)
(setq process-coding-system-alist
(cons '("bash" . (raw-text-dos . raw-text-unix))
process-coding-system-alist))
;; (setq process-coding-system-alist '(("bash" . undecided-unix))) ???
;; quote process arguments to ensure correct parsing on Windows
(setq w32-quote-process-args t) ;; if needed, set it to `?\"'
;; for single shell commands
(setq shell-file-name "bash") ;; must be in the PATH
;; use `shell-file-name' as the default shell
(setenv "SHELL" shell-file-name)
;; name of shell used to parse TeX commands
(GNUEmacs
(setq TeX-shell shell-file-name))
(XEmacs
;; for the preview-latex package
(setq TeX-shell "C:/Program Files/Emacs/emacs/bin/cmdproxy.exe"))
;; switch used to have the shell execute its command line argument
;; ("/c" does not work with XEmacs)
(setq shell-command-switch "-c")
;; shell argument indicating that next argument is the command
(setq TeX-shell-command-option shell-command-switch)
;; for the interactive (sub)shell
(setq explicit-shell-file-name shell-file-name)
;; regexp to match prompts in the inferior shell
(setq shell-prompt-pattern (concat "^" (system-name) " [^ ]+ \\[[0-9]+\\] "))
;; general command interpreter in a window stuff
(when (require 'comint)
;; don't add input matching the last on the input ring
(setq-default comint-input-ignoredups t)
;; input to interpreter causes (only) the selected window to scroll
(setq-default comint-scroll-to-bottom-on-input "this")
;; output to interpreter causes (only) the selected window to scroll
(setq-default comint-scroll-to-bottom-on-output "this")
;; show the maximum output when the window is scrolled
(setq-default comint-scroll-show-maximum-output t)
;; ignore short commands as well as duplicates
(setq-default comint-input-filter
(function
(lambda (str)
(and (not (string-match "\\`\\s *\\'" str))
(> (length str) comint-min-history-size)))))
;; functions to call after output is inserted into the buffer
(setq-default comint-output-filter-functions
'(comint-postoutput-scroll-to-bottom))
;; go to the end of buffer
;; get rid of the control-M characters
(add-hook 'comint-output-filter-functions 'comint-strip-ctrl-m)
;; prompt in the minibuffer for password and send without echoing
;; (for example, with `su' command)
(add-hook 'comint-output-filter-functions 'comint-watch-for-password-prompt))
;; translate ANSI escape sequences into faces
(GNUEmacs
(autoload 'ansi-color-for-comint-mode-on "ansi-color" nil t)
(add-hook 'shell-mode-hook 'ansi-color-for-comint-mode-on))
;; buffer-specific colors
;; seems incompatible with the escape codes translation
(XEmacs
(add-hook 'shell-mode-hook
'(lambda () (interactive)
(set-face-background 'default "black" (current-buffer))
(set-face-foreground 'default "green" (current-buffer)))))
;; run a telnet session from within an Emacs buffer
(when (try-require 'telnet)
;; program to run to open a telnet connection
;; simple public domain telnet client for Windows console (from Igor
;; Milavec)
(setq telnet-program
(if running-ms-windows
(concat other-site-lisp-directory "../bin/telnet.exe")
"/usr/bin/telnet"))
;; open a network login connection to a host
(defun telnet (host)
"Open a network login connection to host named HOST (a string).
Communication with HOST is recorded in a buffer `*telnet-HOST*'.
Normally input is edited in Emacs and sent a line at a time."
(interactive "sOpen telnet connection to host: ")
(let* ((comint-delimiter-argument-list '(?\ ?\t))
(name (concat "telnet-" (comint-arguments host 0 nil) ))
(buffer (get-buffer (concat "*" name "*")))
process)
(cond ((string-equal system-type "windows-nt")
(setq telnet-new-line "\n")))
(if (and buffer (get-buffer-process buffer))
(pop-to-buffer (concat "*" name "*"))
(pop-to-buffer (make-comint name telnet-program nil host))
(setq process (get-buffer-process (current-buffer)))
(set-process-filter process 'telnet-initial-filter)
(accept-process-output process)
(telnet-mode)
(setq comint-input-sender 'telnet-simple-send)
(setq telnet-count telnet-initial-count)))))
;; run an inferior shell, with I/O through buffer *shell*
(global-set-key [(control !)] 'shell)
(when (try-require 'multishell)
(global-set-key [(control !)] 'multishell))
(when (try-require 'cygwin-mount)
(cygwin-mount-activate))
(message "40 Running Shell Commands from Emacs... Done")
;;}}}
;;{{{ --[ 41 Using (info "(emacs)Emacs Server") ]--------------------------
(message "41 Using Emacs as a Server...")
;; use Emacs as a server
;; on GNU/Linux, you should use server-start/emacsclient
;; Emacsclient is now as well available under EmacsW32
(server-start)
;; This is a shell function I use to manually start an edit server.
;; It has to be run only once, and survives between logins.
;;
;; function startxemacs {
;; (cd ~/ #put nohup.out file in home directory
;; nohup /usr/local/bin/xemacs -l ~/.semacs \
;; -unmapped -g 100x30+60+60 \
;; -T "GNUserver" 2>/dev/null &)
;; }
;;
;; The above uses a special init file, ~/.semacs, which starts up the
;; gnuserv process. It looks like this,
;;
;; ;; for GNU Emacs only
;; (unless (featurep 'xemacs)
;; (setq gnuserv-frame (current-frame)))
;;
;; (gnuserv-start) ;Start up the gnu edit server process
;;
;; ;; disallow exiting from a command (menu option only)
;; (defun do-exit ()
;; "Exits Emacs or an Emacs client"
;; (interactive)
;; (if (gnuserv-running-p)
;; (if (eq gnuserv-clients nil) (delete-frame) (gnuserv-edit))))
;;
;; (define-key ctl-x-map "\C-c" 'do-exit)
;;
;; ;; end of file
;;
;; There are of course times when the edit server is *not* what you
;; want to run. You can run (X)Emacs as a non server process too.
;; I keep two of those running all the time on my workstation. One
;; essentially works as a "notepad" that I have open all the time;
;; it is "sticky" and shows up in any virtual desktop that I move
;; to. The other is full screen in one desktop, and run /gnus/ for
;; Usenet an email. (It has so many buffers open that I want to
;; keep it entirely separate from the edit server.)
;;
;; Floyd L. Davidson <http://www.apaflo.com/floyd_davidson>
;; To associate file types with Emacs, go back to the File Types window
;; and edit a suitable association. Under Actions, put:
;; gnuclientw.exe "%1"
;; Look at GNU_SECURE
;; > I'd like to be able to reconnect to the running Emacs process and have
;; > it display on my X server at home. Is this possible?
;;
;; In the X11 forwarded ssh shell:
;;
;; $ emacsclient -e "(make-frame-on-display \"$DISPLAY\")"
;;
;; Of course you should have started the Emacs server with (server-start)
(message "41 Using Emacs as a Server... Done")
;;}}}
;;{{{ --[ 42 (info "(emacs)Hardcopy") Output ]------------------------------
(message "42 Hardcopy Output...")
;; print Emacs buffer on line printer
;; for {lpr,print}-{buffer,region}
(when (try-require 'lpr)
;; name of program for printing a file
(setq lpr-command "enscript")
;; list of strings to pass as extra options for the printer program
(setq lpr-switches (list "--font=Courier8"
"--header-font=Courier10"
(format "--header=%s" (buffer-name))))
;; name of a printer to which data is sent for printing
(setq printer-name
(if running-ms-windows
"//NETFINITY/C510_APS"
t)))
(message "42 Hardcopy Output... Done")
;;}}}
;;{{{ --[ 43 (info "(emacs)PostScript") Hardcopy ]--------------------------
(message "43 PostScript Hardcopy...")
;; print text from the buffer as PostScript
(when (try-require 'ps-print)
(let ((gsprint-program "C:/Program Files/Ghostgum/gsview/gsprint.exe"))
(my-file-executable-p gsprint-program)
(if (and gsprint-program
(file-executable-p gsprint-program))
(progn
;; name of a local printer for printing PostScript files
;; adjusted to run Ghostscript
(setq ps-printer-name t)
;; name of program for printing a PostScript file
;; tell Emacs where ghostscript print utility is located
(setq ps-lpr-command gsprint-program)
;; list of extra switches to pass to `ps-lpr-command'
;; tell Ghostscript to query which printer to use
(setq ps-lpr-switches '("-query")))
(progn
(setq ps-printer-name "//NETFINITY/LexmarkC510")
(setq ps-lpr-command "")
(setq ps-lpr-switches '("raw"))))
;; size of paper to format for
(setq ps-paper-type 'a4)
;; print in portrait mode
(setq ps-landscape-mode nil)
;; number of columns
(setq ps-number-of-columns 1)))
;; generate and print a PostScript image of the buffer
(GNUEmacs
(when running-ms-windows
(w32-register-hot-key [snapshot]) ; override `Print Screen' globally used
; as a hotkey by Windows
(global-set-key [(snapshot)] 'ps-print-buffer-with-faces)))
(XEmacs
(setq toolbar-print-function 'ps-print-buffer-with-faces))
(global-set-key [(meta p)] 'ps-print-buffer-with-faces)
;; ???
(add-hook 'Info-mode-hook 'ps-info-mode-hook)
(message "43 PostScript Hardcopy... Done")
;;}}}
;;{{{ --[ 44 (info "(emacs)PostScript Variables") for Hardcopy ]-----------
(message "44 Variables for PostScript Hardcopy...")
(message "44 Variables for PostScript Hardcopy... Done")
;;}}}
;;{{{ --[ 45 (info "(emacs)Sorting") Text ]---------------------------------
(message "45 Sorting Text...")
;; key binding
(global-set-key [(meta \#)] 'sort-lines)
(message "45 Sorting Text... Done")
;;}}}
;;{{{ --[ 46 (info "(emacs)Narrowing") ]------------------------------------
(message "46 Narrowing...")
;; enable the use of the command `narrow-to-region' without confirmation
(put 'narrow-to-region 'disabled nil)
(message "46 Narrowing... Done")
;;}}}
;;{{{ --[ 47 (info "(emacs)Two-Column") Editing ]---------------------------
(message "47 Two-Column Editing...")
(message "47 Two-Column Editing... Done")
;;}}}
;;{{{ --[ 48 (info "(emacs)Editing Binary Files") ]-------------------------
(message "48 Editing Binary Files...")
(message "48 Editing Binary Files... Done")
;;}}}
;;{{{ --[ 49 (info "(emacs)Saving Emacs Sessions") ]------------------------
(message "49 Saving Emacs Sessions...")
(message "49 Saving Emacs Sessions... Done")
;;}}}
;;{{{ --[ 50 (info "(emacs)Recursive Edit")ing Levels ]---------------------
(message "50 Recursive Editing Levels...")
(message "50 Recursive Editing Levels... Done")
;;}}}
;;{{{ --[ 51 (info "(emacs)Emulation") ]------------------------------------
(message "51 Emulation...")
(message "51 Emulation... Done")
;;}}}
;;{{{ --[ 52 (info "(emacs)Hyperlinking") and Navigation Features ]---------
(message "52 Hyperlinking and Navigation Features...")
;; I use an excellent package called webjump to store my bookmarks. It
;; also has provisions for generating search strings for the search sites
;; as well.
;;{{{ HTML Tidy
(autoload 'tidy-buffer "tidy" "Run Tidy HTML parser on current buffer" t)
(autoload 'tidy-parse-config-file "tidy" "Parse the `tidy-config-file'" t)
(autoload 'tidy-save-settings "tidy" "Save settings to `tidy-config-file'" t)
(autoload 'tidy-build-menu "tidy" "Install an options menu for HTML Tidy." t)
;; For other modes (like html-helper-mode) simple change the variables
;; `html-mode-hook' and `html-mode-map' to whatever is appropriate e.g.
(defun my-html-helper-mode-setup ()
"Customize my html-helper-mode."
(tidy-build-menu html-helper-mode-map)
(local-set-key [(control c) (control c)] 'tidy-buffer)
(setq sgml-validate-command "tidy"))
(add-hook 'html-helper-mode-hook 'my-html-helper-mode-setup)
;;}}}
;;{{{ pass a URL to a WWW browser
;; display the current buffer in the default Windows WWW browser
(require 'browse-url)
(autoload 'browse-url-at-mouse "browse-url")
;; default browser started when you click on some URL in the buffer
(if window-system
(if running-ms-windows
(setq browse-url-browser-function 'browse-url-default-windows-browser)
(setq browse-url-browser-function 'browse-url-generic
browse-url-generic-program (executable-find "firefox")))
(setq browse-url-browser-function 'w3m-browse-url))
;; (setq browse-url-browser-function
;; '(("file:///usr/share/doc/hyperspec/" . w3m-browse-url)
;; ("emacswiki.org" . w3m-browse-url)
;; ("lispdoc.com" . w3m-browse-url)
;; ( "." . browse-url-firefox)))
;; that let me use w3m for emacswiki/common lisp documentation and
;; Firefox otherwise.
;;}}}
;;{{{ w3m
;; w3m is a terrific text-based web and file browser
;; (for win32, use the Cygwin version of the executable)
(setq w3m-command (executable-find "w3m"))
;; (my-file-executable-p w3m-command)
;; SHOULD trap when w3m-command is nil
(when (and w3m-command
(file-executable-p w3m-command))
(when (try-require 'w3mXXX)
;; proxy settings
(when (string= (upcase (system-name)) "PC3701")
(eval-after-load "w3m"
'(setq w3m-command-arguments
(nconc w3m-command-arguments
'("-o" "http_proxy=http://msprx001p.be.winterthur.com:8080/"))))
(setq w3m-no-proxy-domains '("local.com" "sysdoc")))
;;{{{ General Variables
;; never send referrers
(setq w3m-add-referer nil)
;; home page
(setq w3m-home-page "http://www.mygooglest.com/")
;;
(setq w3m-horizontal-shift-columns 1) ; 2
;;}}}
;;{{{ Image Variables
;; always display images
(setq w3m-default-display-inline-images t)
;;
(setq w3m-use-favicon nil)
;;}}}
;;{{{ Cookie Variables
;; ask user whether accept bad cookies or not
(setq w3m-cookie-accept-bad-cookies 'ask)
;; list of trusted domains
(setq w3m-cookie-accept-domains
'("google.com" "google.be"
"yahoo.com" ".yahoo.com" "groups.yahoo.com"
"www.dyndns.org"))
;; enable cookies
(setq w3m-use-cookies t)
;;}}}
;;{{{ Other Variables
;;
(setq w3m-tab-width 8) ; 16
(defun w3m-new-tab ()
(interactive)
(w3m-copy-buffer nil nil nil t))
;; fix inappropriate key bindings
(define-key w3m-mode-map [(up)] 'previous-line)
(define-key w3m-mode-map [(down)] 'next-line)
(define-key w3m-mode-map [(left)] 'backward-char)
(define-key w3m-mode-map [(right)] 'forward-char)
(define-key w3m-mode-map [(shift left)] 'w3m-shift-right)
(define-key w3m-mode-map [(shift right)] 'w3m-shift-left)
(define-key w3m-mode-map [(tab)] 'w3m-next-anchor)
(define-key w3m-mode-map [(shift tab)] 'w3m-previous-anchor)
(define-key w3m-mode-map [(g)] 'w3m-goto-url)
(define-key w3m-mode-map [(i)] 'w3m-toggle-inline-image)
(define-key w3m-mode-map [(I)] 'w3m-toggle-inline-images)
(define-key w3m-mode-map [(n)] 'w3m-next-anchor)
(define-key w3m-mode-map [(control t)] 'w3m-new-tab)
;; Mozilla-like navigation
(define-key w3m-mode-map [(meta right)] 'w3m-view-this-url)
(define-key w3m-mode-map [(meta left)] 'w3m-view-previous-page)
(define-key w3m-mode-map [(control return)] 'w3m-view-this-url-new-session)
;; add key bindings
(global-set-key [(control c) (w) (w)] 'w3m)
(global-set-key [(control c) (w) (s)] 'w3m-search)))
;;}}}
;;}}}
;;{{{ Web search
(when (and (try-require 'browse-url) t)
;; (try-require 'url))
;;{{{ from Glenn Morris
(defvar my-google-maxlen 50
"Maximum string length of search term.")
(defvar my-google-url "www.google.com"
"Base URL for Google search.")
(defvar my-google-groups-url "groups.google.com"
"Base URL for groups Google search.")
(defun my-google-search-region (prefix start end)
"Create a search URL and send it to the web browser.
With prefix argument, use groups URL."
(interactive "P\nr")
(if (> (- end start) my-google-maxlen)
(message "Search string too long!")
(let ((query (buffer-substring-no-properties start end)))
(browse-url
(concat "http://"
(if prefix (concat my-google-groups-url "/groups")
(concat my-google-url "/search"))
"?q=" (url-hexify-string query))))))
(defvar my-url-maxlen 100
"Maximum length of string to send to browser as URL.")
;; `find-file-at-point' does this, essentially.
(defun my-url-at-point (start end)
"Send the highlighted URL to the web browser."
(interactive "r")
(if (> (- end start) my-url-maxlen)
(message "URL too long!")
(browse-url (buffer-substring-no-properties start end))))
;; (require 'url)
;;
;; (defvar google-search-maxlen 50
;; "Maximum string length of search term. This prevents you from accidentally
;; sending a five megabyte query string to Netscape.")
;;
;; (defun google-it (search-string)
;; "Search for SEARCH-STRING on google."
;; (interactive "sSearch for: ")
;; (browse-url (concat "http://www.google.com/search?client=xemacs&q="
;; (url-hexify-string
;; (encode-coding-string search-string 'utf-8)))))
;;
;; (defun google-search-selection ()
;; "Create a Google search URL and send it to your web browser."
;; (interactive)
;; (let (start end term url)
;; (if (or (not (fboundp 'region-exists-p)) (region-exists-p))
;; (progn
;; (setq start (region-beginning)
;; end (region-end))
;; (if (> (- start end) google-search-maxlen)
;; (setq term (buffer-substring start (+ start google-search-maxlen)))
;; (setq term (buffer-substring start end)))
;; (google-it term))
;; (beep)
;; (message "Region not active"))))
;;}}}
(global-set-key [(meta s)] 'my-google-search-region)
(defun my-google-search ()
"Prompt for a query in the minibuffer, launch the web browser and query
Google."
(interactive)
(let ((query (read-from-minibuffer "Google Search: ")))
(browse-url (concat "http://" my-google-url "/search?q="
(url-hexify-string query)))))
(defun my-google-search-word-at-point ()
"Google the word at point."
(interactive)
(browse-url (concat "http://" my-google-url "/search?q="
(word-at-point))))
(defun my-google-search-file (file)
"Use google to search for a file named FILE."
(interactive "sSearch for file: ")
(w3m-browse-url
(concat "http://" my-google-url "/search?q="
(w3m-url-encode-string
(concat "+intitle:\"index+of\" "
"-inurl:htm -inurl:html -inurl:php "
file)))))
(defvar my-google-prefix-map (make-sparse-keymap)
"Keymap for my Google commands.")
(global-set-key [(control c) (g)] my-google-prefix-map)
(define-key my-google-prefix-map "g" 'my-google-search)
(define-key my-google-prefix-map (kbd "RET") 'my-google-search)
(define-key my-google-prefix-map "w" 'my-google-search-word-at-point)
(define-key my-google-prefix-map "r" 'my-google-search-region)
(define-key my-google-prefix-map "u" 'my-url-at-point))
;;}}}
;;{{{ Del.icio.us
(when (try-require 'delicious)
(setq delicious-api-user "fni")
(setq delicious-api-password "default")
(setq delicious-api-from user-mail-address)
;; (setq delicious-api-host "msprx001p.be.winterthur.com")
;; (setq delicious-api-port "8080")
(delicious-api-register-auth))
;;}}}
;;{{{ Babel
;;;;;;; Use SysTran (only nearly functional translation service)...
;;; relies on w3...
(autoload 'babel "babel"
"Use a web translation service to translate the message MSG." t)
(autoload 'babel-region "babel"
"Use a web translation service to translate the current region." t)
(autoload 'babel-as-string "babel"
"Use a web translation service to translate MSG, returning a string." t)
(autoload 'babel-buffer "babel"
"Use a web translation service to translate the current buffer." t)
(setq babel-preferred-to-language "English")
;;}}}
;;{{{ AccuWeather
(when (try-require 'http-get)
(when (try-require 'htmlr)
;; from http://www.emacswiki.org/cgi-bin/wiki/RainOrShine
(defun accuweather-sentinel (proc string)
(switch-to-buffer (process-buffer proc))
(goto-char (point-min))
;; dirty parsing....
(search-forward "<!-- content table 3 --->")
(search-forward "</tr>")
(let ((inhibit-read-only t)
(start (point))
(end (search-forward " <!-- Right Nav -->")))
(kill-region end (point-max))
(kill-region (point-min) start)
(goto-char (point-min))
(htmlr-render)
(goto-char (point-min))))
(defun accuweather (city region country)
"use wwwa.accuweather.com http-get.el and htmlr.el to display weather
city is a city name i.e. ATHENS, PARIS....
REGION is one of:
AF;AFRICA AS;ASIA AU;AUSTRALIA CA;CANADA CL;CENTRAL AMERICA & CARIBBEAN
EU;EUROPE AW;MIDDLE EAST NA;NORTH AMERICA SA;SOUTH AMERICA
COUNTRY is a two letter code : GR greece FR france...."
(http-get
(format
"http://www.accuweather.com/adcbin/public/intlocal_index.asp?wxcity2=%s&wxcountry=%s;%s"
city
region
country)
nil 'accuweather-sentinel 1.0
(concat "Weather in: " city)))
(defun my-weather-in-brussels nil
(interactive)
(accuweather "BRUSSELS" "EU" "BX"))
(defun my-weather-in-frejus nil
(interactive)
(accuweather "FREJUS" "EU" "FR"))))
;;}}}
;;{{{ (info "(emacs-goodies-el)htmlize")
;; HTML-ize font-lock buffers
(when (try-require 'htmlize)
(global-set-key [(meta P)] 'htmlize-buffer))
;;}}}
;; ;; automatically update web copy
;; (write-region
;; (point-min) (point-max)
;; "/scorpios@ftp.scorpioscotedazur.com:/public_html/emacs/mydotemacs.el")
;;{{{ FFAP
;; find file (or URL) at point
(when (try-require 'ffap)
;; don't use default key bindings, as I want some of them to be defined
;; differently (C-x C-r, for example)
;; visit a file
(global-set-key [(f3)] 'find-file-at-point))
;;}}}
(message "52 Hyperlinking and Navigation Features... Done")
;;}}}
;;{{{ --[ 53 Dissociated Press ]-------------------------------------------
(message "53 Dissociated Press...")
(message "53 Dissociated Press... Done")
;;}}}
;;{{{ --[ 54 Other Amusements ]--------------------------------------------
(message "54 Other Amusements...")
(message "54 Other Amusements... Done")
;;}}}
;;{{{ --[ 55 (info "(emacs)Customization") ]--------------------------------
(message "55 Customization...")
;; inhibit the initial startup message in *scratch* buffer
(setq inhibit-startup-message t)
(XEmacs
(setq initial-scratch-message nil))
;; speed up things by preventing garbage collections
(setq gc-cons-threshold (* 50 1024 1024))
;;; ----[ 55.3 Variables
;; file local variables specifications are obeyed, without query - RISKY!!
(setq enable-local-variables t)
;; obey `eval' variables - RISKY!!
(setq enable-local-eval t)
;; record safe values for some local variables
(setq safe-local-variable-values
'((TeX-master . t)
(balloon-help-mode . -1)
(nuweb-auto-index-scrap)
(nuweb-source-mode . "mercury")
(nuweb-source-mode . "sql")))
;;; ----[ 55.4 Customizing Key Bindings
;; the keys C-c LETTER are reserved for user functions
;; print the key bindings in a tabular form
;; [from http://www-xray.ast.cam.ac.uk/~gmorris/dotemacs.html]
(defun my-keytable (arg)
"Print the key bindings in a tabular form."
(interactive "sEnter a modifier string:")
(with-output-to-temp-buffer "*Key table*"
(let* ((i 0)
(keys (list "a" "b" "c" "d" "e" "f" "g" "h" "i" "j" "k" "l" "m" "n"
"o" "p" "q" "r" "s" "t" "u" "v" "w" "x" "y" "z"
"<return>" "<down>" "<up>" "<right>" "<left>"
"<home>" "<end>" "<f1>" "<f2>" "<f3>" "<f4>" "<f5>"
"<f6>" "<f7>" "<f8>" "<f9>" "<f10>" "<f11>" "<f12>"
"1" "2" "3" "4" "5" "6" "7" "8" "9" "0"
"`" "~" "!" "@" "#" "$" "%" "^" "&" "*" "(" ")" "-" "_"
"=" "+" "\\" "|" "{" "[" "]" "}" ";" "'" ":" "\""
"<" ">" "," "." "/" "?"))
(n (length keys))
(modifiers (list "" "C-" "M-" "S-" "M-C-" "S-C-")))
(or (string= arg "") (setq modifiers (list arg)))
(setq k (length modifiers))
(princ (format " %-10.10s |" "Key"))
(let ((j 0))
(while (< j k)
(princ (format " %-31.31s |" (nth j modifiers)))
(setq j (1+ j))))
(princ "\n")
(princ (format "_%-10.10s_|" "__________"))
(let ((j 0))
(while (< j k)
(princ (format "_%-31.31s_|"
"_______________________________"))
(setq j (1+ j))))
(princ "\n")
(while (< i n)
(princ (format " %-10.10s |" (nth i keys)))
(let ((j 0))
(while (< j k)
(let* ((binding
(key-binding (read-kbd-macro (concat (nth j modifiers)
(nth i keys)))))
(binding-string "_"))
(when binding
(if (eq binding 'self-insert-command)
(setq binding-string (concat "'" (nth i keys) "'"))
(setq binding-string (format "%s" binding))))
(setq binding-string
(substring binding-string 0 (min (length
binding-string) 31)))
(princ (format " %-31.31s |" binding-string))
(setq j (1+ j)))))
(princ "\n")
(setq i (1+ i)))
(princ (format "_%-10.10s_|" "__________"))
(let ((j 0))
(while (< j k)
(princ (format "_%-31.31s_|"
"_______________________________"))
(setq j (1+ j))))))
(delete-window)
(hscroll-mode)
(setq truncate-lines t)) ; for Emacs 21
;;; ----[ 55.6 The Syntax Table
;; lorsque j'essaye de ispeller des mots avec accents, il semble
;; carrément ignorer les accents par ex un ispell sur éléphant
;; essaye de me corriger `phant', il vire le élé (en fait mon ex
;; est mal choisi il ne vire que les é, il n'essaye pas de
;; corriger une lettre seule - le l en l'occurence).
;;
;; ce qui compte ici c'est la syntax-case des caractères concernés. Pour
;; ton Emacs ils ne sont pas word-constituent; ça doit poser d'autres
;; problèmes avec les commandes de déplacement orienté mot (`M-f'), les
;; commandes d'expansion des abbrevs etc.
;; fix completion syntax for `text-mode-syntax-table'
(defun my-change-word-constituent ()
(map nil
(function
(lambda (char)
(modify-syntax-entry char "w" text-mode-syntax-table)))
;; (modify-syntax-entry char "_" cmpl-standard-syntax-table)))
;; include accented characters in completion syntax
"áéíóúàèìòùâêîôûäëïöüñåç"))
(my-change-word-constituent)
;; now '-' is not considered a word-delimiter
;; (add-hook 'emacs-lisp-mode-hook
;; '(lambda ()
;; (modify-syntax-entry ?- "w")))
;;; ----[ 55.X Disabling
;; To get a list of all the disabled functions:
;; M-: (let(lst)(mapatoms(lambda(x)(if(get x 'disabled)(push x lst))))lst) RET
(message "55 Customization... Done")
;;}}}
;;{{{ --[ App G Emacs and (info "(emacs)MS-DOS") ]---------------------------
(message "Appendix G Emacs and MS-DOS...")
;; numeric keypad (needed in XEmacs for Windows)
(XEmacs
;; keys to the right of the regular keyboard
(define-key key-translation-map [kp-divide] [?/])
(define-key key-translation-map [kp-multiply] [?*])
(define-key key-translation-map [kp-subtract] [?-])
(define-key key-translation-map [kp-add] [?+])
(define-key key-translation-map [kp-enter] [?\r])
(define-key key-translation-map [kp-decimal] [?.])
;; keys with digits
(define-key key-translation-map [kp-0] [?0])
(define-key key-translation-map [kp-1] [?1])
(define-key key-translation-map [kp-2] [?2])
(define-key key-translation-map [kp-3] [?3])
(define-key key-translation-map [kp-4] [?4])
(define-key key-translation-map [kp-5] [?5])
(define-key key-translation-map [kp-6] [?6])
(define-key key-translation-map [kp-7] [?7])
(define-key key-translation-map [kp-8] [?8])
(define-key key-translation-map [kp-9] [?9])
;; additional keypad duplicates of keys ordinarily found elsewhere
(define-key key-translation-map [kp-left] [left])
(define-key key-translation-map [kp-right] [right])
(define-key key-translation-map [kp-up] [up])
(define-key key-translation-map [kp-down] [down])
(define-key key-translation-map [kp-begin] [begin])
(define-key key-translation-map [kp-home] [home])
(define-key key-translation-map [kp-end] [end])
(define-key key-translation-map [kp-next] [next])
(define-key key-translation-map [kp-prior] [prior])
(define-key key-translation-map [kp-insert] [insert])
(define-key key-translation-map [kp-delete] [delete]))
;; divide key (needed in GNU Emacs for Windows)
(GNUEmacs
(global-set-key (kbd "<kp-divide>") (kbd "/")))
(message "Appendix G Emacs and MS-DOS... Done")
;;}}}
;;{{{ --[ Emacs Display ]---------------------------------------------------
;;; ----[ Faces
;; avoid Emacs hanging for a while changing default font
(modify-frame-parameters nil '((wait-for-wm . nil)))
;; set default color theme
(when (try-require 'color-theme)
(if (fboundp 'color-theme-initialize)
(color-theme-initialize))
(setq color-theme-is-global t)
(when (try-require 'color-theme-fni)
(color-theme-fni)))
;; allow any scalable font
(when running-ms-windows
(setq scalable-fonts-allowed t))
;; set default font family and font size
(assq-delete-all 'font default-frame-alist)
(defvar my-default-font
;; To check if some font is available in Emacs do following:
;; 1. Switch to `*scratch*' buffer.
;; 2. Type `(prin1-to-string (x-list-fonts "font-you-want-to-check or
;; pattern"))'.
;; 3. Place the cursor after the last closing paren and hit
;; `C-j'. List of the names of available fonts matching given
;; pattern will appear in the current buffer (`*scratch*').
;; 4. For listing of all available fonts, use
;; `(prin1-to-string (x-list-fonts "*"))'.
;; Format: "-maker-family-weight-slant-widthtype-style...
;; ...-pixels-height-horiz-vert-spacing-width-charset"
(if running-ms-windows
"-*-Courier New-*-*-*-*-12-90-*-*-*-*-*-*"
;; (insert (format "\n%S" (w32-select-font))) followed by C-x C-e
;; returns the current font string
;; "-monotype-courier new-semilight-r-*-*-12-90-*-*-m-*-*-*"
"-Misc-Fixed-Medium-R-SemiCondensed-*-13-*-*-*-*-*-*-*"
))
;; this face supports bold (in Gnus) while
;; "-misc-*-*-*-*-*-12-90-*-*-*-*-*-*" does not!!
;; use xfontsel utility to try out different fonts. After choosing
;; font click select button in xfontsel window. This will copy font
;; name you choose to copy & paste buffer.
;; ne pas oublier de faire un xrdb -merge derrière pour valider la
;; modif...
(add-to-list 'default-frame-alist (cons 'font my-default-font))
;; Note that I replaced some of the fields in the font name with asterisks.
;; This is because the font spec lists both a point size and a pixel height for
;; the font -- this combination will be particular to the resolution settings
;; of your monitor. If you just use one (the 90 in the example above means 9.0
;; points), and leave the other settings with *, that will make your setting
;; work better across different monitor settings.
;; [http://mail.gnu.org/archive/html/help-emacs-windows/2002-07/msg00102.html]
(XEmacs
(setq options-save-faces t))
;; You can also change the font size within XEmacs (options/size). Be
;; sure to put (setq options-save-faces t) in your .emacs then.
;; convenience functions for face customization
(try-require 'face-list)
;;; ----[ Display Tables
;; display page delimiter ^L as a horizontal line
(or standard-display-table (setq standard-display-table (make-display-table)))
(aset standard-display-table ?\f (vconcat (make-vector 78 ?-) "^L"))
;;}}}
;;}}}
;;{{{ Recovery from Problems ###############################################
;;{{{ --[ 56 Quitting and Aborting ]----------------------------------------
(message "56 Quitting and Aborting...")
(message "56 Quitting and Aborting... Done")
;;}}}
;;}}}
;;{{{ --[ Debugging ]-------------------------------------------------------
;; ;; get the resulting backtrace when bugs such as `Wrong type argument' occur
;; (setq debug-on-error nil) ; was set to `t' at beginning of buffer
;; warn that some packages were missing
(if missing-packages-list
(progn (message "Packages not found: %S"
(nreverse missing-packages-list))))
;;}}}
(autoload 'say-minor-mode "festival" "Menu for using Festival." t)
(say-minor-mode t)
(setq auto-mode-alist
(append '(("\\.festivalrc$" . scheme-mode)) auto-mode-alist))
(setq festival-program-name "/usr/bin/festival")
;; insert version info into `*scratch*' buffer
(set-buffer "*scratch*")
(insert (concat "This is " (emacs-version) "."))
(message "}}}\n")
;; This is for the sake of Emacs.
;; Local Variables:
;; coding: iso-latin-9
;; End:
;;; .emacs ends here
[-- Attachment #3: .gnus-sva --]
[-- Type: application/octet-stream, Size: 6015 bytes --]
;;; .gnus --- my Gnus Init File
;; Time-stamp: "Tue 2007-01-30 11:04 sva on mundaneum"
;; $Revision: 742 $
;; $Date: 2007-01-25 10:16:36 +0100 (Thu, 25 Jan 2007) $
;;; Code:
(message "{{{ --[ Loading my Gnus init file ]--")
;;{{{ --[ Loading ]---------------------------------------------------------
(defvar my-gnus-root-dir "~/"
"The root directory for my Gnus stuff.")
;; substitute environment variables, if any, in the directory name
(setq my-gnus-root-dir
(substitute-in-file-name my-gnus-root-dir))
;; list of packages that `try-require' can't find
(setq missing-packages-list nil)
;;}}}
;;{{{ --[ 1 (info "(gnus)Starting Up") Gnus ]-------------------------------
(message "1 Starting Gnus...")
;;{{{ ----[ 1.1 (info "(gnus)Finding the News")
;; using Gnus for news
(setq gnus-select-method
(cond (t
'(nntp "easynet" (nntp-address "news.easynet.be")))))
;; .netrc-like file that holds nntp authinfo passwords
(setq nntp-authinfo-file "~/.authinfo-news")
;; using Gnus for mail (with the one-file-one-message back-end)
(setq gnus-secondary-select-methods `(
(nnimap ""
(nnimap-address
,(cond (t
"81.188.7.133")))
;; authorization information (user account and password)
(nnimap-authinfo-file "~/.authinfo"))
(nnslashdot "")))
;;}}}
;; do not prompt the user for his mail address
(setq query-user-mail-address nil)
;;{{{ ----[ 1.5 (info "(gnus)New Groups")
;; don't save the list of killed groups
;; WARNING as Gnus has no record of which groups are new and which are old,
;; the automatic new newsgroups subscription methods becomes meaningless
(setq gnus-save-killed-list nil)
;;{{{ ----[ 1.7 (info "(gnus)Startup Files")
;; don't save a `.newsrc' file (for using other newsreaders) on exit
(setq gnus-save-newsrc-file nil)
;; ignore the `.newsrc' file
(setq gnus-read-newsrc-file nil)
;; my `.newsrc' file
(setq gnus-startup-file (concat my-gnus-root-dir "Mail/.newsrc"))
;;}}}
;;{{{ ----[ 1.8 (info "(gnus)Auto Save")
;; unconditionally read the dribble file
(setq gnus-always-read-dribble-file t)
;;}}}
;;{{{ ----[ 1.9 (info "(gnus)The Active File")
;; Gnus will only know about the groups in my `.newsrc' file
(setq gnus-read-active-file nil)
;;}}}
(message "1 Starting Gnus... Done")
;;}}}
;;{{{ --[ 2 (info "(gnus)The Group Buffer") ]-------------------------------
(message "2 Group Buffer...")
;;{{{ ----[ 2.1 (info "(gnus)Group Buffer Format")
;; format of the group buffer
(setq gnus-group-line-format (concat "%M%m%P %O "
"%(%-45,45g%) "
"%5N Unread/ %5t Items"
"\n"))
;;}}}
;;{{{ ----[ 2.16 (info "(gnus)Group Topics")
(add-hook 'gnus-group-mode-hook 'gnus-topic-mode)
;;}}}
(message "2 Group Buffer... Done")
;;}}}
;;{{{ --[ 3 (info "(gnus)The Summary Buffer") ]-----------------------------
(message "3 Summary Buffer...")
;;{{{ ----[ 3.1 (info "(gnus)Summary Buffer Format")
;; format specification of the lines in the summary buffer
;; for the record, the default string is `%U%R%z%I%(%[%4L: %-20,20n%]%) %s\n'
(setq gnus-summary-line-format (concat "%U%R"
"%z "
"%-15,15n "
"%4,4~(cut 0)o-"
"%2,2~(cut 4)o-"
"%2,2~(cut 6)o "
"%2,2~(cut 9)o:"
"%2,2~(cut 11)o "
(if (string-match "v5.1[01].*$"
(gnus-version))
"%4k %B")
"%I%(%0,80s%)\n"))
;; strings indicating that the current article has the same subject as
;; the previous
(if (and window-system
(string-match "v5.1[01].*$" (gnus-version)))
(progn
(setq gnus-summary-same-subject "")
(setq gnus-sum-thread-tree-root "\x4912f ")
(setq gnus-sum-thread-tree-false-root "\x490f8 ")
(setq gnus-sum-thread-tree-single-indent "\x4912b ")
(setq gnus-sum-thread-tree-leaf-with-other "\x4903c\x49020\x490fa ")
(setq gnus-sum-thread-tree-single-leaf "\x49034\x49020\x490fa ")
(setq gnus-sum-thread-tree-vertical "\x49022"))
(setq gnus-summary-same-subject "\\-> ..."))
;; format specification for the summary mode line
(setq gnus-summary-mode-line-format "%V: %%b")
;;}}}
;;{{{ ----[ (info "(gnus)Sorting") the Summary Buffer
;; sort threads by reverse date (of the root node)
;; [primary sort key should be the last function in the list]
(setq gnus-thread-sort-functions
'((not gnus-thread-sort-by-number)
gnus-thread-sort-by-date))
;;}}}
;;{{{ ----[ 3.12 (info "(gnus)Article Caching")
;; entering of articles from the cache
(setq gnus-cache-enter-articles '(ticked dormant unread read))
;; simple setup for your convenience, if you are using nnimap from
;; home, over a dialup connection
;; removing of articles from the cache
(setq gnus-cache-remove-articles nil)
;; cache your nnimap groups
(setq gnus-cacheable-groups "^nnimap")
;; avoid caching your nnml and nnfolder groups
(setq gnus-uncacheable-groups "^nnml\\|^nnfolder")
;;}}}
;;{{{ ----[ 3.26 (info "(gnus)Various Summary Stuff")
;; highlight current line in summary buffer
(defun my-setup-highlight-line ()
(hl-line-mode 1))
(add-hook 'gnus-summary-mode-hook 'my-setup-highlight-line)
;;}}}
(message "3 Summary Buffer... Done")
;;}}}
;; warn that some packages were missing
(if missing-packages-list
(progn (message "Packages not found: %S"
(nreverse missing-packages-list))))
(message "}}}\n")
;; This is for the sake of Emacs.
;; Local Variables:
;; mode: emacs-lisp
;; coding: iso-latin-9
;; End:
;;; .gnus ends here
[-- Attachment #4: color-theme-sva.el --]
[-- Type: application/emacs-lisp, Size: 18403 bytes --]
[-- Attachment #5: Emacs21-Messages.txt --]
[-- Type: text/plain, Size: 1844 bytes --]
Loading image...done
Loading tooltip...done
Loading 00debian-vars...
No /etc/mailname. Reverting to default...
Loading 00debian-vars...done
Loading 20apel (source)...done
Loading 49url (source)...done
Loading 50bbdb (source)...done
Loading 50dictionaries-common (source)...
Loading debian-ispell...
Loading /var/cache/dictionaries-common/emacsen-ispell-default.el (source)...done
Loading debian-ispell...done
Loading /var/cache/dictionaries-common/emacsen-ispell-dicts.el (source)...done
Loading 50dictionaries-common (source)...done
Loading 50emacs-color-themes (source)...done
Loading 50emacs-goodies-el (source)...done
Loading 50festival (source)...done
Loading 50muse-el (source)...
Loading muse-autoloads.el (source)...done
Loading 50muse-el (source)...done
Loading 50namazu2 (source)...done
Loading 50psvn (source)...done
Loading 50w3 (source)...done
Loading 50w3m-el (source)...done
{{{ --[ Loading my Emacs init file ]--
Loading advice...done
Adding `/home/sva/media/Downloads/emacs/site-lisp/' to load-path...
Adding `/home/sva/media/Downloads/emacs/site-lisp/color-theme-6.6.0' to load-path...
Adding `/home/sva/media/Downloads/emacs/site-lisp/color-theme-6.6.0/themes' to load-path...
Adding `/home/sva/emacs/site-lisp/' to load-path...
18 Controlling the Display...
Loading font-lock...
Loading regexp-opt...done
Loading font-lock...done
18 Controlling the Display... Done
35 Sending Mail...
Checking for library `gnus'...
Loading mule-util...done
Checking for library `gnus'... Found
35 Sending Mail... Done
36 Reading Mail with Gnus...
Checking for library `gnus'... Found
36 Reading Mail with Gnus... Done
Checking for library `color-theme'... Found
Checking for library `color-theme-sva'... Found
Checking for library `face-list'... Missing
}}}
Loading nil...
For information about the GNU Project and its goals, type C-h C-p.
[-- Attachment #6: Emacs22-Messages.txt --]
[-- Type: text/plain, Size: 1519 bytes --]
(emacs)
{{{ --[ Loading my Emacs init file ]--
Loading advice...done
Adding `/home/sva/media/Downloads/emacs/site-lisp/' to load-path...
Adding `/home/sva/media/Downloads/emacs/site-lisp/color-theme-6.6.0' to load-path...
Adding `/home/sva/media/Downloads/emacs/site-lisp/color-theme-6.6.0/themes' to load-path...
Adding `/home/sva/emacs/site-lisp/' to load-path...
18 Controlling the Display... Done
35 Sending Mail...
Checking for library `gnus'... Found
35 Sending Mail... Done
36 Reading Mail with Gnus...
Checking for library `gnus'... Found
36 Reading Mail with Gnus... Done
Checking for library `color-theme'...
Loading regexp-opt...done
Loading edmacro...done
Checking for library `color-theme'... Found
Loading cl-macs...done
Loading /home/sva/media/Downloads/emacs/site-lisp/color-theme-6.6.0/themes/color-theme-example.el...
Loading /home/sva/media/Downloads/emacs/site-lisp/color-theme-6.6.0/themes/color-theme-example.el (source)...done
Loading /home/sva/media/Downloads/emacs/site-lisp/color-theme-6.6.0/themes/color-theme-library.el...
Loading /home/sva/media/Downloads/emacs/site-lisp/color-theme-6.6.0/themes/color-theme-library.el (source)...done
Checking for library `color-theme-sva'... Found
Checking for library `face-list'... Missing
}}}
Loading nil...
For information about the GNU Project and its goals, type C-h C-p. [2 times]
Quit
Making completion list...
Loading /usr/local/share/emacs/22.0.93/lisp/vc-svn.elc...
Loading vc-svn...done
Loading vc...done
Wrote /home/sva/Emacs22-Scratch.txt
[-- Attachment #7: Type: text/plain, Size: 142 bytes --]
_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Color-theme problems in Emacs 22+ (Ubuntu, Windows)
2007-01-30 12:21 ` Sébastien Vauban
@ 2007-01-30 17:21 ` Chong Yidong
2007-01-31 8:27 ` Sébastien Vauban
[not found] ` <1170232136.ZTHJWSQQAFHV@spammotel.com>
0 siblings, 2 replies; 8+ messages in thread
From: Chong Yidong @ 2007-01-30 17:21 UTC (permalink / raw)
To: Sébastien Vauban; +Cc: re.2YV9XX9BLMAAX, rms, emacs-devel
Sébastien Vauban <zthjwsqqafhv@spammotel.com> writes:
> I've done the following:
>
> o ultra-simplified my .emacs file - see attachment;
>
> o ultra-simplified my .gnus file - see attachment;
>
> o triple-checked that I'm loading the last version of
> color-theme - see the Messages buffers attached.
The .emacs file you attached is 5000 lines long---hardly
"ultra-simplified".
Furthermore, it relies on a lot of files that seem to be specific to
your setup---I get errors when I try to use it. So probably the only
one who can debug this is you. The strategy is to keep removing items
from .emacs until the bug no longer appears (assuming the bug does not
happen with an empty .emacs---this is at least the case for me.) Then
the last change made was the one that caused the bug.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Color-theme problems in Emacs 22+ (Ubuntu, Windows)
2007-01-30 17:21 ` Chong Yidong
@ 2007-01-31 8:27 ` Sébastien Vauban
[not found] ` <1170232136.ZTHJWSQQAFHV@spammotel.com>
1 sibling, 0 replies; 8+ messages in thread
From: Sébastien Vauban @ 2007-01-31 8:27 UTC (permalink / raw)
To: re.2YV9XX9BLMAAX, cyd; +Cc: rms, emacs-devel
[-- Attachment #1: Type: text/plain, Size: 1926 bytes --]
Hello Chong,
>> I've done the following:
>>
>> o ultra-simplified my .emacs file - see attachment;
>
> The .emacs file you attached is 5000 lines long---hardly
> "ultra-simplified".
Sorry, sorry, sorry! Of course, I swapped the two Emacs files,
and sent you the wrong one.
For all the tests I made yesterday, I thus used the very
simplified config file (205 lines with a lot of comments,
instead of 5000, as you saw) that's attached here. That's a 1:25
slim ratio!
> Furthermore, it relies on a lot of files that seem to be
> specific to your setup---I get errors when I try to use it.
For my curiosity, I'd be interested to know which errors you
got, as my goal is to make my .emacs file as general and
multi-purpose as possible, and as I'd like to share it on the
Web for the interested ones.
> So probably the only one who can debug this is you. The
> strategy is to keep removing items from .emacs until the bug
> no longer appears (assuming the bug does not happen with an
> empty .emacs---this is at least the case for me.) Then the
> last change made was the one that caused the bug.
I cannot really remove more stuff than I did now: I just kept
what's related to font-lock, my faces and my color-theme setup.
The only thing you have to change to make this file work for you
is to update (lines 44 to 50) the value of the 2 following
variables:
,----
| (defvar my-site-lisp-directory
| "~/emacs/site-lisp/"
| "Name of directory where my color-theme-sva.el file reside.")
|
| (defvar other-local-site-lisp-directory
| "/home/sva/media/Downloads/emacs/site-lisp/"
| "Name of directory where Emacs color-theme.el reside.")
`----
Hope this now helps. And sorry once again for my mistake.
Seb
PS- In order to have a complete setup, I also attach the 2 other
config files.
--
Sébastien Vauban
[-- Attachment #2: .emacs-sva --]
[-- Type: application/emacs-lisp, Size: 6677 bytes --]
[-- Attachment #3: .gnus-sva --]
[-- Type: application/emacs-lisp, Size: 6015 bytes --]
[-- Attachment #4: color-theme-sva.el --]
[-- Type: application/emacs-lisp, Size: 18403 bytes --]
[-- Attachment #5: Type: text/plain, Size: 142 bytes --]
_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Color-theme problems in Emacs 22+ (Ubuntu, Windows)
[not found] ` <1170232136.ZTHJWSQQAFHV@spammotel.com>
@ 2007-01-31 15:23 ` Chong Yidong
2007-02-01 8:42 ` Sébastien Vauban
0 siblings, 1 reply; 8+ messages in thread
From: Chong Yidong @ 2007-01-31 15:23 UTC (permalink / raw)
To: ZTHJWSQQAFHV; +Cc: rms, emacs-devel
The problematic customization is in your .emacs file:
(defface my-font-lock-tab-face
'((t (:background "Gold")))
"Face for highlighting tab characters.")
(defface my-font-lock-trailing-space-face
'((t (:background "LemonChiffon")))
"Face for highlighting trailing spaces.")
;; warning font lock (80 columns, tabs, trailing spaces)
(defvar font-lock-keywords nil)
(add-hook 'font-lock-mode-hook
'(lambda ()
(setq font-lock-keywords
(append font-lock-keywords
'(("\t+"
(0 'my-font-lock-tab-face t))
("[ \t]+$"
(0 'my-font-lock-trailing-space-face t)))))))
When you munge font-lock-keywords manually, unpredicatable things can
occur. In this case, it seems like font-lock-mode is taking over
highlighting in buffers that normally specify face properties
manually, causing the normal text highlighting to disappear.
The proper way to do what you want is to use the function
`font-lock-add-keywords'. See also hi-lock.el, which may do what you
want.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Color-theme problems in Emacs 22+ (Ubuntu, Windows)
2007-01-31 15:23 ` Chong Yidong
@ 2007-02-01 8:42 ` Sébastien Vauban
0 siblings, 0 replies; 8+ messages in thread
From: Sébastien Vauban @ 2007-02-01 8:42 UTC (permalink / raw)
To: re.2YV9XX9BLMAAX, cyd; +Cc: rms, emacs-devel
Hi Chong,
> The problematic customization is in your .emacs file:
>
> ;; warning font lock (tabs, trailing spaces)
> (defvar font-lock-keywords nil)
> (add-hook 'font-lock-mode-hook
> '(lambda ()
> (setq font-lock-keywords
> (append font-lock-keywords
> '(("\t+"
> (0 'my-font-lock-tab-face t))
> ("[ \t]+$"
> (0 'my-font-lock-trailing-space-face t)))))))
>
> When you munge font-lock-keywords manually, unpredicatable
> things can occur. In this case, it seems like font-lock-mode
> is taking over highlighting in buffers that normally specify
> face properties manually, causing the normal text highlighting
> to disappear.
Thank you *very much* for that quick and right answer.
Now, I'm relieved as I finally can jump to Emacs 22+, in Ubuntu
and in Windows as well (sorry, forced to use it at work, while
still refusing to use Outlook!).
Weirdly enough, under Emacs22/Ubuntu, my groups are dark green,
and under Emacs23/Windows, with the same config files, they are
purple, as you saw them. Not important, though, as I have
color-highlighting working, and so I know where are the empty
groups and the other ones.
I'm sorry to have disturbed you with a problem that appears to
be within my .emacs file, but see the weird thing: everything
worked perfectly in Emacs 21 (Ubuntu + Window$), and never in
Emacs 22+ (on both platforms)... That's the kind of interaction
that's difficult to spot.
> The proper way to do what you want is to use the function
> `font-lock-add-keywords'. See also hi-lock.el, which may do
> what you want.
Thanks for the hint on how to do it properly...
Case is closed.
Please receive a grateful hello from Brussels!
Thank you very much,
Seb
--
Sébastien Vauban
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2007-02-01 8:42 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-01-21 6:49 Color-theme problems in Emacs 22+ (Ubuntu, Windows) Richard Stallman
2007-01-22 18:06 ` Chong Yidong
2007-01-25 8:49 ` Sébastien Vauban
2007-01-30 12:21 ` Sébastien Vauban
2007-01-30 17:21 ` Chong Yidong
2007-01-31 8:27 ` Sébastien Vauban
[not found] ` <1170232136.ZTHJWSQQAFHV@spammotel.com>
2007-01-31 15:23 ` Chong Yidong
2007-02-01 8:42 ` Sébastien Vauban
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.