;; Options Menu Settings
;; =====================
(cond
((and (string-match "XEmacs" emacs-version)
(boundp 'emacs-major-version)
(or (and
(= emacs-major-version 19)
(>= emacs-minor-version 14))
(= emacs-major-version 20))
(fboundp 'load-options-file))
(load-options-file "/home/jrb/.xemacs-options")))
;; ============================
;; End of Options Menu Settings
;; ============================
;; Path stuff
(setq load-path (append (list (expand-file-name "~/share/elisp")
(expand-file-name "~/share/elisp/bbdb"))
load-path))
(if (file-exists-p "~/gnomedevel/gnome-libs/tools/gnome-doc/gnome-doc.el")
(load-library "~/gnomedevel/gnome-libs/tools/gnome-doc/gnome-doc.el"))
;;
;; Set up the modes...
;;
;; text mode
(setq default-major-mode 'text-mode)
(setq text-mode-hook
'(lambda nil
(setq fill-column 72)
(auto-fill-mode 1)))
(setq kill-emacs-query-functions
'(lambda nil
(y-or-n-p "Are you sure you want to quit?")))
; mail mode
(defun jrb-mail-mode-hook ()
(setq fill-column 72)
(auto-fill-mode 1))
(add-hook 'mail-setup-hook 'jrb-mail-mode-hook)
(add-hook 'mail-send-hook 'flyspell-mode-off)
(autoload 'flyspell-mode-on "flyspell" "On-the-fly ispell." t)
(autoload 'flyspell-mode-off "flyspell" "On-the-fly ispell." t)
(autoload 'python-mode "python-mode" "Python editing mode." t)
; sgml mode
(setq sgml-indent-data t)
(add-hook 'sgml-mode-hook
(lambda ()
(define-key sgml-mode-map "\C-m" 'newline-and-indent)
; (setq sgml-public-map ("%S" "/usr/local/lib/sgml/%o/%c/%d" "/usr/lib
;/sgml/%o/%c/%d"))
(setq sgml-set-face t)
(setq sgml-indent-data t)
(setq sgml-auto-insert-required-elements t)))
(add-hook 'c-mode-common-hook
(lambda ()
(define-key c-mode-map "\C-m" 'newline-and-indent)
(define-key c-mode-map [C-tab] '(lambda () (interactive) (insert " ")))
(c-set-style "k&r")
(c-set-offset 'inextern-lang 0)
(require 'ctypes)
(setq c-basic-offset 8)
(setq-default c-hungry-delete-key t)
(load-gnome-tags)
(load "gtk-widg.el")
(set-fill-column 80)))
(add-hook 'c++-mode-common-hook
(lambda ()
(define-key c-mode-map "\C-m" 'newline-and-indent)
(define-key c-mode-map [C-tab] '(lambda () (interactive) (insert " ")))
(c-set-style "k&r")
(require 'ctypes)
(setq c-basic-offset 8)
(c-set-offset 'inextern-lang 0)
(setq-default c-hungry-delete-key t)
(load-gnome-tags)
(load "gtk-widg.el")
(set-fill-column 80)))
(add-hook 'python-mode-hook
(lambda ()
(modify-syntax-entry ?\_ "." py-mode-syntax-table )))
(defun todo ()
"Displays my TODO list"
(interactive)
(find-file "~/TODO"))
(defun todo-gfm ()
"Displays my TODO.GFM list"
(interactive)
(find-file "~/TODO.GFM"))
(defun todo-rh ()
"Displays my TODO.RH list"
(interactive)
(find-file "~/TODO.RH"))
(setq auto-mode-alist (cons '("\\.idl\\'" . c++-mode) auto-mode-alist))
(setq auto-mode-alist (cons '("\\.py$" . python-mode) auto-mode-alist))
(setq auto-mode-alist (cons '("\\.jl\\'" . lisp-mode) auto-mode-alist))
(setq auto-mode-alist (cons '("\\.sawmillrc\\'" . lisp-mode) auto-mode-alist))
(setq interpreter-mode-alist
(cons '("python" . python-mode)
interpreter-mode-alist))
(defun load-gnome-tags ()
"Loads all of the tags for GNOME"
(setq tags-table-list
'("~/gnomedevel/glib/TAGS" "~/gnomedevel/glib/gmodule/TAGS" "~/gnomedevel/gtk+/gdk/TAGS" "~/gnomedevel/gtk+/gtk/TAGS" "~/gnomedevel/gnome-libs/libgnome/TAGS" "~/gnomedevel/gnome-libs/libart_lgpl/TAGS" "~/gnomedevel/gnome-libs/libgnomeui/TAGS")))
(defun compile-jrb ()
"runs make"
(interactive)
(compile "make"))
(defun compile-install-jrb ()
"runs 'make install'"
(interactive)
(compile "make install"))
(defun compile-install-lib-jrb ()
"runs 'make install_libLTLIBRARIES'"
(interactive)
(compile "make install_libLTLIBRARIES"))
(defun compile-clean-jrb ()
"runs 'make clean'"
(interactive)
(compile "make clean"))
;; Thanks, federico
(defun clean-line-ends ()
(interactive)
(if (not buffer-read-only)
(save-excursion
(goto-char (point-min))
(let ((count 0))
; This is bracket-space-tab-unbracket-plus-dollar
(while (re-search-forward "[ ]+$" nil t)
(setq count (+ count 1))
(replace-match "" t t))
(message "Cleaned %d lines" count)))))
;;
;; set variables
;;
; random stuff
(menu-bar-mode -1)
(setq inhibit-startup-message t)
(setq minibuffer-max-depth nil)
(setq mouse-yank-at-point t)
(line-number-mode t)
(column-number-mode t)
(setq query-replace-highlight t)
(setq search-highlight t)
(custom-set-variables
'(show-paren-style (quote parenthesis))
'(gnus-select-method (quote (nntp "news.redhat.com")))
'(vc-follow-symlinks t)
'(add-log-full-name "Jonathan Blandford" t)
'(add-log-time-format (quote current-time-string))
'(gnus-local-domain "redhat.com")
'(c-font-lock-extra-types (quote ("gint" "gfloat" "gchar" "gint8" "gint16" "gint32" "guint" "guint8" "guint16" "guint32" "guchar" "glong" "gboolean" "gshort" "gushort" "gulong" "gdouble" "gldouble" "gpointer" "Gtk\\w+" "Gdk\\w+" "GTK\\w+" "GDK\\w+" "NULL" "GList" "GSList" "->" "FALSE" "TRUE" "FILE" "\\sw+_t")))
'(show-paren-mode t nil (paren))
'(gnus-local-organization "Red Hat, Inc." t)
'(gnus-large-newsgroup 200)
'(query-user-mail-address nil)
'(user-mail-address "jrb@redhat.com")
'(dabbrev-case-fold-search nil)
'(mail-source-delete-incoming t)
'(nntp-address "news.redhat.com" t))
(setq compilation-read-command nil)
(setq truncate-lines nil)
(setq truncate-partial-width-windows nil)
(if window-system
(setq baud-rate 1000000)
(setq baud-rate 36000))
; colors
; Stolen and modified from quartic
(global-font-lock-mode t)
(custom-set-faces
'(font-lock-comment-face ((t (:foreground "RoyalBlue2"))))
'(font-lock-reference-face ((t (:foreground "khaki"))))
'(font-lock-string-face ((t (:foreground "limegreen"))))
'(font-lock-keyword-face ((t (:foreground "mediumaquamarine"))))
'(show-paren-mismatch-face ((((class color)) (:foreground "yellow" :background "red"))))
'(font-lock-warning-face ((((class color) (background dark)) (:bold t :foreground "pink"))))
'(font-lock-type-face ((t (:foreground "cornsilk1"))))
'(show-paren-match-face ((((class color)) (:background "seagreen"))))
'(font-lock-variable-name-face ((t (:foreground "sandy brown"))))
'(font-lock-function-name-face ((t (:bold t :foreground "mediumspringgreen"))))
'(font-lock-builtin-face ((((class color) (background dark)) (:foreground "springgreen")))))
;;
;; Key bindings
;;
(global-set-key "\C-=" 'call-last-kbd-macro)
(global-set-key [f3] 'compile-jrb)
(global-set-key [f4] 'compile-install-jrb)
(global-set-key [f5] 'compile-install-lib-jrb)
(global-set-key [f6] 'compile-clean-jrb)
(global-set-key "\M-g" 'goto-line)
(global-set-key "tg" 'todo)
(global-set-key "tf" 'todo-gfm)
(global-set-key "tr" 'todo-rh)
(global-set-key " " 'other-window)
(global-set-key "\C-o" 'shell)
(global-set-key (quote [C-tab]) 'lisp-complete-symbol)
(global-set-key (quote [M-down]) (quote forward-paragraph))
(global-set-key (quote [M-up]) (quote backward-paragraph))
;;;
;;; SGML
;;;
(setq-default sgml-indent-data 't)
(setq sgml-set-face t)
(setq sgml-auto-activate-dtd t)
(make-face 'sgml-comment-face)
(make-face 'sgml-doctype-face)
(make-face 'sgml-end-tag-face)
(make-face 'sgml-entity-face)
(make-face 'sgml-ignored-face)
(make-face 'sgml-ms-end-face)
(make-face 'sgml-ms-start-face)
(make-face 'sgml-pi-face)
(make-face 'sgml-sgml-face)
(make-face 'sgml-short-ref-face)
(make-face 'sgml-start-tag-face)
(set-face-foreground 'sgml-comment-face "maroon")
(set-face-foreground 'sgml-doctype-face "dark green")
(set-face-foreground 'sgml-end-tag-face "blue2")
(set-face-foreground 'sgml-entity-face "red2")
(set-face-foreground 'sgml-ignored-face "maroon")
(set-face-background 'sgml-ignored-face "gray90")
(set-face-foreground 'sgml-ms-end-face "maroon")
(set-face-foreground 'sgml-ms-start-face "maroon")
(set-face-foreground 'sgml-pi-face "maroon")
(set-face-foreground 'sgml-sgml-face "maroon")
(set-face-foreground 'sgml-short-ref-face "goldenrod")
(set-face-foreground 'sgml-start-tag-face "green")
(set-face-foreground 'sgml-end-tag-face "green")
(setq-default sgml-markup-faces
'((comment . sgml-comment-face)
(doctype . sgml-doctype-face)
(end-tag . sgml-end-tag-face)
(entity . sgml-entity-face)
(ignored . sgml-ignored-face)
(ms-end . sgml-ms-end-face)
(ms-start . sgml-ms-start-face)
(pi . sgml-pi-face)
(sgml . sgml-sgml-face)
(short-ref . sgml-short-ref-face)
(start-tag . sgml-start-tag-face)
(end-tag . sgml-end-tag-face)))
(setq x-allow-sendevents t)
(defconst gtk-widget-author-name "Jonathan Blandford")
(defun my-gnus-summary-delete-article (&optional n)
"Delete the N next (mail) articles.
This command actually deletes articles. This is not a marking
command. The article will disappear forever from your life, never to
return.
If N is negative, delete backwards.
If N is nil and articles have been marked with the process mark,
delete these instead."
(interactive "P")
(gnus-set-global-variables)
(unless (gnus-check-backend-function 'request-expire-articles
gnus-newsgroup-name)
(error "The current newsgroup does not support article deletion"))
;; Compute the list of articles to delete.
(let ((articles (gnus-summary-work-articles n))
not-deleted)
(if '()
()
;; Delete the articles.
(setq not-deleted (gnus-request-expire-articles
articles gnus-newsgroup-name 'force))
(while articles
(gnus-summary-remove-process-mark (car articles))
;; The backend might not have been able to delete the article
;; after all.
(unless (memq (car articles) not-deleted)
(gnus-summary-mark-article (car articles) gnus-canceled-mark))
(setq articles (cdr articles)))
(when not-deleted
(gnus-message 4 "Couldn't delete articles %s" not-deleted)))
(gnus-summary-position-point)
(gnus-set-mode-line 'summary)
not-deleted))
(setq transient-mark-mode t)
(defun make-schema (schema-path schema-type schema-owner schema-default schema-short schema-long)
(interactive
(list (read-string "Path: " nil 'schema-path-history)
(completing-read "Type: " '(("string" 1)
("int" 2)
("float" 3)
("bool" 4)
("schema" 5)
("list" 6)
("pair" 7))
nil 't "string")
(read-string "Owner: " nil 'schema-owner-history)
(read-string "Default Value: " nil 'schema-default-history)
(read-string "Description: " nil 'schema-short-history)
(read-string "Long Description: " nil 'schema-long-history)))
(progn
(insert " \n")
(insert (format " /schemas%s\n" schema-path))
(insert (format " %s\n" schema-path))
(insert (format " %s\n" schema-owner))
(insert (format " %s\n" schema-type))
(insert " \n")
(insert (format " %s\n" schema-default))
(insert (format " %s\n" schema-short))
(insert (format " %s\n" schema-long))
(insert " \n")
(insert " \n")))
(defun match-c-indent-style ()
(make-local-variable 'c-indentation-style)
(let ((curdir (expand-file-name "")))
(c-set-style
(cond ((string-match "/gtk+" curdir) "gnu")
((string-match "/gnome" curdir) "linux")
(t "gnu")))))
(add-hook 'c-mode-hook 'match-c-indent-style)
(autoload 'egtk-mode "egtk" "mode for editing GTK+ code")
(add-hook 'c-mode-hook 'egtk-mode)
(defun add-rumour ()
"Add a rumour to rumour mill file"
(interactive)
(find-file-other-window "~/NEWS")
(goto-char (point-max))
(when (not (= (current-column) 0))
(insert "\n"))
(insert "\n\n\n")
(beginning-of-line 0))
(put 'upcase-region 'disabled nil)
(setq require-final-newline t)