From d5d7ee417b155ae84a3ba86e537e7fdff8c3765e Mon Sep 17 00:00:00 2001 From: Steve Youngs Date: Sun, 10 Jun 2012 16:18:32 +1000 Subject: [PATCH] Initial checkin Signed-off-by: Steve Youngs --- 00-build.el | 222 +++++++++++ 01-vars-sy.el | 135 +++++++ 02-keys-sy.el | 186 +++++++++ 03-c-mode-sy.el | 115 ++++++ 04-w3-sy.el | 84 ++++ 05-latex-sy.el | 283 ++++++++++++++ 06-tex-site-sy.el | 113 ++++++ 07-html-sy.el | 277 +++++++++++++ 08-bbdb-sy.el | 203 ++++++++++ 09-sounds-sy.el | 90 +++++ 10-toolbar-sy.el | 121 ++++++ 11-pkgs-sy.el | 643 +++++++++++++++++++++++++++++++ 12-cal-sy.el | 586 ++++++++++++++++++++++++++++ 13-misc-sy.el | 943 +++++++++++++++++++++++++++++++++++++++++++++ 14-fonts-sy.el | 431 +++++++++++++++++++++ 15-supercite-sy.el | 141 +++++++ 16-riece-sy.el | 786 +++++++++++++++++++++++++++++++++++++ 17-emchat-sy.el | 317 +++++++++++++++ init-el | 87 +++++ 19 files changed, 5763 insertions(+) create mode 100644 00-build.el create mode 100644 01-vars-sy.el create mode 100644 02-keys-sy.el create mode 100644 03-c-mode-sy.el create mode 100644 04-w3-sy.el create mode 100644 05-latex-sy.el create mode 100644 06-tex-site-sy.el create mode 100644 07-html-sy.el create mode 100644 08-bbdb-sy.el create mode 100644 09-sounds-sy.el create mode 100644 10-toolbar-sy.el create mode 100644 11-pkgs-sy.el create mode 100644 12-cal-sy.el create mode 100644 13-misc-sy.el create mode 100644 14-fonts-sy.el create mode 100644 15-supercite-sy.el create mode 100644 16-riece-sy.el create mode 100644 17-emchat-sy.el create mode 100644 init-el diff --git a/00-build.el b/00-build.el new file mode 100644 index 0000000..1f9a3c3 --- /dev/null +++ b/00-build.el @@ -0,0 +1,222 @@ +;; 00-build.el --- Loads the required crap for all my init files -*- Emacs-Lisp -*- + +;; Copyright (C) 2007 - 2012 Steve Youngs + +;; Author: Steve Youngs +;; Maintainer: Steve Youngs +;; Created: <2007-12-02> +;; Time-stamp: +;; Download: +;; HTMLised: +;; Git Repo: git clone http://git.sxemacs.org/syinit +;; Keywords: init, compile + +;; This file is part of SYinit + +;; Redistribution and use in source and binary forms, with or without +;; modification, are permitted provided that the following conditions +;; are met: +;; +;; 1. Redistributions of source code must retain the above copyright +;; notice, this list of conditions and the following disclaimer. +;; +;; 2. Redistributions in binary form must reproduce the above copyright +;; notice, this list of conditions and the following disclaimer in the +;; documentation and/or other materials provided with the distribution. +;; +;; 3. Neither the name of the author nor the names of any contributors +;; may be used to endorse or promote products derived from this +;; software without specific prior written permission. +;; +;; THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR +;; IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +;; WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +;; DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +;; FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +;; CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +;; SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR +;; BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +;; WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE +;; OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +;; IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +;;; Commentary: +;; +;; This simply loads everything needed to compile and load my init +;; files. + +;;; Credits: +;; +;; The HTML version of this file was created with Hrvoje Niksic's +;; htmlize.el which is part of the XEmacs "text-modes" package. +;; + +;;; Todo: +;; +;; + +;;; Code: +(globally-declare-boundp + '(**mpd-var-Artist* + **mpd-var-Title* + appt-message-warning-time + bbdb-auto-notes-alist + bbdb-complete-name-allow-cycling + bbdb-dial-local-prefix + bbdb-dwim-net-address-allow-redundancy + bbdb/gnus-score-default + bbdb/gnus-summary-in-bbdb-format-letter + bookmark-save-flag + c-default-style + compilation-always-signal-completion + compilation-read-command + compilation-window-height + compile-command + crontab-delete-blank-lines + cvs-add-default-message + cvs-allow-dir-commit + cvs-reuse-cvs-buffer + diff-switches + edit-toolbar-added-buttons-alist + eshell-ask-to-save-history + eshell-banner-message + eshell-hist-ignoredups + eshell-modules-list + etalk-process-file + fancy-diary-display + find-function-source-path + font-menu-ignore-scaled-fonts + fume-display-in-modeline-p + fume-menubar-menu-location + ges-post-use-mime + gnus-article-buffer + gnus-extract-address-components + gnus-original-article-buffer + gnus-signature-separator + howm-menu-display-rules + howm-menu-schedule-days + howm-schedule-menu-types + ibuffer-fontification-level + ibuffer-saved-filter-groups + make-diary-entry + mark-diary-entries + mark-howm-entry + message-cite-function + mode-compile-make-program + passwd-invert-frame-when-keyboard-grabbed + patcher-default-change-logs-appearance + patcher-default-change-logs-prologue + patcher-default-change-logs-updating + patcher-default-diff-command + patcher-default-diff-prologue-function + patcher-default-log-message-items + patcher-default-mail-method + patcher-default-subject-committed-prefix + patcher-default-subject-prefix + patcher-default-to-address + patcher-mail-run-gnus + patcher-mail-run-gnus-other-frame + patcher-projects + patcher-subprojects + query-user-mail-address + recent-files-non-permanent-submenu + report-xemacs-bug-no-explanations + riece-alias-percent-hack-mask + riece-command-buffer + riece-ignore-discard-message + riece-keywords + savehist-coding-system + savehist-file + set-mode + snap-abbreviate-environment-variables + speedbar-query-confirmation-method + speedbar-show-unknown-files + speedbar-tag-hierarchy-method + speedbar-track-mouse-flag + speedbar-use-tool-tips-flag + speedbar-visiting-tag-hook)) + + +(eval-and-compile + ;(defvar xwem-global-map global-map) + ;(defvar xwem-sound-alist nil) + ;(defvar xwem-started nil) + (autoload #'executable-find "executable") + (autoload #'morse-region "morse" nil t) + (autoload #'read-kbd-macro "edmacro" nil t) + (autoload #'regexp-opt "regexp-opt") + (require 'advice) + (require 'alist) + (require 'bbdb-gnus) + (require 'bbdb-hooks) + (require 'bbdb-sc) + (require 'bbdb-w3) + (require 'emchat) + (require 'emchat-buddy) + (require 'emchat-status) + (require 'emchat-wharf) + (require 'outl-mouse) + (require 'riece-yank) + ;(require 'xwem-clients) + ;(require 'xwem-sound) +; (when (and (device-on-window-system-p) +; (featurep 'toolbar) +; (boundp 'default-toolbar-visible-p)) +; (require 'latex-toolbar)) +) + +(eval-when-compile + (defvar c-enable-xemacs-performance-kludge-p) + (defvar eshell-mode-map) + (defvar riece-unread-channels) + (autoload #'ansi-color-apply-on-region "ansi-color") + (autoload #'blink-cursor-mode "blink-cursor" nil t) + (autoload #'c-mode "cc-mode" nil t) + (autoload #'c-set-style "cc-styles" nil t) + (autoload #'customize-set-variable "cus-edit" nil t) + (autoload #'dig "dig" nil t) + (autoload #'easy-mmode-define-keymap "easy-mmode") + (autoload #'executable-find "executable") + (autoload #'gnuserv-start "gnuserv" nil t) + (autoload #'hyper-apropos "hyper-apropos" nil t) + (autoload #'hyper-describe-face "hyper-apropos" nil t) + (autoload #'ibuffer-add-to-tmp-hide "ibuf-ext" nil t) + (autoload #'ibuffer-switch-to-saved-filter-groups "ibuf-ext" nil t) + (autoload #'load-sound-file "sound" nil t) + (autoload #'mail-header-parse-date "mail-parse") + (autoload #'manual-entry "man" nil t) + (autoload #'play-media-stream "sound") + (autoload #'yow "yow" nil t) + (require 'appt) + (require 'balloon-help) + (require 'browse-url) + (require 'build-rpt) + (require 'c-comment-edit) + (require 'cal-tex) + (require 'diary-lib) + (require 'efs) + (require 'filladapt) + (require 'hm--html-configuration) + (require 'howm) + (require 'ibuffer) + (require 'pending-del) + (require 'psgml) + (require 'psgml-html) + (require 'recent-files) + (require 'rsz-minibuf) + (require 'savehist) + (require 'solar) + (require 'sxell) + (require 'time) + (require 'todo-mode) + (require 'url) + (require 'url-news) + (require 'w3) + (require 'w3-java) + (require 'w3-script) + ;(require 'xwem-keyboard) + ;(require 'xwem-mpd) +) + + +;;; 00-build.el ends here diff --git a/01-vars-sy.el b/01-vars-sy.el new file mode 100644 index 0000000..76f43df --- /dev/null +++ b/01-vars-sy.el @@ -0,0 +1,135 @@ +;; 00-vars-sy.el --- Various variables -*- Emacs-Lisp -*- + +;; Copyright (C) 2007 - 2012 Steve Youngs + +;; Author: Steve Youngs +;; Maintainer: Steve Youngs +;; Created: <2007-12-02> +;; Time-stamp: +;; Download: +;; HTMLised: +;; Git Repo: git clone http://git.sxemacs.org/syinit +;; Keywords: init, compile + +;; This file is part of SYinit + +;; Redistribution and use in source and binary forms, with or without +;; modification, are permitted provided that the following conditions +;; are met: +;; +;; 1. Redistributions of source code must retain the above copyright +;; notice, this list of conditions and the following disclaimer. +;; +;; 2. Redistributions in binary form must reproduce the above copyright +;; notice, this list of conditions and the following disclaimer in the +;; documentation and/or other materials provided with the distribution. +;; +;; 3. Neither the name of the author nor the names of any contributors +;; may be used to endorse or promote products derived from this +;; software without specific prior written permission. +;; +;; THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR +;; IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +;; WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +;; DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +;; FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +;; CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +;; SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR +;; BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +;; WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE +;; OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +;; IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +;;; Commentary: +;; +;; This init file sets up a few miscelaneous variables and whatnot. +;; If anything has to be loaded very early in the boot up I'll put +;; it in here because this file is loaded first. +;; + +;;; Credits: +;; +;; The HTML version of this file was created with Hrvoje Niksic's +;; htmlize.el which is part of the XEmacs "text-modes" package. +;; + +;;; Todo: +;; +;; + +;;; Code: +;:*======================= +;:* Set default font (I do this in vars-sy.el because it is called first) +(defvar sydeffaces + '(default bold bold-italic italic) + "List symbols for default fonts.") + +(mapc + #'(lambda (font) + (remove-specifier (face-font font) 'global '(x default) nil)) + sydeffaces) + +(progn + (set-face-font 'default + (make-font-instance + "-xos4-terminus-medium-r-*-*-*-150-*-*-*-*-iso8859-*") + 'global '(x default)) + (set-face-font 'bold + (make-font-instance + "-xos4-terminus-bold-r-*-*-*-150-*-*-*-*-iso8859-*") + 'global '(x default)) + (set-face-font 'bold-italic + (make-font-instance + "-*-times-bold-i-*-*-*-140-*-*-*-*-iso8859-*") + 'global '(x default)) + (set-face-font 'italic + (make-font-instance + "-*-times-medium-i-*-*-*-140-*-*-*-*-*-*") + 'global '(x default))) + +;:*======================= +;:* Lossage Messages +;; A lot of the time I'm running some very unstable code. So I set +;; this quite high so I can catch all the help-lossage messages. +(setq view-lossage-message-count 1000) + +;:*======================= +;:* SXEmacs has a sane filename for custom-file +(unless (featurep 'sxemacs) + (setq custom-file + (expand-file-name "custom-steve.el" user-init-directory)) + (load-file custom-file)) + +;:*======================= +;:* Set the default font +(set-face-property 'default 'face "-*-Terminus-medium-r-*-*-*-140-*-*-*-*-iso8859-*") + +;:*======================= +;:* Stuff. Lots of stuff... + +(setq-default + buffers-menu-grouping-function 'group-buffers-menu-by-mode-then-alphabetically + buffers-menu-sort-function 'sort-buffers-menu-by-mode-then-alphabetically + buffers-menu-submenus-for-groups-p t + case-fold-search t + case-replace t + get-frame-for-buffer-default-instance-limit nil + mouse-yank-at-point t + next-line-add-newlines nil + overwrite-mode nil + require-final-newline t + teach-extended-commands-p t + teach-extended-commands-timeout 5 + temp-buffer-show-function 'show-temp-buffer-in-current-frame + zmacs-regions t) + +(defvar gnus-directory (paths-construct-path + (list (user-home-directory) "Gnus")) + "Gnus directory.") + +(defvar message-directory (paths-construct-path + (list (user-home-directory) "Gnus")) + "Gnus directory.") + +;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::* +(message "variables initialiased") diff --git a/02-keys-sy.el b/02-keys-sy.el new file mode 100644 index 0000000..3029359 --- /dev/null +++ b/02-keys-sy.el @@ -0,0 +1,186 @@ +;; 02-keys-sy.el --- Keybindings -*- Emacs-Lisp -*- + +;; Copyright (C) 2007 - 2012 Steve Youngs + +;; Author: Steve Youngs +;; Maintainer: Steve Youngs +;; Created: <2007-12-02> +;; Time-stamp: +;; Download: +;; HTMLised: +;; Git Repo: git clone http://git.sxemacs.org/syinit +;; Keywords: init, compile + +;; This file is part of SYinit + +;; Redistribution and use in source and binary forms, with or without +;; modification, are permitted provided that the following conditions +;; are met: +;; +;; 1. Redistributions of source code must retain the above copyright +;; notice, this list of conditions and the following disclaimer. +;; +;; 2. Redistributions in binary form must reproduce the above copyright +;; notice, this list of conditions and the following disclaimer in the +;; documentation and/or other materials provided with the distribution. +;; +;; 3. Neither the name of the author nor the names of any contributors +;; may be used to endorse or promote products derived from this +;; software without specific prior written permission. +;; +;; THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR +;; IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +;; WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +;; DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +;; FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +;; CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +;; SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR +;; BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +;; WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE +;; OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +;; IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +;;; Commentary: +;; +;; Sets up my keybindings +;; +;; BTW, there are a number of different ways to actually set a +;; keybinding in emacs and I honestly could not tell you which way +;; is best. I don't think any one way is really any better than +;; any other. I've used most (all?) of them here in this file. +;; Whichever format you like is the right one to use. :-) + +;;; Credits: +;; +;; The HTML version of this file was created with Hrvoje Niksic's +;; htmlize.el which is part of the XEmacs "text-modes" package. +;; + +;;; Todo: +;; +;; + +;;; Code: + +;:*======================= +;:* Global key bindings +(global-set-key "\C-xw" 'what-line) +(global-set-key [f2] 'undo) +(global-set-key [f3] 'find-file) +(global-set-key [(super tab)] 'lisp-complete-symbol) +(global-set-key [(meta f3)] 'view-file) +(global-set-key [f5] "\M-w") +(global-set-key [f6] "\C-y") +(global-set-key [f7] 'save-buffer) +(global-set-key [f8] 'start-kbd-macro) +(global-set-key [f9] 'end-kbd-macro) +(global-set-key [(control f8)] 'call-last-kbd-macro) +(global-set-key [(control f5)] 'sy-extent-kill-save) +(global-set-key [XF86Copy] #'copy-primary-selection) +(global-set-key [XF86Cut] #'kill-primary-selection) +(global-set-key [XF86Paste] #'yank-clipboard-selection) + +;:*======================= +;:* compose-key tô t¥pé fünky £ïttlê chãrs +(require 'x-compose) +(global-set-key "\C-cm" compose-map) + +;:*======================= +;:* cursor into first line with C-pageup +(define-key global-map '(control prior) 'beginning-of-buffer) +(define-key global-map '(control next) 'end-of-buffer) + +;:*======================= +;:* Enable menubar accelerators (double-wow!) +(setq menu-accelerator-enabled 'menu-fallback) +(setq menu-accelerator-modifiers '(super)) +(setq menu-accelerator-prefix nil) +(define-key global-map [f10] 'accelerate-menu) + +;:*======================= +;:* Popup window with buffer list ; from XEmacs FAQ (2.61) +(defun cw-build-buffers () + "Popup buffer menu." + (interactive "@") + (run-hooks 'activate-menubar-hook) + (popup-menu (car (find-menu-item current-menubar '("Buffers"))))) +(global-set-key '(control !) 'cw-build-buffers) + +;:*======================= +;:* keymapping to resize frames +(define-key global-map [(control x) (up)] #'shrink-window) +(define-key global-map [(control x) (down)] #'enlarge-window) +(define-key global-map [(control x) (left)] #'shrink-window-horizontally) +(define-key global-map [(control x) (right)] #'enlarge-window-horizontally) + +;:*======================= +;:* bind key to kill-whole-line +(global-set-key '(control ,) 'kill-entire-line) + +;:*======================= +;:* Set C-x C-b to use ibuffer +(define-key global-map [(control x) (control b)] 'ibuffer) + +;:*======================= +;:* OK, so just who the hell is sending those emails +(define-key global-map [f12] 'from) + +;:*======================= +;:* Bind the Euro to a key +(define-key global-map "\C-ce" + (lambda () + (interactive) + (insert (make-char 'latin-iso8859-15 #x24)))) + +;:*======================= +;:* Toggle in/out of eshell +(global-set-key (kbd "C-c s") 'eshell-toggle) + +;:*======================= +;:* Extra Mouse buttons (wheel etc) +;; +;; A little bragging never hurts... SXEmacs allows you to bind up to +;; 32 mouse buttons. I'm not sure about GNU/Emacs, but XEmacs only +;; lets you bind 10 (or is it 12?). OK, I've never seen a rat that +;; had 32 buttons, but you never know what these gamer kiddies will +;; want one day. :-) +(require 'mwheel) +(define-key global-map [(button4)] 'mwheel-scroll) +(define-key global-map [(button5)] 'mwheel-scroll) +(define-key global-map [(shift button4)] 'mwheel-scroll) +(define-key global-map [(shift button5)] 'mwheel-scroll) +(define-key global-map [(button9)] 'beginning-of-buffer) +(define-key global-map [(button8)] 'end-of-buffer) +(define-key global-map [(button10)] 'recenter) + +;:*======================= +;:* Numeric keypad +(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] [?.]) +(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-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-insert] [insert]) +(define-key key-translation-map [kp-delete] [delete]) +(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]) +;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +(message "Key maps set successfully") diff --git a/03-c-mode-sy.el b/03-c-mode-sy.el new file mode 100644 index 0000000..66adb9f --- /dev/null +++ b/03-c-mode-sy.el @@ -0,0 +1,115 @@ +;; 03-c-mode-sy.el --- Set up C mode -*- Emacs-Lisp -*- + +;; Copyright (C) 2007 - 2012 Steve Youngs + +;; Author: Steve Youngs +;; Maintainer: Steve Youngs +;; Created: <2007-12-02> +;; Time-stamp: +;; Download: +;; HTMLised: +;; Git Repo: git clone http://git.sxemacs.org/syinit +;; Keywords: init, compile + +;; This file is part of SYinit + +;; Redistribution and use in source and binary forms, with or without +;; modification, are permitted provided that the following conditions +;; are met: +;; +;; 1. Redistributions of source code must retain the above copyright +;; notice, this list of conditions and the following disclaimer. +;; +;; 2. Redistributions in binary form must reproduce the above copyright +;; notice, this list of conditions and the following disclaimer in the +;; documentation and/or other materials provided with the distribution. +;; +;; 3. Neither the name of the author nor the names of any contributors +;; may be used to endorse or promote products derived from this +;; software without specific prior written permission. +;; +;; THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR +;; IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +;; WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +;; DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +;; FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +;; CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +;; SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR +;; BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +;; WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE +;; OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +;; IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +;;; Commentary: +;; This sets up my C programming styles. Note, too, that with this +;; setup I am able to have different styles for different projects. +;; It is a little kludgy, but it works. + +;;; Credits: +;; +;; The HTML version of this file was created with Hrvoje Niksic's +;; htmlize.el which is part of the XEmacs "text-modes" package. +;; + +;;; Todo: +;; +;; + +;;; Code: +;:*======================= +;:* Defaults +(setq c-comment-leader " ") +(setq c-default-style + '((c-mode . "linux") + (c++-mode . "linux") + (java-mode . "java") + (python-mode . "python") + (other . "gnu"))) + +;:*======================= +;:* Special style for Linux source files +(defun linux-c-mode () + "C mode with adjusted defaults for use with the Linux kernel. + +Key-bindings: +\\{c-mode-map}" + (c-mode) + (c-set-style "linux") + (setq mode-name "Linux/C")) + +(unless (member '("^.*/linux.*/.*\\.[ch]$" . linux-c-mode) auto-mode-alist) + (add-to-list 'auto-mode-alist '("^.*/linux.*/.*\\.[ch]$" . linux-c-mode))) + +;:*======================= +;:* C style for XEmacs core source files +(defun xemacs-c-mode () + "C mode with adjusted defaults for use with XEmacs core sources. + +Key-bindings: +\\{c-mode-map}" + (c-mode) + (c-set-style "gnu") + (setq mode-name "XE/C")) + +(unless (member '("^.*/xemacs.*/.*\\.[ch]$" . xemacs-c-mode) auto-mode-alist) + (add-to-list 'auto-mode-alist '("^.*/xemacs.*/.*\\.[ch]$" . xemacs-c-mode))) + +;:*======================= +;:* C style for SXEmacs core source files +(defvar c-enable-xemacs-performance-kludge-p) +(defun sxemacs-c-mode () + "C mode with adjusted defaults for use with SXEmacs core sources. + +Key-bindings: +\\{c-mode-map}" + (c-mode) + (c-set-style "linux") + (setq mode-name "SXE/C") + (make-variable-buffer-local 'c-enable-xemacs-performance-kludge-p) + (setq c-enable-xemacs-performance-kludge-p t)) + +(unless (member '("^.*/sxemacs.*/.*\\.[ch]$" . sxemacs-c-mode) auto-mode-alist) + (add-to-list 'auto-mode-alist '("^.*/sxemacs.*/.*\\.[ch]$" . sxemacs-c-mode))) + +;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +(message "C mode initialised.") diff --git a/04-w3-sy.el b/04-w3-sy.el new file mode 100644 index 0000000..0d96443 --- /dev/null +++ b/04-w3-sy.el @@ -0,0 +1,84 @@ +;; 04-w3-sy.el --- W3 Settings -*- Emacs-Lisp -*- + +;; Copyright (C) 2007 - 2012 Steve Youngs + +;; Author: Steve Youngs +;; Maintainer: Steve Youngs +;; Created: <2007-12-02> +;; Time-stamp: +;; Download: +;; HTMLised: +;; Git Repo: git clone http://git.sxemacs.org/syinit +;; Keywords: init, compile + +;; This file is part of SYinit + +;; Redistribution and use in source and binary forms, with or without +;; modification, are permitted provided that the following conditions +;; are met: +;; +;; 1. Redistributions of source code must retain the above copyright +;; notice, this list of conditions and the following disclaimer. +;; +;; 2. Redistributions in binary form must reproduce the above copyright +;; notice, this list of conditions and the following disclaimer in the +;; documentation and/or other materials provided with the distribution. +;; +;; 3. Neither the name of the author nor the names of any contributors +;; may be used to endorse or promote products derived from this +;; software without specific prior written permission. +;; +;; THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR +;; IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +;; WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +;; DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +;; FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +;; CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +;; SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR +;; BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +;; WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE +;; OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +;; IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +;;; Commentary: +;; +;; I very rarely use W3, but it does work (I'll leave the interpretation +;; of "work" up to you) +;; + +;;; Credits: +;; +;; The HTML version of this file was created with Hrvoje Niksic's +;; htmlize.el which is part of the XEmacs "text-modes" package. +;; + +;;; Todo: +;; +;; + +;;; Code: +(setq + url-automatic-caching t + url-be-asynchronous t + url-keep-history t + url-news-use-article-mode t + url-personal-mail-address "steve@steveyoungs.com" + url-privacy-level 'none + url-proxy-services nil + w3-auto-image-alt nil + w3-default-homepage "http://localhost/" + w3-do-incremental-display t + w3-do-scripting t + w3-documentation-root "/home/steve/documents/XEmacs/w3/" + w3-honor-stylesheets t + w3-hotlist-file "~/.url/.mosaic-hotlist-default" + w3-java-vm-program "/opt/jdk/jre/bin/java_vm" + w3-latex-print-links 'footnote + w3-min-img-size 5 + w3-use-menus + '(file edit view go bookmark options buffers style search emacs nil help) + w3-use-terminal-characters t + w3-user-colors-take-precedence t + w3-user-fonts-take-precedence nil) +;:*==================================================================== +(message "W3 initialised") diff --git a/05-latex-sy.el b/05-latex-sy.el new file mode 100644 index 0000000..39f1180 --- /dev/null +++ b/05-latex-sy.el @@ -0,0 +1,283 @@ +;; 05-latex-sy.el --- LaTeX Settings -*- Emacs-Lisp -*- + +;; Copyright (C) 2007 - 2012 Steve Youngs + +;; Author: Steve Youngs +;; Maintainer: Steve Youngs +;; Created: <2007-12-02> +;; Time-stamp: +;; Download: +;; HTMLised: +;; Git Repo: git clone http://git.sxemacs.org/syinit +;; Keywords: init, compile + +;; This file is part of SYinit + +;; Redistribution and use in source and binary forms, with or without +;; modification, are permitted provided that the following conditions +;; are met: +;; +;; 1. Redistributions of source code must retain the above copyright +;; notice, this list of conditions and the following disclaimer. +;; +;; 2. Redistributions in binary form must reproduce the above copyright +;; notice, this list of conditions and the following disclaimer in the +;; documentation and/or other materials provided with the distribution. +;; +;; 3. Neither the name of the author nor the names of any contributors +;; may be used to endorse or promote products derived from this +;; software without specific prior written permission. +;; +;; THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR +;; IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +;; WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +;; DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +;; FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +;; CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +;; SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR +;; BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +;; WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE +;; OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +;; IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +;;; Commentary: +;; +;; Do you remember back in the old days when you'd write a letter +;; on a piece of paper, stick it in an envelope, put a stamp on it +;; and have the postal service deliver it for you? Well I still do +;; that and LaTeX is how I get it done. At least the writing, +;; formatting, and printing side of it anyway. + +;;; Credits: +;; +;; The HTML version of this file was created with Hrvoje Niksic's +;; htmlize.el which is part of the XEmacs "text-modes" package. +;; + +;;; Todo: +;; +;; + +;;; Code: +;:*======================= +;:* Initialise aucTeX +(require 'tex-site) +;; Latest auctex causes a split window on (S)XEmacs start up without +;; this defvaralias because of a defadvice in tex.el +(defvaralias 'minor-mode-list 'minor-mode-alist) +(require 'latex) +(require 'reftex) +(require 'reftex-vars) +;(require 'latex-units) +(require 'font-latex) + +;:*======================= +;:* Shutup the byte-compiler +(defvar ispell-extra-args) +(defvar LaTeX-mode-map) +(defvar TeX-shell) + +(setq + LaTeX-float nil + TeX-arg-cite-note-p t + TeX-arg-footnote-number-p t + TeX-arg-item-label-p nil + TeX-auto-parse-length 999999999 + TeX-auto-private + (file-name-as-directory + (expand-file-name "documents/TeXauto" (getenv "HOME"))) + TeX-auto-save t + TeX-debug-bad-boxes nil + TeX-macro-private + (file-name-as-directory + (expand-file-name "documents/TeX" (getenv "HOME"))) + TeX-outline-extra nil + TeX-parse-self t + TeX-printer-default "HP Single" + TeX-printer-list + '(("HP Single" "dvips -f %s|lpr -PHP_Single@bastard" "lpq -PHP_Single@bastard") + ("HP Duplex" "dvips -f %s|lpr -PHP_Duplex@bastard" "lpq -PHP_Duplex@bastard") + ("HP Photo" "dvips -f %s|lpr -PHP_Photo@bastard" "lpq -PHP_Photo@bastard") + ("HP draft" "dvips -f %s|lpr -PHP_draft@bastard" "lpq -PHP_draft@bastard"))) + +(setq-default LaTeX-default-options "a4paper,12pt") +(setq-default TeX-master t) + +(setq TeX-view-style '(("^a5$" "xdvi -thorough %d -paper a5") + ("^landscape$" "xdvi -thorough %d -paper a4r -s 4") + ("." "xdvi -thorough %d"))) + +;:*======================= +;:* Count words in a TeX text +(defun sds-word-count (start end) + "Count lines/words/characters from START to END. +Replacement for count-lines-region." + (interactive "r") + (let ((ost (syntax-table)) + (nst (copy-syntax-table))) + (modify-syntax-entry ?_ "w" nst) + (modify-syntax-entry ?- "w" nst) + (save-excursion + (save-restriction + (narrow-to-region start end) + (goto-char (min start end)) + (unwind-protect + (progn (set-syntax-table nst) + (message + "Region (%d to %d) has: %d lines; %d words; %d characters." + start end (count-lines start end) + (string-to-number (how-many "\\<")) + (- end start))) + (set-syntax-table ost)))))) + +;:*======================= +;:* RefTeX Minor Mode + +;; Turn on RefTeX Minor Mode for all LaTeX files +(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) + +;: RefTeX is a minor mode with distinct support for \ref, \label and +;: \cite commands in (multi-file) LaTeX documents. +(setq + reftex-default-label-alist-entries '(Sideways + AMSTeX + amsmath + endnotes + fancybox + floatfig + longtable + picinpar + rotating + sidecap + subfigure + supertab + wrapfig + LaTeX) + reftex-enable-partial-scans t + reftex-extra-bindings t + reftex-guess-label-type t + reftex-initialize-temporary-buffers t + reftex-insert-label-flags '(t t) + reftex-keep-temporary-buffers t + reftex-label-alist + '((nil ?s nil nil nil ("Capital" "Cap." "Section" "Part") -3) + (nil ?e nil nil nil ("Equation" "Eq.") -3) + (nil ?t nil nil nil ("Table") -3) + (nil ?f nil nil nil ("Figure" "Illustration" "Ill.") -3) + (nil ?n nil nil nil ("Comment") -3) + (nil ?i nil nil nil ("Point") -3)) + reftex-label-menu-flags '(t t t t t t t t) + reftex-plug-into-AUCTeX t + reftex-save-parse-info t + reftex-toc-follow-mode t + reftex-toc-include-labels t + reftex-use-multiple-selection-buffers t + reftex-vref-is-default t) + +;:*======================= +;:* Index support +;;When writing a document with an index you will probably define +;;additional macros which make entries into the index. Let's look at an +;;example. +;; \newcommand{\ix}[1]{#1\index{#1}} +;; \newcommand{\nindex}[1]{\textit{#1}\index[name]{#1}} +(setq reftex-index-macros '(("\\ix{*}" "idx" ?x "" nil nil) + ("\\nindex{*}" "name" ?n "" nil nil) + index)) + +(defun return-created-string () + "Return a \"Created:\" string." + (let ((time (current-time-string))) + (concat "Created at: " + (substring time 0 20) + (nth 1 (current-time-zone)) + " " + (substring time -4) " "))) + +;:*======================= +;:* outl-mouse-minor-mode for all LaTeX files +(defun turn-on-outl-mouse-minor-mode () + (outl-mouse-minor-mode 1)) + +;:*======================= +;* Hooks. +(add-hook 'reftex-load-hook + #'(lambda () + (define-key reftex-mode-map [(shift button2)] + 'reftex-mouse-view-crossref))) + +(add-hook 'LaTeX-mode-hook + #'(lambda () + (turn-on-auto-fill) + (setq TeX-shell "/bin/bash") + (make-local-variable 'ispell-extra-args) + (push "-t" ispell-extra-args) + (turn-on-reftex) + (add-to-list + 'TeX-command-list + '("xpdf" "xpdf %s.pdf" TeX-run-silent t nil)) + (add-to-list + 'TeX-command-list + '("gv" "gv %s.ps" TeX-run-silent t nil)) + (add-to-list + 'TeX-command-list + '("pdflatex" "pdflatex -interaction=nonstopmode %t" + TeX-run-command nil t)))) + +;; Add a couple more things if we're in X +(when (and (device-on-window-system-p) + (featurep 'latex-toolbar) + (featurep 'outl-mouse)) + (add-hook 'LaTeX-mode-hook + #'(lambda () + (turn-on-outl-mouse-minor-mode) + (latex-toolbar-install)))) + +(setq LaTeX-section-hook + '(LaTeX-section-heading + LaTeX-section-title + LaTeX-section-toc + LaTeX-section-section + LaTeX-section-label)) +;:*======================= +;:* Texinfo +;; This is _NOT_ the texinfo-mode that comes with AucTeX, because that +;; sucks. AucTeX actually loads `texinfo.el' and then overwrites +;; everything with the DAK-inspired crap! So I explicitly load it +;; here to reinstate the better `texinfo-mode'. +(require 'texinfo) + +;; `texinfo.el' uses the GNU `:inherit' property which (S)XEmacs +;; doesn't have... a quick `set-face-parent' fixes that. +;; Update: SXEmacs does have `:inherit' now, at least, I'm pretty sure +;; it does +(set-face-parent 'texinfo-heading-face 'font-lock-function-name-face) + +;; Perdy colours! +(setq texinfo-font-lock-keywords + `(("@\\([a-zA-Z]+\\|[^ \t\n]\\)" 1 font-lock-keyword-face) ;commands + ("^\\*\\([^\n:]*\\)" 1 font-lock-function-name-face t) ;menu items + ("@\\(emph\\|i\\|sc\\){\\([^}]+\\)" 2 'italic) + ("@\\(strong\\|b\\){\\([^}]+\\)" 2 'bold) + ("@\\(kbd\\|key\\|url\\|uref\\){\\([^}]+\\)" 2 font-lock-string-face) + ("@\\(file\\|email\\){\\([^}]+\\)" 2 font-lock-string-face keep) + ("@\\(samp\\|code\\|var\\|math\\|env\\|command\\|option\\){\\([^}]+\\)" + 2 font-lock-variable-name-face keep) + ("@\\(cite\\|x?ref\\|pxref\\|dfn\\|inforef\\){\\([^}]+\\)" + 2 font-lock-reference-face) ;; #### XEmacs change + ("@\\(anchor\\){\\([^}]+\\)" 2 font-lock-type-face) + ("@\\(dmn\\|acronym\\|value\\){\\([^}]+\\)" 2 font-lock-builtin-face) + ("@\\(end\\|itemx?\\) +\\(.+\\)" 2 font-lock-keyword-face keep) + (,(concat "^@\\(" (regexp-opt (mapcar 'car texinfo-section-list) t) + "\\)\\(.*\n\\)") 3 texinfo-heading-face t) + ("@c\\(omment\\)? \\(.*$\\)" 2 font-lock-comment-face) + ("@node \\(.*$\\)" 1 font-lock-warning-face) + ("^@[cfvkpt]index \\(.*$\\)" 1 font-lock-variable-name-face))) + +(defun sy-texinfo-menu () (easy-menu-add texinfo-mode-menu)) +(add-hook 'texinfo-mode-hook #'sy-texinfo-menu) +(add-hook 'texinfo-mode-hook #'font-lock-mode) +;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::* +(message "LaTeX initialised") diff --git a/06-tex-site-sy.el b/06-tex-site-sy.el new file mode 100644 index 0000000..f93feb7 --- /dev/null +++ b/06-tex-site-sy.el @@ -0,0 +1,113 @@ +;; 06-tex-site-sy.el --- Because AUCTeX is stupid -*- Emacs-Lisp -*- + +;; Copyright (C) 2007 - 2012 Steve Youngs + +;; Author: Steve Youngs +;; Maintainer: Steve Youngs +;; Created: <2007-12-02> +;; Time-stamp: +;; Download: +;; HTMLised: +;; Git Repo: git clone http://git.sxemacs.org/syinit +;; Keywords: init, compile + +;; This file is part of SYinit + +;; Redistribution and use in source and binary forms, with or without +;; modification, are permitted provided that the following conditions +;; are met: +;; +;; 1. Redistributions of source code must retain the above copyright +;; notice, this list of conditions and the following disclaimer. +;; +;; 2. Redistributions in binary form must reproduce the above copyright +;; notice, this list of conditions and the following disclaimer in the +;; documentation and/or other materials provided with the distribution. +;; +;; 3. Neither the name of the author nor the names of any contributors +;; may be used to endorse or promote products derived from this +;; software without specific prior written permission. +;; +;; THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR +;; IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +;; WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +;; DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +;; FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +;; CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +;; SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR +;; BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +;; WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE +;; OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +;; IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +;;; Commentary: +;; +;; This is just because the tex-site.el you get in the XEmacs AUCTeX +;; package is nuts. + +;;; Credits: +;; +;; The HTML version of this file was created with Hrvoje Niksic's +;; htmlize.el which is part of the XEmacs "text-modes" package. +;; + +;;; Todo: +;; +;; + +;;; Code: +(if (< emacs-major-version 21) + (error "AUCTeX requires Emacs 21 or later")) + +(defvar no-doc + "This function is part of AUCTeX, but has not yet been loaded. +Full documentation will be available after autoloading the function." + "Documentation for autoload functions.") + +(defcustom TeX-image-directory + (if (featurep 'xemacs) + (file-name-as-directory + (expand-file-name "images" (locate-data-directory "auctex"))) + (file-name-as-directory (concat TeX-lisp-directory "images"))) + "*Directory containing hand generated TeX information. +Must end with a directory separator. + +These correspond to TeX macros shared by all users of a site." + :group 'TeX-file + :type 'directory) + +(defcustom TeX-auto-global + (file-name-as-directory + (expand-file-name "auto" + (locate-data-directory "auctex"))) + "*Directory containing automatically generated information. +Must end with a directory separator. + +For storing automatic extracted information about the TeX macros +shared by all users of a site." + :group 'TeX-file + :type 'directory) + +(add-to-list 'auto-mode-alist '("\\.dtx\\'" . doctex-mode)) +(add-to-list 'auto-mode-alist '("\\.drv\\'" . latex-mode)) + +;; This hook will store bibitems when you save a BibTeX buffer. +(add-hook 'bibtex-mode-hook 'BibTeX-auto-store) +(autoload 'BibTeX-auto-store "latex" no-doc t) + +(autoload 'tex-mode "tex" no-doc t) +(autoload 'plain-tex-mode "tex" no-doc t) +(autoload 'ams-tex-mode "tex" no-doc t) +(autoload 'context-mode "context" no-doc t) +(autoload 'doctex-mode "latex" no-doc t) +(autoload 'TeX-auto-generate "tex" no-doc t) +(autoload 'TeX-auto-generate-global "tex" no-doc t) +(autoload 'TeX-insert-quote "tex" no-doc t) +(autoload 'TeX-submit-bug-report "tex" no-doc t) +(autoload 'japanese-plain-tex-mode "tex-jp" no-doc t) +(autoload 'japanese-latex-mode "tex-jp" no-doc t) +(autoload 'latex-mode "latex" no-doc t) + +;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +(message "Sane tex-site loaded successfully") + diff --git a/07-html-sy.el b/07-html-sy.el new file mode 100644 index 0000000..38e05bf --- /dev/null +++ b/07-html-sy.el @@ -0,0 +1,277 @@ +;; 07-html-sy.el --- HTML settings -*- Emacs-Lisp -*- + +;; Copyright (C) 2007 - 2012 Steve Youngs + +;; Author: Steve Youngs +;; Maintainer: Steve Youngs +;; Created: <2007-12-02> +;; Time-stamp: +;; Download: +;; HTMLised: +;; Git Repo: git clone http://git.sxemacs.org/syinit +;; Keywords: init, compile + +;; This file is part of SYinit + +;; Redistribution and use in source and binary forms, with or without +;; modification, are permitted provided that the following conditions +;; are met: +;; +;; 1. Redistributions of source code must retain the above copyright +;; notice, this list of conditions and the following disclaimer. +;; +;; 2. Redistributions in binary form must reproduce the above copyright +;; notice, this list of conditions and the following disclaimer in the +;; documentation and/or other materials provided with the distribution. +;; +;; 3. Neither the name of the author nor the names of any contributors +;; may be used to endorse or promote products derived from this +;; software without specific prior written permission. +;; +;; THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR +;; IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +;; WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +;; DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +;; FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +;; CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +;; SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR +;; BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +;; WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE +;; OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +;; IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +;;; Commentary: +;; +;; Sets up things for writing HTML. + +;;; Credits: +;; +;; The HTML version of this file was created with Hrvoje Niksic's +;; htmlize.el which is part of the XEmacs "text-modes" package. +;; + +;;; Todo: +;; +;; + +;;; Code: +;:*======================= +;:* General HTML settings. +(setq + html-helper-htmldtd-version + " +\n" + html-helper-use-expert-menu t + hm--html-automatic-create-modified-line t + hm--html-automatic-update-modified-line t + hm--html-changed-comment-prefix "Changed with SXEmacs, by: " + hm--html-created-comment-prefix "Created with SXEmacs, by: " + hm--html-expert t + hm--html-html-doctype-version + "\"-//W3C//DTD XHTML 1.0 Transitional//EN\" + \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\"" + hm--html-log-date-format "%y-%m-%d" + hm--html-template-dir + (file-name-as-directory + (expand-file-name "templates" + (locate-data-directory "hm--html-menus"))) + hm--html-frame-template-file + (expand-file-name "frame.html.tmpl" hm--html-template-dir) + hm--html-title-date-format "%y-%m-%d" + hm--html-username "Steve Youngs" + html-sigusr1-signal-value 10) + +;; SGML stuff. +(setq + sgml-auto-activate-dtd t + sgml-live-element-indicator t + sgml-validate-command "onsgmls -s -m %s %s") + +(defvar sy-sgml-dirs + (directory-files-recur "/usr/share/sgml" 'full nil nil 'subdir) + "List of directories for `sgml-system-path'.") + +(setq sgml-system-path + (append '("." + "/usr/share/sxemacs/xemacs-packages/etc/psgml-dtds/") + sy-sgml-dirs)) + +;; Run HTML Tidy over the current buffer. I don't use this yet, I've +;; only just installed HTML Tidy and haven't yet figured out how to +;; use it properly. I snarfed this function from: +;; +;; +(defun tidy-buffer () + "Run Tidy HTML parser on current buffer." + (interactive) + (if (get-buffer "tidy-errs") + (kill-buffer "tidy-errs")) + (shell-command-on-region (point-min) (point-max) + "tidy -f /tmp/tidy-errs -q -i -wrap 72 -c" t) + (find-file-other-window "/tmp/tidy-errs") + (other-window 1) + (delete-file "/tmp/tidy-errs") + (message "buffer tidy'ed")) + +(autoload 'html-mode "psgml-html" "Load psgml-html-mode" t) +(autoload 'css-mode "css-mode") + +(add-hook 'html-mode-hook #'hm--html-minor-mode) +(eval-when-compile (defvar ispell-extra-args)) +(add-hook 'html-mode-hook + #'(lambda () + (make-local-variable 'ispell-extra-args) + (push "-H" ispell-extra-args))) +(add-hook 'html-helper-timestamp-hook #'html-helper-default-insert-timestamp) + +;:*======================= +;:* Hrvoje Niksic's htmlize +;; +;; `htmlize.el' comes with the "text-modes" XEmacs package, or you +;; can get the latest version from: +;; +;; . +;; +;; `htmlize.el' is a lovely piece of code for converting Emacs buffers +;; into HTML. The default settings should be fine for most people most +;; of the time in most situations. But, by now, I'm sure that you've +;; come to the realisation that I don't fit into that category. So +;; lets hack... :-) +(eval-and-compile + (require 'htmlize)) + +;; Those "local-variables" declarations you sometimes see at the bottom +;; of source files can cause quite a bit of havoc when it comes to +;; "htmlize'ing" them. Basically what happens is that when you go to +;; save the resulting HTML buffer XEmacs goes into an infinite loop +;; complaining about bad local vars. I get around it with this next +;; function which just a simple wrapper for `htmlize-buffer'. +(defun sy-htmlize-buffer (&optional buffer) + "This is just a simple wrapper for `htmlize-buffer'. + +All it does is scan the buffer to be converted for any local variable +declarations and replaces them with a place holder. This prevents an +infloop when you go to save the resulting HTML buffer. + +Original `htmlize-buffer' doc string: + +Convert buffer to HTML, preserving the font-lock colorization. +The generated HTML is available in a new buffer, which is returned. +When invoked interactively, the new buffer is selected in the +current window." + (interactive) + (let ((htmlbuf (with-current-buffer (or buffer (current-buffer)) + (goto-char (point-min)) + (while (re-search-forward + ;; This concat is deliberately split accross + ;; 4 lines for a reason. Don't change it! + (concat "^" + comment-start + "Local" + " Variables:$") nil t) + (replace-match + (concat comment-start + " Put the normal local variables declaration here"))) + (htmlize-buffer-1) + ;; Undo that replace-match. + (when (buffer-modified-p) + (undo))))) + (when (interactive-p) + (switch-to-buffer htmlbuf)) + htmlbuf)) + +;; Use my function by default. +(defalias 'htmlize-buffer 'sy-htmlize-buffer) + +;; This function, run from `htmlize-after-hook' lets me embed HTML +;; comments inside normal source comments and also allows me to set up +;; relative hyperlinks. It has been hand-massaged after htmlizing to +;; get the desired results for its doc string. +(defun sy-htmlize-after-hook () + "Function run from `htmlize-after-hook'. + +It takes care of any relative hyperlinks and also dequotes any HTML +comments that were incorrectly quoted. + +Relative hyperlinks need to be prepared in a particular way in the +file that is to be converted to HTML. For example, in an emacs lisp +file you might see: + +Get the latest rls=/src/foo.el;rld=version here;rle. + +Which would be converted to: + +Get the latest version here." + (save-excursion + (goto-char (point-min)) + (mapcar + '(lambda (x) (save-excursion (eval x))) + '((replace-string "rls=" "") + (replace-string ";rle" "") + (replace-string "<!--" ""))))) + +;; I know that the pages generated by `htmlize.el' are valid HTML/CSS and +;; are created by SXEmacs. So I announce the fact by adding the appropriate +;; logos to the bottom of the page, together with a copyright notice. This +;; is the raw HTML for that. +(defconst sy-htmlize-appendix + " +

+
+ + +\"Created + + + + + \"Valid + + \"Valid + +

+ + +
Copyright © 2012 Steve Youngs
+ Verbatim copying and distribution is permitted in any medium, + providing this notice is preserved.
+ + +
+ +") + +;; Appends the above to each page. Run from `htmlize-after-hook'. +(defun sy-htmlize-append () + "Append some things to the end of files produced by `htmlize.el'." + (goto-char (point-max)) + (re-search-backward "" nil t) + (insert sy-htmlize-appendix)) + +;; Set a couple of basic things. +(setq + htmlize-html-charset "UTF-8" + htmlize-html-major-mode 'html-mode + htmlize-head-tags + " + +") + +;; Hooks +(add-hook 'htmlize-before-hook 'font-lock-fontify-buffer) +(add-hook 'htmlize-after-hook + #'(lambda () + (sy-htmlize-after-hook) + (sy-htmlize-append) + (font-lock-fontify-buffer))) +;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::* +(message "hm--html-mode initialised") diff --git a/08-bbdb-sy.el b/08-bbdb-sy.el new file mode 100644 index 0000000..66d4786 --- /dev/null +++ b/08-bbdb-sy.el @@ -0,0 +1,203 @@ +;; 08-bbdb-sy.el --- Big Brother DataBase (BBDB) -*- Emacs-Lisp -*- + +;; Copyright (C) 2007 - 2012 Steve Youngs + +;; Author: Steve Youngs +;; Maintainer: Steve Youngs +;; Created: <2007-12-02> +;; Time-stamp: +;; Download: +;; HTMLised: +;; Git Repo: git clone http://git.sxemacs.org/syinit +;; Keywords: init, compile + +;; This file is part of SYinit + +;; Redistribution and use in source and binary forms, with or without +;; modification, are permitted provided that the following conditions +;; are met: +;; +;; 1. Redistributions of source code must retain the above copyright +;; notice, this list of conditions and the following disclaimer. +;; +;; 2. Redistributions in binary form must reproduce the above copyright +;; notice, this list of conditions and the following disclaimer in the +;; documentation and/or other materials provided with the distribution. +;; +;; 3. Neither the name of the author nor the names of any contributors +;; may be used to endorse or promote products derived from this +;; software without specific prior written permission. +;; +;; THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR +;; IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +;; WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +;; DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +;; FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +;; CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +;; SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR +;; BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +;; WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE +;; OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +;; IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +;;; Commentary: +;; +;; BBDB settings. +;; + +;;; Credits: +;; +;; The HTML version of this file was created with Hrvoje Niksic's +;; htmlize.el which is part of the XEmacs "text-modes" package. +;; + +;;; Todo: +;; +;; + +;;; Code: +;:*======================= +;:* Make sure gnus stuff is loaded +(load-file (expand-file-name ".gnus" (user-home-directory))) + +;:*====================== +;:* Some standard stuff first +(require 'bbdb) +(require 'bbdb-pgp) + +(bbdb-initialize 'gnus 'message 'w3 'sendmail) +(bbdb-insinuate-gnus) +(bbdb-insinuate-message) +(bbdb-insinuate-sc) +(bbdb-insinuate-sendmail) +(bbdb-insinuate-w3) + +;; BBDB/PGP stuff +(setq + bbdb/pgp-method 'mml-pgpmime + bbdb/pgp-default-action 'sign + bbdb/pgp-quiet t) + +(defun sy-bbdb-gnus-auto-notes-hook (record) + "Runs `bbdb-auto-notes-hook' on the original article. +This is so a header doesn't have to be visible for BBDB to notice +any changes. +Kudos to Robert Fenk for this." + (save-excursion + (set-buffer (get-buffer gnus-article-buffer)) + (set-buffer gnus-original-article-buffer) + (goto-char (point-min)) + (bbdb-auto-notes-hook record))) + +(autoload 'gnus-convert-face-to-png "gnus-fun") + +(defun sy-bbdb-display-cx-face () + "Search for face properties and display the faces. +This is from Alex Shroeder." + (let ((inhibit-read-only t); edit the BBDB buffer + (all-records bbdb-records) + cface xface record start) + (while all-records + (setq record (caar all-records) + cface (bbdb-record-getprop record 'cface) + xface (bbdb-record-getprop record 'face) + start (marker-position (nth 2 (car all-records)))) + (when cface + (set-extent-begin-glyph + (make-extent start start) + (make-glyph + (list (vector 'png :data (gnus-convert-face-to-png cface))))) + (insert " ")) + (when xface + (set-extent-begin-glyph + (make-extent start start) + (make-glyph + (list (vector 'xface :data (concat "X-Face: " xface) + :foreground "black" + :background "white")))) + (insert " ")) + (setq all-records (cddr all-records))))) + +(setq + bbdb-always-add-addresses t + bbdb-canonicalize-redundant-nets-p t + bbdb-canonicalize-net-hook + (lambda (addr) + (cond + ((string-match + "\\`\\([^0-9]+\\)\\(-dated-[^@]+\\|-[0-9]+\\|\\+[^@]+\\.[^@]+\\)\\(@.*\\)\\'" + addr) + (concat (substring addr (match-beginning 1) (match-end 1)) + (substring addr (match-beginning 3) (match-end 3)))) + (t addr))) + bbdb-complete-name-allow-cycling t + bbdb-completion-display-record t + bbdb-completion-type 'primary-or-name + bbdb-default-area-code 7 + bbdb-dial-local-prefix nil + bbdb-display-layout 'multi-line + bbdb-dwim-net-address-allow-redundancy t + bbdb-electric-p nil + bbdb-new-nets-always-primary 'never + bbdb-north-american-phone-numbers-p nil + bbdb-notice-hook 'sy-bbdb-gnus-auto-notes-hook + bbdb-offer-save 'auto + bbdb-pop-up-display-layout 'multi-line + bbdb-pop-up-target-lines 7 + bbdb-quiet-about-name-mismatches nil + bbdb-use-pop-up nil + bbdb/gnus-score-default 25 + bbdb/gnus-summary-in-bbdb-format-letter "X" + bbdb/mail-auto-create-p nil + bbdb/news-auto-create-p nil) + +;:*======================= +;:* All my email addresses, well the important ones anyway. +(let ((emails '("steve@steveyoungs.com" + "steve@thereadinglamp.net" + "steve@bastard.steveyoungs.com" + "steve@sxemacs.org" + "steve@emchat.org" + "sryoungs@iinet.net.au" + "jackalx@gmail.com"))) + (setq bbdb-user-mail-names (regexp-opt emails t))) + +;:*======================= +;:* Update some stuff automatically +(setq bbdb-auto-notes-alist + '(("Organization" + (".*" company 0 'replace)) + ("Newsgroups" + ("[^,]+" newsgroups 0)) + ("Subject" + (".*" last-subj 0 'replace)) + ("User-Agent" + (".*" mailer 0 'replace)) + ("X-Mailer" + (".*" mailer 0 'replace)) + ("X-Newsreader" + (".*" mailer 0 'replace)) + ("X-Attribution" + (".*" attribution 0 'replace)) + ("X-Now-Playing" + (".*" music 0 'replace)) + ("X-Face" + (".+" face 0 'replace)) + ("Face" + (".+" cface 0 'replace)))) + +;:*======================= +;:* mail aliases +(autoload 'bbdb-define-all-aliases "bbdb-com" + "Hook mail alias feature of BBDB into message-mode." t) + +;:*======================= +;:* Hooks +(add-hook 'bbdb-notice-hook 'bbdb-auto-notes-hook) +(add-hook 'bbdb-change-hook 'bbdb-timestamp-hook) +(add-hook 'bbdb-create-hook 'bbdb-creation-date-hook) +(add-hook 'bbdb-list-hook 'sy-bbdb-display-cx-face) +(add-hook 'message-setup-hook 'bbdb-define-all-aliases) +;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::* +(message "bbdb initialised") + diff --git a/09-sounds-sy.el b/09-sounds-sy.el new file mode 100644 index 0000000..1480fab --- /dev/null +++ b/09-sounds-sy.el @@ -0,0 +1,90 @@ +;; 09-sounds-sy.el --- Sound set up -*- Emacs-Lisp -*- + +;; Copyright (C) 2007 - 2012 Steve Youngs + +;; Author: Steve Youngs +;; Maintainer: Steve Youngs +;; Created: <2007-12-02> +;; Time-stamp: +;; Download: +;; HTMLised: +;; Git Repo: git clone http://git.sxemacs.org/syinit +;; Keywords: init, compile + +;; This file is part of SYinit + +;; Redistribution and use in source and binary forms, with or without +;; modification, are permitted provided that the following conditions +;; are met: +;; +;; 1. Redistributions of source code must retain the above copyright +;; notice, this list of conditions and the following disclaimer. +;; +;; 2. Redistributions in binary form must reproduce the above copyright +;; notice, this list of conditions and the following disclaimer in the +;; documentation and/or other materials provided with the distribution. +;; +;; 3. Neither the name of the author nor the names of any contributors +;; may be used to endorse or promote products derived from this +;; software without specific prior written permission. +;; +;; THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR +;; IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +;; WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +;; DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +;; FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +;; CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +;; SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR +;; BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +;; WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE +;; OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +;; IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +;;; Commentary: +;; +;; Just sets up sound stuff. +;; + +;;; Credits: +;; +;; The HTML version of this file was created with Hrvoje Niksic's +;; htmlize.el which is part of the XEmacs "text-modes" package. +;; + +;;; Todo: +;; +;; + +;;; Code: +;:*======================= +;:* Set default sound device +(when (getenv "DISPLAY") ; skip the lot if not in X11 + (setq default-audio-device (make-audio-device 'pulse)) + + ;; (setq default-audio-device (make-audio-device 'ao :driver "alsa")) + ;; (setq default-audio-device (make-audio-device 'alsa :device "plughw:0,0")) + + (init-workers 6) + (setq synchronous-sounds nil) + (load "sound") + (setq bell-volume 100) + (when (device-sound-enabled-p) + (load-sound-file "low-smash" 'auto-save-error) + (load-sound-file "bark" 'command-error) + (load-sound-file "slap" 'undefined-key) + (load-sound-file "slap" 'undefined-click) + (load-sound-file "clink" 'no-completion) + (load-sound-file "bong" 'y-or-n-p) + (load-sound-file "explosion" 'yes-or-no-p) + (load-sound-file "drip" 'buffer-bound) + (load-sound-file "whip" 'read-only) + (load-sound-file "bass-snap" 'default) + (load-sound-file "yeep" 'quit) + (load-sound-file "drum-beep" 'isearch-failed) + (load-sound-file "bass-snap" 'isearch-quit) + (load-sound-file "slap" 'ready) + (load-sound-file "return" 'warp) + (load-sound-file "cuckoo" 'alarm)) + ) +;:*:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +(message "sounds loaded") diff --git a/10-toolbar-sy.el b/10-toolbar-sy.el new file mode 100644 index 0000000..e1d8b10 --- /dev/null +++ b/10-toolbar-sy.el @@ -0,0 +1,121 @@ +;; 10-toolbar-sy.el --- Toolbar set up -*- Emacs-Lisp -*- + +;; Copyright (C) 2007 - 2012 Steve Youngs + +;; Author: Steve Youngs +;; Maintainer: Steve Youngs +;; Created: <2007-12-02> +;; Time-stamp: +;; Download: +;; HTMLised: +;; Git Repo: git clone http://git.sxemacs.org/syinit +;; Keywords: init, compile + +;; This file is part of SYinit + +;; Redistribution and use in source and binary forms, with or without +;; modification, are permitted provided that the following conditions +;; are met: +;; +;; 1. Redistributions of source code must retain the above copyright +;; notice, this list of conditions and the following disclaimer. +;; +;; 2. Redistributions in binary form must reproduce the above copyright +;; notice, this list of conditions and the following disclaimer in the +;; documentation and/or other materials provided with the distribution. +;; +;; 3. Neither the name of the author nor the names of any contributors +;; may be used to endorse or promote products derived from this +;; software without specific prior written permission. +;; +;; THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR +;; IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +;; WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +;; DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +;; FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +;; CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +;; SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR +;; BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +;; WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE +;; OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +;; IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +;;; Commentary: +;; +;; Sets up the toolbar the way I like it. + +;;; Credits: +;; +;; The HTML version of this file was created with Hrvoje Niksic's +;; htmlize.el which is part of the XEmacs "text-modes" package. +;; + +;;; Todo: +;; +;; + +;;; Code: +;; Re-organise the default toolbar. +(when (featurep 'toolbar) + (setq + toolbar-info-use-separate-frame t + toolbar-mail-reader 'gnus + toolbar-news-use-separate-frame t) + (customize-set-variable 'toolbar-captioned-p nil)) + +(setq edit-toolbar-added-buttons-alist 'nil) + +(mapcar + (lambda (cons) + (setf (symbol-value (car cons)) (toolbar-make-button-list (cdr cons)))) + edit-toolbar-added-buttons-alist) + +(defun toolbar-redo () + (interactive) + (call-interactively #'redo)) + +(defvar toolbar-redo-icon + (toolbar-make-button-list + (expand-file-name "redo.xpm" + (file-name-as-directory + (expand-file-name "etc/SXEmacs" + (getenv "HOME")))))) + +(defun toolbar-irc () + (interactive) + (call-interactively #'sy-riece)) + +(defvar toolbar-irc-icon + (toolbar-make-button-list + (locate-data-file "irc@32x32.png"))) + +(defun toolbar-emoney () + (interactive) + (call-interactively #'emoney)) + +(defvar toolbar-emoney-icon + (toolbar-make-button-list + (locate-data-file "emoney.png"))) + +(and (device-on-window-system-p) + (set-specifier default-toolbar + '([toolbar-file-icon toolbar-open t "Open a file"] + [toolbar-folder-icon toolbar-dired t "Edit a directory"] + [toolbar-disk-icon toolbar-save t "Save buffer"] + [toolbar-printer-icon toolbar-print t "Print buffer"] + [toolbar-cut-icon toolbar-cut t "Kill region"] + [toolbar-copy-icon toolbar-copy t "Copy region"] + [toolbar-paste-icon toolbar-paste t "Paste from clipboard"] + [toolbar-undo-icon toolbar-undo t "Undo"] + [toolbar-redo-icon toolbar-redo t "Redo"] + [toolbar-spell-icon toolbar-ispell t "Check spelling"] + [toolbar-replace-icon toolbar-replace t "Search & Replace"] + [toolbar-compile-icon toolbar-compile t "Start a compilation"] + [toolbar-debug-icon toolbar-debug t "Start a debugger"] + [toolbar-emoney-icon toolbar-emoney t "Manage your millions with eMoney"] + [toolbar-irc-icon toolbar-irc t "Be productive with Riece"] + [toolbar-news-icon gnus-other-frame t "Gnus"] + nil + [toolbar-info-icon toolbar-info t "Don't Panic!!"]))) +;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +(message "Toolbar set successfully") diff --git a/11-pkgs-sy.el b/11-pkgs-sy.el new file mode 100644 index 0000000..a2c6198 --- /dev/null +++ b/11-pkgs-sy.el @@ -0,0 +1,643 @@ +;; 11-pkgs-sy.el --- Various XE Package Settings -*- Emacs-Lisp -*- + +;; Copyright (C) 2007 - 2012 Steve Youngs + +;; Author: Steve Youngs +;; Maintainer: Steve Youngs +;; Created: <2007-12-02> +;; Time-stamp: +;; Download: +;; HTMLised: +;; Git Repo: git clone http://git.sxemacs.org/syinit +;; Keywords: init, compile + +;; This file is part of SYinit + +;; Redistribution and use in source and binary forms, with or without +;; modification, are permitted provided that the following conditions +;; are met: +;; +;; 1. Redistributions of source code must retain the above copyright +;; notice, this list of conditions and the following disclaimer. +;; +;; 2. Redistributions in binary form must reproduce the above copyright +;; notice, this list of conditions and the following disclaimer in the +;; documentation and/or other materials provided with the distribution. +;; +;; 3. Neither the name of the author nor the names of any contributors +;; may be used to endorse or promote products derived from this +;; software without specific prior written permission. +;; +;; THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR +;; IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +;; WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +;; DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +;; FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +;; CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +;; SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR +;; BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +;; WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE +;; OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +;; IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +;;; Commentary: +;; +;; Lots of settings for various XEmacs packages that I use. Plus a +;; few other packages. +;; +;; I want to point out that I DO NOT blindly install the "sumo" +;; packages. I only install what I need and use. And I absolutely +;; DO NOT have the "fsf-compat" package installed. + +;;; Credits: +;; +;; The HTML version of this file was created with Hrvoje Niksic's +;; htmlize.el which is part of the XEmacs "text-modes" package. +;; + +;;; Todo: +;; +;; + +;;; Code: +;:*====================== +;:* MusicPD (Not an XEmacs package) +(require 'mpd) + +(defun sy-mpd-play () + "Start playing music from a randomly chosen playlist." + (interactive) + (mpd-send "clear") + (mpd-send "load Full-sorted.playlist") + (mpd-send "random 1") + (mpd-send "repeat 1") + (mpd-playpause)) + +(defun 2001-mpd-play () + "Start playing 2001 audio book." + (interactive) + (mpd-send "clear") + (mpd-send "load 2001_A_Space_Odyssey.playlist") + (mpd-send "random 0") + (mpd-send "repeat 0") + (mpd-playpause)) + +;; Audio keybindings +(global-set-key [XF86AudioPlay] #'mpd-playpause) +(global-set-key [XF86AudioStop] #'mpd-stop) +(global-set-key [XF86AudioNext] #'mpd-next-track) +(global-set-key [XF86AudioPrev] #'mpd-previous-track) +(global-set-key [XF86AudioRaiseVolume] #'mpd-volume-up) +(global-set-key [XF86AudioLowerVolume] #'mpd-volume-down) +(global-set-key [XF86AudioMute] #'mpd-volume-mute/unmute) + +;; Mpd frame props +;(push (cons 'override-redirect t) mpd-dock-frame-plist) +(push (cons 'left 1568) mpd-dock-frame-plist) +(push (cons 'top 360) mpd-dock-frame-plist) +(push (cons 'internal-border-width 4) mpd-dock-frame-plist) +(push (cons 'border-width 1) mpd-dock-frame-plist) +(push (cons 'border-color "red") mpd-dock-frame-plist) + + +;:*====================== +;; pcl-cvs - a GNU Emacs front-end to CVS +;; Does anyone use CVS anymore? +;(autoload 'cvs-update "pcl-cvs" nil t) +;(setq +; cvs-reuse-cvs-buffer 'always +; cvs-add-default-message "Initial version" +; cvs-allow-dir-commit t) + +;:*====================== +;:* View-process (`top' for emacs) +(require 'view-process-mode) +(setq View-process-host-names-and-system-types + '(("bastard.steveyoungs.com" + ("linux" nil "bsd" + View-process-field-name-descriptions-linux + View-process-kill-signals-linux)))) +(setq View-process-status-command-switches-system-v "auxw") +(setq View-process-ps-header-window-offset 3) +(add-hook 'View-process-header-mode-hook + (lambda () + (set-specifier horizontal-scrollbar-visible-p nil (current-buffer)) + (set-specifier vertical-scrollbar-visible-p nil (current-buffer)))) + +;:*===================== +;:* whitespace-mode +(autoload 'whitespace-mode "whitespace-mode" + "Toggle whitespace mode. + With arg, turn whitespace mode on iff arg is positive. In + whitespace mode the different whitespaces (tab, blank return) are + highlighted with different faces. The faces are: + `whitespace-blank-face', `whitespace-tab-face' and + `whitespace-return-face'." + t) + +(autoload 'whitespace-incremental-mode "whitespace-mode" + "Toggle whitespace incremental mode. + With arg, turn whitespace incremental mode on iff arg is positive. + In whitespace incremental mode the different whitespaces (tab and + blank) are highlighted with different faces. The faces are: + `whitespace-blank-face' and `whitespace-tab-face'. Use the command + `whitespace-show-faces' to show their values. In this mode only + these tabs and blanks are highlighted, which are in the region from + (point) - (window-heigh) to (point) + (window-heigh)." + t) + +;:*====================== +;:* func-menu +(add-hook 'find-file-hooks 'fume-setup-buffer) +(add-hook 'Manual-mode-hook 'turn-on-fume-mode) +(define-key global-map "\C-cl" 'fume-list-functions) +(define-key global-map "\C-cg" 'fume-prompt-function-goto) +(define-key global-map '(control button3) 'mouse-function-menu) +(setq + fume-display-in-modeline-p t + fume-menubar-menu-location "File") + +;:*====================== +;:* font-lock +(remove-hook 'font-lock-mode-hook 'turn-on-fast-lock) +(require 'font-lock) + +;:*====================== +;:* recent-files.el --- Maintain menu of recently opened files. +(when (featurep 'menubar) + (require 'recent-files) + (setq recent-files-non-permanent-submenu t) + (recent-files-initialize)) + +;:*====================== +;:* jka-compr +;; Handle automatic (de)compresion of [bg]zip files +(require 'jka-compr) +(jka-compr-install) + +;:*====================== +;:* iswitchb +;: A really cool package to switch buffers +(require 'iswitchb) +(setq iswitchb-default-method 'samewindow) +(iswitchb-default-keybindings) +(add-hook + 'iswitchb-define-mode-map-hook + '(lambda () + (define-key iswitchb-mode-map " " 'iswitchb-next-match) + (define-key iswitchb-mode-map [(control ?\ )] 'iswitchb-prev-match) + (define-key iswitchb-mode-map "\C-a" 'iswitchb-toggle-ignore))) + +;:*====================== +;:* backup +;: move all backups in one directory +(require 'backup-dir) +(setq bkup-backup-directory-info + '((t "~/.autosave/" ok-create full-path))) +(setq version-control 'preserve-prefer-numbered) +(setq-default delete-old-versions t) + +;:*====================== +;:* Load minibuffer history, but only if mule or file-coding is available +(when (featurep '(or mule file-coding)) + (require 'savehist) + (setq savehist-file (expand-file-name "history" user-init-directory)) + (setq savehist-coding-system + (coding-system-name (find-coding-system 'iso-8859-1))) + (savehist-mode 1)) + +;:*====================== +;:* Kyle Jones' redo package. +(when running-xemacs + (require 'redo) + (global-set-key "\C-^" 'redo) ; for tty-s... + (global-set-key [(control ?6)] 'redo) ; ...and for X + (global-set-key "\M-_" 'redo)) ; universal +(require 'scroll-in-place) + +;:*====================== +;:* pending-del +;: Non-nil when Pending Delete mode is enabled. In Pending Delete mode, typed +;: text replaces the selected region. Normally, you shouldn't modify this +;: variable by hand, but use the function `pending-delete-mode' instead. However, +;: you can customize the default value from the options menu (auto delete +;: selection). +(require 'pending-del) +(turn-on-pending-delete nil) + +;:*====================== +;:* comment-region +;: Comment or uncomment each line in the region. +;: Comments are terminated on each line, even for syntax in which newline does +;: not end the comment. Blank lines do not get comments. +(global-set-key '(control f12) 'comment-region) +(global-set-key '(meta f12) 'uncomment-region) + +;:*====================== +;:* parens that mark sexpressions +(require 'paren) +(paren-set-mode 'paren) + +;:*====================== +;:* easy editing of crontab files +(require 'crontab-edit "crontab.elc") +(setq crontab-delete-blank-lines nil) +(setq crontab-filename (expand-file-name ".crontab" (user-home-directory))) +(setq crontab-directory + (paths-construct-path '("spool" "cron" "crontabs") "/var")) + +;:*====================== +;:* a major mode for editing X resource database files +(autoload 'xrdb-mode "xrdb-mode" "Mode for editing X resource files" t) + +;:*====================== +;:* Footnote package +(require 'footnote) + +;:*====================== +;:* Filladapt-Mode +(require 'filladapt) +(setq-default filladapt-mode t) +(setq filladapt-fill-column-tolerance 5) +(add-hook 'c-mode-hook 'turn-off-filladapt-mode) + +;:*====================== +;:* Speedbar +(setq + speedbar-query-confirmation-method 'none-but-delete + speedbar-show-unknown-files t + speedbar-tag-hierarchy-method '(speedbar-prefix-group-tag-hierarchy + speedbar-trim-words-tag-hierarchy + speedbar-simple-group-tag-hierarchy + speedbar-sort-tag-hierarchy) + speedbar-track-mouse-flag t + speedbar-use-tool-tips-flag t + speedbar-visiting-tag-hook 'speedbar-recenter-to-top) + +(when (featurep 'menubar) + (add-menu-button '("Tools") + ["Speedbar" speedbar-frame-mode + :style toggle + :selected (and (boundp 'speedbar-frame) + (frame-live-p speedbar-frame) + (frame-visible-p speedbar-frame))] + "--")) +(global-set-key [(f4)] 'speedbar-get-focus) +(require 'sb-info) +(require 'sb-texinfo) +(eval-after-load "speedbar" '(load-library "sb-texinfo")) +(eval-after-load "speedbar" '(load-library "sb-html")) +(autoload 'w3-speedbar-buttons "sb-w3" + "W3 specific speedbar button generator.") + +;; Speedbar frame props (so I can use matched windows in Sawfish) +(setq speedbar-frame-plist + (plist-put speedbar-frame-plist 'name "Speedbar::Frame")) +;:*====================== +;:* Shell-mode +(autoload 'ansi-color-for-comint-mode-on "ansi-color" nil t) +(add-hook 'shell-mode-hook 'ansi-color-for-comint-mode-on) +(add-hook 'shell-mode-hook 'turn-on-font-lock) + +;:*======================= +;:* Shell-script +(setq sh-basic-offset 8) + +;:*====================== +;:* Compile-Mode +(setq + compilation-always-signal-completion t + mode-compile-make-program "make" + compilation-read-command t + compilation-window-height 10 + compile-command "make") + +;:*====================== +;:* Balloon Help (now in calendar settings) + +;:*====================== +;:* Version Control +(vc-load-vc-hooks) +(setq + vc-handled-backends '(Arch SVN GIT CVS MCVS RCS) + vc-follow-symlinks t) + +;:*====================== +;:* Ediff & Diff-mode +(require 'ediff) +(require 'diff-mode) +(setq ediff-use-toolbar-p nil ; was t but plays havoc with xwem + ediff-custom-diff-options "-u" + ediff-window-setup-function 'ediff-setup-windows-plain) +(setq diff-switches "-u") + +;:*===================== +;:* Tramp +(require 'tramp) +(setq tramp-default-method "ssh" + tramp-auto-save-directory "~/.autosave/" + tramp-remote-path + '("/usr/lib/pkgusr" + "/usr/bin" + "/bin" + "/usr/X11R6/bin")) + +; :*====================== +; :* Eshell +;(require 'pcmpl-arch) +(setq + eshell-ask-to-save-history 'always + eshell-save-history-on-exit t + eshell-banner-message (concat "Welcome to Eshell on " + (system-name) + ", running " + (shell-command-to-string "uname -rs") + "In: " + emacs-version + "\n\n") + eshell-hist-ignoredups t + eshell-modules-list '(eshell-alias + eshell-banner + eshell-basic + eshell-cmpl + eshell-dirs + eshell-glob + eshell-hist + eshell-ls + eshell-pred + eshell-prompt + ;eshell-rebind + eshell-script + eshell-smart + eshell-term + eshell-unix + eshell-xtra)) + +(defun sy-eshell-bol-maybe (&optional prompt) + "*Move point to beginning of command or bol if there already. + If at bol, move point to beginning of command. + Optional arg, PROMPT is a regexp of your eshell prompt." + (interactive) + (let* ((prompt (or prompt "^.+ [$%] ")) + (lbpos (point-at-bol)) + (prspos (save-excursion + (goto-char lbpos) + (search-forward-regexp prompt (point-at-eol) t))) + (cpos (point))) + (goto-char + (cond ((null prspos) + lbpos) + ((= cpos (or prspos 0)) + lbpos) + (prspos) + (t lbpos))))) + +(defun sy-eshell-bol-maybe-key () + (define-key eshell-mode-map [(control ?a)] 'sy-eshell-bol-maybe)) + +(add-hook 'eshell-mode-hook 'sy-eshell-bol-maybe) +(add-hook 'eshell-mode-hook 'sy-eshell-bol-maybe-key t) + +(defun sy-esh-cdl (&optional type) + "Eshell function to find current kernel's build or source dir. + + Non-nil TYPE means find the current kernel's build directory, otherwise + find the source directory." + (let* ((base "/lib/modules/") + (ver (substring (shell-command-to-string "uname -r") 0 -1)) + (dir (file-name-as-directory + (concat base ver "/" + (if type + "build" + "source"))))) + (cd dir))) + +(defun cdls () + "Change directory to current kernel source directory. + + Convenience function to use with Eshell." + (interactive) + (sy-esh-cdl)) + +(defun cdlb () + "Change directory to current kernel build directory. + + Convenience function to use with Eshell." + (interactive) + (sy-esh-cdl 'build)) + +; :*====================== +; :* FFAP -- Find File At Point +(require 'ffap) + +(setq + ffap-bindings + (nconc + '((global-set-key '(shift button3) 'ffap-at-mouse) + (global-set-key '(control shift button3) 'ffap-menu) + (global-set-key "\C-x\C-f" 'find-file-at-point) + (global-set-key "\C-x4f" 'ffap-other-window) + (global-set-key "\C-x5f" 'ffap-other-frame))) + ffap-machine-p-known 'accept + ffap-machine-p-unknown 'accept + ffap-machine-p-local 'accept) + +(ffap-bindings) +(add-hook 'mouse-track-click-hook 'ffap-mouse-track-click) + +;:*====================== +;:* Auto-Insert +(require 'auto-insert-tkld) + +(setq auto-insert-alist '(("\\.texi\\(nfo\\)?$" . "TeXinfo") + ("\\.c$" . "C") + ("\\.cc$" . "C++") + ("\\.h$" . "C Header") + ("\\.el$" . "Emacs Lisp") + ("[Mm]akefile" . "Makefile") + ("\\.sh$" . "Sh") + ("\\.pl$" . "Perl"))) + +(setq auto-insert-type-alist '(("TeXinfo" . "texinfo-insert.texi") + ("C" . "c-insert.c") + ("C Header" . "h-insert.h") + ("C++" . "c++-insert.cc") + ("Emacs Lisp" . "elisp-insert.el") + ("Makefile" . "makefile.inc") + ("Perl" . "perl-insert.pl") + ("Sh" . "sh-insert.sh"))) + +(add-to-list 'auto-insert-path '"~/etc/SXEmacs/templates/") + +;; Don't auto-insert into AucTeX style .els +(defadvice TeX-auto-store (around no-auto-insert activate) + "Ensure auto-insert is deactivated" + (let ((auto-insert-automatically nil)) + ad-do-it)) +(message "Auto-Insert initialised!") +;:*====================== +;:* XEtla +; I don't think anyone uses tla anymore +;(require 'xetla) +;(setq +; xetla-show-internal-buffers-on-menu nil +; xetla-switch-to-buffer-mode 'single-window +; xetla-use-arrow-keys-for-navigation t) +;(defun sy-xetla-reload () +; "Reload XEtla." +; (interactive) +; (call-interactively 'xetla-reload) +; (require 'xetla-browse) +; (setq +; xetla-show-internal-buffers-on-menu nil +; xetla-switch-to-buffer-mode 'single-window +; xetla-use-arrow-keys-for-navigation t)) + +;:*======================= +;:* My git shit +(require 'sy-git) + +;:*====================== +;:* Emacs Lisp List +(defvar sxell-initialised-flag) +(defvar sxell-download-directory) +(when (and (featurep '(and sxemacs postgresql)) + (fboundp 'ffi-defun)) + (require 'sxell) + (setq sxell-initialised-flag t + sxell-download-directory + (file-name-as-directory (expand-file-name "download/SXEmacs" + (user-home-directory))))) +;:*====================== +;:* EasyPG +(require 'epa-setup) + +(defun sy-epa-export-key () + "Wrapper for `epa-export-keys' to export ASCII armoured keys." + (interactive) + (let ((epa-armor t)) + (call-interactively #'epa-export-keys))) + +(define-key epa-key-list-mode-map [?O] #'sy-epa-export-key) + +;:*======================= +;:* Howm thing. (this needs mule, but that is default so no biggie) +(require 'howm) + +;; howm has the unfortunate name that ends in `wm' which is what +;; winmgr-mode uses, so nuke winmgr-mode from auto-mode-alist +(remove-alist 'auto-mode-alist "\\.[^/]*wm2?\\(?:rc\\)?\\'") + +;; The howm people are stupid, they bind C-h to scroll-down in the howm +;; menu. Get rid of it and replace with DEL +(define-key howm-menu-mode-map "\C-h" nil) +(define-key howm-menu-mode-map [delete] 'scroll-down) + +;; Another problem with howm... it fucks up window configuration +(defadvice howm-keyword-search (before howm-save-kw (&rest args) activate) + "Save window configuration before viewing howm buffers." + (window-configuration-to-register ?h)) + +(defadvice howm-list-grep-fixed (before howm-save-win1 (&rest args) activate) + "Save window configuration before viewing howm buffers." + (window-configuration-to-register ?h)) + +(defadvice howm-list-grep (before howm-save-win (&rest args) activate) + "Save window configuration before viewing howm buffers." + (window-configuration-to-register ?h)) + +(defadvice riffle-kill-buffer (after howm-restore-win (&rest args) activate) + "Restore the original window configuration." + (jump-to-register ?h)) + +(setq howm-directory "~/.howm") + +;; howm fucks up font-lock'ing like you wouldn't believe, adding a +;; call to `turn-on-font-lock' here at least restores a certain level +;; of normalcy. +(defun turn-on-howm-mode () + (turn-on-font-lock) + (howm-mode 1)) + +(defun turn-off-howm-mode () + (howm-mode 0)) + +;; Turn it on where I need it +(add-hook 'lisp-interaction-mode-hook #'turn-on-howm-mode) +;; You gotta be fooking kidding me, this prevents lisp-initd.el from +;; compiling the generated .el +;; (add-hook 'emacs-lisp-mode-hook #'turn-on-howm-mode) +(add-hook 'text-mode-hook #'turn-on-howm-mode) +(add-hook 'latex-mode-hook #'turn-on-howm-mode) +(add-hook 'c-mode-hook #'turn-on-howm-mode) +(add-hook 'sh-mode-hook #'turn-on-howm-mode) + +;; Turn it off where I don't +(add-hook 'emchat-log-mode-hook #'turn-off-howm-mode) +(add-hook 'html-mode-hook #'turn-off-howm-mode) +(add-hook 'texinfo-mode-hook #'turn-off-howm-mode) + +;;; Various other howm problem fixes + +;; I'm having a big problem with howm/font-lock/message-mode playing +;; nicely together. This gives me font-locking in message-mode, plus +;; howm functionality, but no howm font-locking. I can live without +;; howm font-lock in one buffer. +(add-hook 'message-mode-hook #'(lambda () + (font-lock-mode) + (font-lock-mode))) +;; XEtla/howm probs +;(add-hook 'xetla-changelog-mode-hook #'turn-on-font-lock) +;(add-hook 'xetla-log-edit-mode-hook #'turn-on-font-lock) +;; ChangeLogs +(add-hook 'change-log-mode-hook #'font-lock-mode) + +;;:*===================== +;;:* snap! +;; save/load snapshot of application to/from text +;; Usage: +;; +;; (1) M-x snap-record on application, e.g. Wanderlust. +;; (2) Yank (C-y) on any buffer, e.g. *scratch* or ~/memo.txt. +;; (3) M-x snap-play on yanked text ==> snapshot (1) is restored. +(require 'snap) + +;;;; env var trickery. +(setq snap-abbreviate-environment-variables + '("HOME" "JAVA_HOME" "module_path")) + +(defadvice snap-abbreviate-file-name (around env-var (raw-path) activate) + ad-do-it + (let ((path (expand-file-name raw-path)) + (rules (mapcar #'(lambda (var) + (let ((val (getenv var))) + (and val + (cons (concat "^" (regexp-quote val)) + (format "${%s}" var))))) + snap-abbreviate-environment-variables))) + (mapc #'(lambda (r) + (when (and r (string-match (car r) path)) + (setq ad-return-value + (replace-regexp-in-string (car r) (cdr r) path)))) + (reverse rules)))) + +;; Bookmark extras +(eval-after-load "bookmark" + (progn + (ad-enable-advice 'bookmark-buffer-file-name 'around 'with-snap) + (ad-enable-advice 'bookmark-jump-noselect 'around 'with-snap))) + +;; ffap extras +(setq ffap-url-regexp snap-ffap-url-regexp) +(setq ffap-url-fetcher snap-ffap-url-fetcher) + +;:*======================= +;:* ElDoc (handy thingy dingy for lisp programming) +;; displays function args and var doc strings in echo area +;(setq eldoc-use-idle-timer-p nil) +;(autoload #'turn-on-eldoc-mode "eldoc" nil t) +;(add-hook 'emacs-lisp-mode-hook #'turn-on-eldoc-mode) +;(add-hook 'lisp-interaction-mode-hook #'turn-on-eldoc-mode) + +;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::* +(message "packages loaded") diff --git a/12-cal-sy.el b/12-cal-sy.el new file mode 100644 index 0000000..892f025 --- /dev/null +++ b/12-cal-sy.el @@ -0,0 +1,586 @@ +;; 12-cal-sy.el --- Calendar Settings -*- Emacs-Lisp -*- + +;; Copyright (C) 2007 - 2012 Steve Youngs + +;; Author: Steve Youngs +;; Maintainer: Steve Youngs +;; Created: <2007-12-02> +;; Time-stamp: +;; Download: +;; HTMLised: +;; Git Repo: git clone http://git.sxemacs.org/syinit +;; Keywords: init, compile + +;; This file is part of SYinit + +;; Redistribution and use in source and binary forms, with or without +;; modification, are permitted provided that the following conditions +;; are met: +;; +;; 1. Redistributions of source code must retain the above copyright +;; notice, this list of conditions and the following disclaimer. +;; +;; 2. Redistributions in binary form must reproduce the above copyright +;; notice, this list of conditions and the following disclaimer in the +;; documentation and/or other materials provided with the distribution. +;; +;; 3. Neither the name of the author nor the names of any contributors +;; may be used to endorse or promote products derived from this +;; software without specific prior written permission. +;; +;; THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR +;; IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +;; WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +;; DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +;; FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +;; CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +;; SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR +;; BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +;; WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE +;; OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +;; IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +;;; Commentary: +;; +;; My calendar/diary settings +;; + +;;; Credits: +;; +;; The HTML version of this file was created with Hrvoje Niksic's +;; htmlize.el which is part of the XEmacs "text-modes" package. +;; + +;;; Todo: +;; +;; + +;;; Code: +;:*======================= +;:* Calendar +(require 'diary-lib) +;(require 'calendar) +(setq + calendar-latitude -27.3 + calendar-longitude 153.0 + calendar-location-name "Brisbane" + calendar-time-zone 600 + calendar-standard-time-zone-name "EST" + cal-tex-diary t +; calendar-date-display-form +; '((if dayname (concat dayname ", ")) day " " monthname " " year) + calendar-time-display-form + '(24-hours ":" minutes + (if time-zone " (") time-zone (if time-zone ")")) + calendar-week-start-day 1 + diary-file (expand-file-name "etc/SXEmacs/.diary" + (getenv "HOME")) + diary-mail-addr "steve" + diary-mail-days 7 + european-calendar-style t + mark-diary-entries-in-calendar t + number-of-diary-entries 7 + view-diary-entries-initially t) + +;:*======================= +;:* Todo +(autoload 'todo-mode "todo-mode" + "Major mode for editing TODO lists." t) +(autoload 'todo-show "todo-mode" + "Show TODO items." t) +(autoload 'todo-insert-item "todo-mode" + "Add TODO item." t) +(global-set-key "\C-ct" 'todo-show) ;; switch to TODO buffer +(global-set-key "\C-cn" 'todo-insert-item) ;; insert new item +(setq + todo-prefix "&%%(todo-cp)" + todo-file-do (expand-file-name ".todo-do" (getenv "HOME")) + todo-file-done (expand-file-name ".todo-done" (getenv "HOME")) + todo-file-top (expand-file-name ".todo-top" (getenv "HOME")) + todo-time-string-format "%3b, %d") + +;:*======================= +;:* Fancy Diary with perdy colours! +(defun sy-hide-fancy-dashes () + "Hides the long lines of dashes from todo-mode in fancy diary display." + (save-excursion + (goto-char (point-min)) + (while (re-search-forward "-----" nil t) + (set-extent-property + (make-extent (match-beginning 0) (1+ (match-end 0))) + 'invisible t)))) + +(define-derived-mode fancy-diary-display-mode fundamental-mode "Diary" + "Minor mode for displaying Fancy Diary entries buffer." + (set (make-local-variable 'font-lock-defaults) + '(fancy-diary-font-lock-keywords t)) + (sy-hide-fancy-dashes) + (font-lock-mode) + (define-key (current-local-map) "o" 'other-window) + (define-key (current-local-map) [space] 'scroll-up-command) + (define-key (current-local-map) [backspace] 'scroll-down-command)) + +(defadvice fancy-diary-display (after set-mode activate) + "Give the Fancy Diary Entries buffer a mode of its own. + +It has the ever-so-original name of: `fancy-diary-display-mode', adds +a couple of motion keybindings, and lets you set up font lock keywords +for a fontified Diary buffer." + (save-excursion + (set-buffer (get-buffer-create fancy-diary-buffer)) + (fancy-diary-display-mode))) + +(defun fancy-diary-font-lock-keywords () + (let* ((today (regexp-opt (list (calendar-date-string (calendar-current-date))))) + (keywords `(("^---\\s-\\(.*$\\)" (1 font-lock-function-name-face)) + ("^.*SY:" . font-lock-keyword-face) + ("\"\\(.*\\)\"" (1 font-lock-string-face)) + ("`\\(.*?\\)'" (1 font-lock-reference-face)) + ("[0-9]+:[0-9]+" . font-lock-warning-face) + (,today . font-lock-warning-face) + ("\\(^.*\\)\n=" (1 font-lock-comment-face))))) + keywords)) + +(defvar fancy-diary-font-lock-keywords (fancy-diary-font-lock-keywords)) + +(defun sy-update-diary-font-lock-keywords () + (sit-for 1.1) + (setq fancy-diary-font-lock-keywords (fancy-diary-font-lock-keywords)) + (with-current-buffer (get-buffer-create fancy-diary-buffer) + (font-lock-fontify-buffer))) + +(run-at-time "23:59:59" 86400 'sy-update-diary-font-lock-keywords) + +;:*======================= +;:* Display ISO week numbers +;; +;; I saw this code mentioned on c.e.x. I just snarfed what I needed +;; and SXEmacserised it. +(require 'cal-iso) + +(defvar calendar-use-colours t + "Tries to fontify Calendar if non-nil.") + +(defvar calendar-week-string "WK" + "String (up to three chars) used in calendar header to identify week numbers.") + +(defun sy-generate-calendar-month (month year indent) + "Produce a calendar for ISO-week, month, year on the Gregorian calendar. +The calendar is inserted in the buffer starting at the line on which point +is currently located, but indented INDENT spaces. The indentation is done +from the first character on the line and does not disturb the first INDENT +characters on the line." + (let* ((blank-days ; At start of month + (mod + (- (calendar-day-of-week (list month 1 year)) + calendar-week-start-day) + 7)) + (last (calendar-last-day-of-month month year))) + (goto-char (point-min)) + (calendar-insert-indented + (calendar-string-spread + (list (format "%s %d" (calendar-month-name month) year)) ? 20) + indent t) + ;; Add colour to month name + (if calendar-use-colours + (set-extent-property (make-extent (point-min) (1- (point))) + 'face 'calendar-header-face)) + (calendar-insert-indented "" indent) ; Go to proper spot + (calendar-for-loop + i from 0 to 6 do + (insert (substring (aref calendar-day-name-array + (mod (+ calendar-week-start-day i) 7)) 0 2)) + ;; Add colour to week day names and sundays + (if calendar-use-colours + (set-extent-property (make-extent (- (point) 2) (point)) 'face + (if (= 0 (mod (+ calendar-week-start-day i) 7)) + 'calendar-sunday-face + 'calendar-header-face))) + (insert " ")) + ;; Add week-string after week dates + (insert (concat calendar-week-string + (make-string (- 3 (length calendar-week-string)) ? ))) + ;; Add colour to week-string + (if calendar-use-colours + (set-extent-property (make-extent (- (point) 3) (point)) + 'face 'calendar-week-face)) + (calendar-insert-indented "" 0 t);; Force onto following line + (calendar-insert-indented "" indent);; Go to proper spot + ;; Add blank days before the first of the month + (calendar-for-loop i from 1 to blank-days do (insert " ")) + ;; Put in the days of the month + (calendar-for-loop + i from 1 to last do + (insert (format "%2d " i)) + (if (not calendar-use-colours) + nil + (put-text-property (- (point) 3) (1- (point)) 'mouse-face 'highlight) + ;; Add colour to sunday + (if (= 1 (mod (+ blank-days calendar-week-start-day i) 7)) + (set-extent-property (make-extent (- (point) 3) (1- (point))) + 'face 'calendar-sunday-face))) + (and (zerop (mod (+ i blank-days) 7)) + ;; Add ISO-week # at the end each week entry + (not (insert + (format "%2d " (extract-calendar-month + (calendar-iso-from-absolute + (calendar-absolute-from-gregorian + (list month i year))))))) + ;; Add colour to week # + (if calendar-use-colours + (set-extent-property (make-extent (- (point) 3) (1- (point))) + 'face 'calendar-week-face) + t) + (/= i last) + (calendar-insert-indented "" 0 t);; Force onto following line + (calendar-insert-indented "" indent)))));; Go to proper spot + +(defalias 'generate-calendar-month #'sy-generate-calendar-month) + +;:*======================= +;:* Hooks +(add-hook 'diary-display-hook #'fancy-diary-display) +(add-hook 'diary-hook #'appt-make-list) +(add-hook 'list-diary-entries-hook + #'(lambda () + (sort-diary-entries) + (include-other-diary-files))) +(add-hook 'mark-diary-entries-hook #'mark-included-diary-files) +(add-hook 'today-visible-calendar-hook #'calendar-mark-today) + +;:*======================= +;:* Appointments +(require 'appt) +(require 'balloon-help) +(balloon-help-mode 1) +(setq + balloon-help-background "BlanchedAlmond" + balloon-help-foreground "Black" + display-time-24hr-format t + display-time-day-and-date t + display-time-no-mail-balloon "What! No mail? That can't be right." + display-time-mail-balloon-show-gnus-group t + display-time-mail-balloon-max-displayed 20 + display-time-mail-balloon-gnus-split-width 19 + display-time-mail-balloon-enhance-gnus-group + '("\\(private.*\\|xemacs\\.private\\)") + display-time-mail-balloon-suppress-gnus-group + '("\\(SPAM.*\\|returned\\.mail\\)")) +(display-time) +(appt-initialize) +(setq + appt-message-warning-time 30 + appt-display-format 'echo + appt-audible t + appt-display-mode-line t + appt-announce-method 'appt-persistent-message-announce) +(appt-activate 1) +;:*======================= +;:* Holidays +(defvar displayed-month) +(defvar displayed-year) +(require 'holidays) + +;; First up, a slightly re-written easter-holiday function +(defun sy-easter-holidays () + "List of dates related to Easter, as visible in calendar window. +Ever-so-slightly modified to include the Easter Monday holiday." + (if (and (> displayed-month 5) (not all-christian-calendar-holidays)) + nil;; Ash Wednesday, Good Friday, and Easter are not visible. + (let* ((century (1+ (/ displayed-year 100))) + (shifted-epact ;; Age of moon for April 5... + (% (+ 14 (* 11 (% displayed-year 19));; ...by Nicaean rule + (- ;; ...corrected for the Gregorian century rule + (/ (* 3 century) 4)) + (/ ;; ...corrected for Metonic cycle inaccuracy. + (+ 5 (* 8 century)) 25) + (* 30 century));; Keeps value positive. + 30)) + (adjusted-epact ;; Adjust for 29.5 day month. + (if (or (= shifted-epact 0) + (and (= shifted-epact 1) (< 10 (% displayed-year 19)))) + (1+ shifted-epact) + shifted-epact)) + (paschal-moon ;; Day after the full moon on or after March 21. + (- (calendar-absolute-from-gregorian (list 4 19 displayed-year)) + adjusted-epact)) + (abs-easter (calendar-dayname-on-or-before 0 (+ paschal-moon 7))) + (mandatory + (list + (list (calendar-gregorian-from-absolute abs-easter) + "Easter Sunday") + (list (calendar-gregorian-from-absolute (- abs-easter 2)) + "Good Friday") + (list (calendar-gregorian-from-absolute (+ abs-easter 1)) + "Easter Monday") + (list (calendar-gregorian-from-absolute (- abs-easter 46)) + "Ash Wednesday") + (list (calendar-gregorian-from-absolute (- abs-easter 47)) + "Shrove Tuesday \(Pancake Tuesday\)"))) + (optional + (list + (list (calendar-gregorian-from-absolute (- abs-easter 63)) + "Septuagesima Sunday") + (list (calendar-gregorian-from-absolute (- abs-easter 56)) + "Sexagesima Sunday") + (list (calendar-gregorian-from-absolute (- abs-easter 49)) + "Shrove Sunday") + (list (calendar-gregorian-from-absolute (- abs-easter 48)) + "Shrove Monday") + (list (calendar-gregorian-from-absolute (- abs-easter 14)) + "Passion Sunday") + (list (calendar-gregorian-from-absolute (- abs-easter 7)) + "Palm Sunday") + (list (calendar-gregorian-from-absolute (- abs-easter 3)) + "Maundy Thursday") + (list (calendar-gregorian-from-absolute (+ abs-easter 35)) + "Rogation Sunday") + (list (calendar-gregorian-from-absolute (+ abs-easter 39)) + "Ascension Day") + (list (calendar-gregorian-from-absolute (+ abs-easter 49)) + "Pentecost (Whitsunday)") + (list (calendar-gregorian-from-absolute (+ abs-easter 50)) + "Whitmonday") + (list (calendar-gregorian-from-absolute (+ abs-easter 56)) + "Trinity Sunday") + (list (calendar-gregorian-from-absolute (+ abs-easter 60)) + "Corpus Christi"))) + (output-list + (filter-visible-calendar-holidays mandatory))) + (if all-christian-calendar-holidays + (setq output-list + (append + (filter-visible-calendar-holidays optional) + output-list))) + output-list))) + +;; Get rid of all the Americanised holidays +(setq + christian-holidays nil + hebrew-holidays nil + islamic-holidays nil + general-holidays nil + local-holidays nil + other-holidays nil) + +;; Set up standard Aussie holidays +(setq + calendar-holidays '((holiday-fixed 1 1 "New Year's Day") + ;; If New Year's day is on a weekend the public + ;; holiday is the following Monday + (if (or (eq 0 (calendar-day-of-week (list 1 1 displayed-year))) + (eq 6 (calendar-day-of-week (list 1 1 displayed-year)))) + (holiday-float 1 1 1 "New Year's Day Public Holiday")) + (holiday-fixed 1 26 "Australia Day") + ;; If Australia Day falls on a weekend, the + ;; holiday is the following Monday + (if (eq 0 (calendar-day-of-week (list 1 26 displayed-year))) + (holiday-fixed 1 27 "Australia Day Public Holiday")) + (if (eq 6 (calendar-day-of-week (list 1 26 displayed-year))) + (holiday-fixed 1 28 "Australia Day Public Holiday")) + (holiday-fixed 2 14 "Valentine's Day") + (holiday-fixed 3 17 "St. Patrick's Day") + (holiday-fixed 4 1 "April Fools' Day") + (holiday-fixed 4 25 "Anzac Day") + ;; If Anzac Day falls on a weekend, the holiday + ;; is the following Monday + (if (eq 0 (calendar-day-of-week (list 4 25 displayed-year))) + (holiday-fixed 4 26 "Anzac Day Public Holiday")) + (if (eq 6 (calendar-day-of-week (list 4 25 displayed-year))) + (holiday-fixed 4 27 "Anzac Day Public Holiday")) + (holiday-float 5 1 1 "Labour Day") + (holiday-float 5 0 2 "Mother's Day") + (holiday-float 6 1 2 "Queen's Birthday") + ;; Brisbane Ekka holiday is on the 2nd Wednesday + ;; in August, unless there are 5 Wednesdays in + ;; August, then it is the 3rd Wednesday. + (if (eq 8 (car (calendar-nth-named-day 5 3 8 displayed-year 0))) + (holiday-float 8 3 3 "Brisbane Show Day") + (holiday-float 8 3 2 "Brisbane Show Day")) + (holiday-float 8 3 3 "Brisbane Show Day") ; This might be wrong? + (holiday-float 9 0 1 "Father's Day") + (holiday-fixed 12 25 "Christmas Day") + (holiday-fixed 12 26 "Boxing Day") + ;; If Xmas falls on weekend, the public holiday + ;; is the following Mon/Tue + (if (or (eq 0 (calendar-day-of-week (list 12 25 displayed-year))) + (eq 6 (calendar-day-of-week (list 12 25 displayed-year)))) + (holiday-fixed 12 27 "Xmas Day Public Holiday")) + (if (or (eq 0 (calendar-day-of-week (list 12 26 displayed-year))) + (eq 6 (calendar-day-of-week (list 12 26 displayed-year)))) + (holiday-fixed 12 28 "Boxing Day Public Holiday")) + (solar-equinoxes-solstices) + (sy-easter-holidays))) +(setq mark-holidays-in-calendar t) + +;:*======================= +;:* Howm integration +(setq + calendar-date-display-form + '("[" year "-" (format "%02d" (string-to-int month)) + "-" (format "%02d" (string-to-int day)) "] " + (if dayname (concat dayname ", ")) day " " monthname " " year)) + +(defun howm-mark-calendar-date () + (interactive) + (let* ((howm-schedule-types + howm-schedule-menu-types) + (raw (howm-reminder-search + howm-schedule-types)) + (str nil) (yy nil) (mm nil) (dd nil)) + (while raw + (setq str (nth 1 (car raw))) + (when + (string-match + "\\([0-9]+\\)-\\([0-9]+\\)-\\([0-9]+\\)" + str) + (setq yy (match-string 1 str)) + (setq mm (match-string 2 str)) + (setq dd (match-string 3 str))) + (when (and yy mm dd) + (mark-calendar-date-pattern + (string-to-int mm) + (string-to-int dd) + (string-to-int yy))) + (setq mm nil) + (setq dd nil) + (setq yy nil) + (setq raw (cdr raw))))) + +(defadvice mark-diary-entries + (after mark-howm-entry activate) + (howm-mark-calendar-date)) + +(setq + howm-menu-display-rules + (cons + (cons "%hdiary[\n]?" 'howm-menu-diary) + howm-menu-display-rules)) + +(defun howm-menu-diary () + (message "scanning diary...") + (delete-region + (match-beginning 0) (match-end 0)) + (let* ((now (decode-time (current-time))) + (diary-date + (list (nth 4 now) (nth 3 now) (nth 5 now))) + (diary-display-hook 'ignore) + (howm-diary-entry nil) + (howm-diary-entry-day nil) + (str nil) + yy mm dd) + (unwind-protect + (setq howm-diary-entry + (diary-list-entries + diary-date howm-menu-schedule-days)) + (save-excursion + (set-buffer + (find-buffer-visiting diary-file)) + (subst-char-in-region + (point-min) (point-max) ?\^M ?\n t) + (setq selective-display nil))) + (while howm-diary-entry + (setq howm-diary-entry-day (car howm-diary-entry)) + (setq mm (nth 0 (car howm-diary-entry-day))) + (setq dd (nth 1 (car howm-diary-entry-day))) + (setq yy (nth 2 (car howm-diary-entry-day))) + (setq str (nth 1 howm-diary-entry-day)) + (setq howm-diary-entry (cdr howm-diary-entry)) + (insert + (format + ">>d [%04d-%02d-%02d] %s\n" yy mm dd str)))) + (message "scanning diary...done")) + +(setq diary-date-forms + '((month "/" day "[^/0-9]") + (month "/" day "/" year "[^0-9]") + ("\\[" year "-" month "-" day "\\]" "[^0-9]") + (monthname " *" day "[^,0-9]") + (monthname " *" day ", *" year "[^0-9]") + (dayname "\\W"))) + +(defun howm-open-diary (&optional dummy) + (interactive) + (let ((date-str nil) (str nil)) + (save-excursion + (beginning-of-line) + (when (re-search-forward + ">>d \\(\\[[-0-9]+\\]\\) " nil t) + (setq str + (concat + "^.+" + (buffer-substring-no-properties + (point) (line-end-position)))) + (setq date-str + (concat + "^.+" + (buffer-substring-no-properties + (match-beginning 1) + (match-end 1)) + " " str)) + (find-file + (substitute-in-file-name diary-file)) + (howm-mode t) + (goto-char (point-min)) + (if (re-search-forward date-str nil t) + () + (re-search-forward str nil t)))))) + +(defun add-diary-action-lock-rule () + (let ((rule + (action-lock-general + 'howm-open-diary + "^\\(>>d\\) " + 1 1))) + (if (not (member rule action-lock-default-rules)) + (progn + (setq action-lock-default-rules + (cons rule action-lock-default-rules)) + (action-lock-set-rules + action-lock-default-rules))))) + +(add-hook 'action-lock-mode-on-hook + 'add-diary-action-lock-rule) + +(defadvice make-diary-entry + (after howm-mode activate) + (text-mode) + (howm-mode t)) + +;;; ;;;;;;;;;; + +;;; ;; M-x calendar, move cursor to a certain date, and +;;; ;; M-x howm-from-calendar to search that date in howm notes. +(defun howm-from-calendar () + (interactive) + (let* ((mdy (calendar-cursor-to-date t)) + (m (car mdy)) + (d (second mdy)) + (y (third mdy)) + (key (format-time-string + howm-date-format + (encode-time 0 0 0 d m y)))) + (howm-keyword-search key))) + +;; Bind howm-from-calendar to "H-d" key. +(add-hook 'initial-calendar-window-hook + #'(lambda () + (local-set-key [(hyper ?d)] 'howm-from-calendar))) + + + +;; Type "H-d" in howm menu to open calendar. +(add-hook 'howm-menu-hook + #'(lambda () + (local-set-key [(hyper ?d)] 'calendar))) + +;:*======================= +;:* Get the show on the road +(defun sy-calendar-setup () + (mark-diary-entries) + (mark-calendar-holidays) + (diary-show-all-entries)) + +(add-hook 'calendar-load-hook 'sy-calendar-setup) +;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::* +(message "Calendar settings loaded") diff --git a/13-misc-sy.el b/13-misc-sy.el new file mode 100644 index 0000000..a304eb9 --- /dev/null +++ b/13-misc-sy.el @@ -0,0 +1,943 @@ +;; 13-misc-sy.el --- Miscellaneous Settings -*- Emacs-Lisp -*- + +;; Copyright (C) 2007 - 2012 Steve Youngs + +;; Author: Steve Youngs +;; Maintainer: Steve Youngs +;; Created: <2007-12-02> +;; Time-stamp: +;; Download: +;; HTMLised: +;; Git Repo: git clone http://git.sxemacs.org/syinit +;; Keywords: init, compile + +;; This file is part of SYinit + +;; Redistribution and use in source and binary forms, with or without +;; modification, are permitted provided that the following conditions +;; are met: +;; +;; 1. Redistributions of source code must retain the above copyright +;; notice, this list of conditions and the following disclaimer. +;; +;; 2. Redistributions in binary form must reproduce the above copyright +;; notice, this list of conditions and the following disclaimer in the +;; documentation and/or other materials provided with the distribution. +;; +;; 3. Neither the name of the author nor the names of any contributors +;; may be used to endorse or promote products derived from this +;; software without specific prior written permission. +;; +;; THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR +;; IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +;; WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +;; DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +;; FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +;; CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +;; SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR +;; BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +;; WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE +;; OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +;; IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +;;; Commentary: +;; +;; For stuff that just doesn't seem to fit anywhere else. +;; + +;;; Credits: +;; +;; The HTML version of this file was created with Hrvoje Niksic's +;; htmlize.el which is part of the XEmacs "text-modes" package. +;; + +;;; Todo: +;; +;; + +;;; Code: +;:*======================= +;:* Why type 'y e s RET' or 'n o RET' when 'y' or 'n' will do. +(fset 'yes-or-no-p 'y-or-n-p) + +(setq x-allow-sendevents t) + +;:*====================== +;: Enable the command `narrow-to-region' ("C-x n n") +;(setq narrow-to-region t) +(put 'narrow-to-region 'disabled nil) + +;:*====================== +;:* Enable `erase-buffer' +(put 'erase-buffer 'disabled nil) + +;:*====================== +;:* Put the mouse selection in the kill buffer +;: Jan Vroonhof +(defun mouse-track-drag-copy-to-kill (event count) + "Copy the dragged region to the kill ring" + (let ((region (default-mouse-track-return-dragged-selection event))) + (when region + (copy-region-as-kill (car region) + (cdr region))) + nil)) +(add-hook 'mouse-track-drag-up-hook 'mouse-track-drag-copy-to-kill) + +;:*======================= +;:* manual follows xref instead of opening a new buffer +;: Glynn Clements +(defun Manual-follow-xref (&optional name-or-event) + "Invoke `manual-entry' on the cross-reference under the mouse. +When invoked noninteractively, the arg may be an xref string to parse +instead." + (interactive "e") + (if (eventp name-or-event) + (let* ((p (event-point name-or-event)) + (extent (and p (extent-at p + (event-buffer name-or-event) + 'highlight))) + (data (and extent (extent-property extent 'man)))) + (if (eq (car-safe data) 'Manual-follow-xref) + (eval data) + (error "no manual cross-reference there."))) + (let ((buff (current-buffer))) + (or (and (manual-entry name-or-event) + (or (eq (current-buffer) buff) + (kill-buffer buff))) + ;: If that didn't work, maybe it's in a different section than the + ;: man page writer expected. For example, man pages tend assume + ;: that all user programs are in section 1, but X tends to generate + ;: makefiles that put things in section "n" instead... + (and (string-match "[ \t]*([^)]+)\\'" name-or-event) + (progn + (message "No entries found for %s; checking other sections..." + name-or-event) + (and (manual-entry + (substring name-or-event 0 (match-beginning 0)) nil t) + (or (eq (current-buffer) buff) + (kill-buffer buff))))))))) + +;:*======================= +;:* Frame title. +(setq frame-title-format + (concat "-={%b}=- " + (construct-emacs-version-name) + (if (featurep 'mule) + " (Mule) [" + " (non-Mule) [") + (and-boundp 'sxemacs-codename + sxemacs-codename) + "]")) + +;:*====================== +;:* Additions to the menubar. +(when (featurep 'menubar) + (require 'big-menubar) + (add-menu-button nil ["Fr%_ame" make-frame t] "Help")) + +;:*====================== +;:* create a Kill-Ring menu +(when (featurep 'menubar) + (defvar str) + (defvar yank-menu-length 40 + "*Maximum length of an item in the menu for select-and-yank.") + (defun select-and-yank-filter (menu) + (let* ((count 0)) + (append menu + (mapcar + #'(lambda (str) + (if (> (length str) yank-menu-length) + (setq str (substring str 0 yank-menu-length))) + (prog1 + (vector + str + (list + 'progn + '(push-mark (point)) + (list 'insert (list 'current-kill count t))) + t) + (setq count (1+ count)))) + kill-ring)))) + (add-submenu nil '("Kill-Ring" + :included kill-ring + :filter select-and-yank-filter))) + +;:*====================== +;: resize-minibuffer-mode makes the minibuffer automatically +;: resize as necessary when it's too big to hold its contents. +;(autoload 'resize-minibuffer-mode "rsz-minibuf" nil t) +;(resize-minibuffer-mode) +;(setq resize-minibuffer-window-exactly nil) +;(setq minibuffer-max-depth nil) +(setq resize-minibuffer-mode t) +;:*====================== +;:* don't invert colors when grabbing a password +;: (because sometimes it screws up and leaves the frame +;: with dorked up colors). +(setq passwd-invert-frame-when-keyboard-grabbed nil) + +;:*======================= +;:* VI-style matching parenthesis +;: From Eric Hendrickson edh @ med.umn.edu +(defun match-paren (arg) + "Go to the matching parenthesis if on parenthesis otherwise insert %." + (interactive "p") + (cond ((looking-at "[([{]") (forward-sexp 1) (backward-char)) + ((looking-at "[])}]") (forward-char) (backward-sexp 1)))) +(global-set-key '(control f1) 'match-paren) + +;:*====================== +;:* Inserting elisp Comments +; by Jonas Luster +(defun elispcomment () +;:*===================== + (interactive) + (insert ";:*=======================\n") + (insert ";:* " (setq str (read-input "Comment: ")) "\n") + (insert "\n")) +(global-set-key '(control f3) 'elispcomment) + +;:*====================== +;:* Time-Stamp +(require 'time-stamp) +(add-hook 'write-file-hooks 'time-stamp) +(set 'time-stamp-active t) +(set 'time-stamp-format "%a %3b %2d, %4y %02H:%02M:%02S %u") + +;:*====================== +;:* Image formats +(require 'image-mode) +(require 'ffi-wand) +(Wand-find-file-enable) + +;:*====================== +;:* Dired enhancements. +(require 'dired) +(setq dired-ls-locale "POSIX") + +;; Pack and Unpack tarballs +(require 'dired-tar) +(setq dired-tar-compress-with 'bzip2) + +;; FFI/libWand for image files in Dired +(defun sy-dired-wand () + (interactive) + (let ((file (dired-get-filename))) + (Wand-display file))) + +(define-key dired-mode-map [?b] #'sy-dired-wand) + +;; Play audio files directly from dired. +(defun sy-dired-play-audio () + (interactive) + (let ((file (dired-get-filename))) + (when (string-match #r"\.\(wav\|au\|ogg\|mp3\|flac\)$" file) + (let ((stream (make-media-stream :file file))) + (play-media-stream stream))))) + +(define-key dired-mode-map [(control ?c) ?p] #'sy-dired-play-audio) + +;(setq dired-use-ls-dired t) +;(setq dired-listing-switches "-alih") + +;:*====================== +;:* Change some modeline indicators +(setq pending-delete-modeline-string " PD") +(setq filladapt-mode-line-string "") +(add-minor-mode 'abbrev-mode " Ab") +(add-hook 'lisp-interaction-mode-hook #'(lambda () (setq mode-name "LI"))) + +;:*====================== +;:* Force efs into passive ftp because of my firewall +(setq efs-use-passive-mode t) + +;:*====================== +;:* ibuffer - replacement for buffer-menu +(require 'ibuffer) +(setq + ibuffer-expert t + ibuffer-default-sorting-mode 'major-mode + ibuffer-fontification-level t + ibuffer-saved-filter-groups + ;; First match wins. + '(("My-ibuffer-grps" + ("ChangeLog" + (mode . change-log-mode)) + ("Dired" + (mode . dired-mode)) + ("Programming" + (or + (mode . emacs-lisp-mode) + (mode . cperl-mode) + (mode . c-mode) + (mode . c++-mode) + (mode . java-mode) + (mode . idl-mode) + (mode . lisp-mode))) + ("Documentation" + (or + (mode . help-mode) + (mode . hyper-apropos-help-mode) + (mode . hyper-apropos-mode) + (mode . Info-mode) + (mode . Manual-mode))) + ("Eicq" + (or + (mode . eicq-buddy-mode) + (mode . eicq-log-mode) + (mode . eicq-network-mode) + (mode . world-mode) + (mode . eicq-history-mode) + (name . "\\*eicq-debug\\*") + (filename . "/home/steve/\\.eicq/history/.*"))) + ("EMchat" + (or + (mode . emchat-buddy-mode) + (mode . emchat-log-mode) + (mode . emchat-network-mode) + (mode . world-mode) + (mode . emchat-history-mode) + (name . "\\*emchat-debug\\*") + (filename . "/home/steve/\\.emchat/history/.*"))) + ("Riece" + (or + (mode . riece-channel-list-mode) + (mode . riece-channel-mode) + (mode . riece-command-mode) + (mode . riece-dialogue-mode) + (mode . riece-others-mode) + (mode . riece-user-list-mode))) + ("Gnus" + (or + (mode . message-mode) + (mode . mail-mode) + (mode . gnus-group-mode) + (mode . gnus-summary-mode) + (mode . gnus-article-mode))) + ("Fundamental" + (mode . fundamental-mode)) + ))) + +(add-hook 'ibuffer-mode-hooks + (lambda () + (ibuffer-switch-to-saved-filter-groups "My-ibuffer-grps") + (ibuffer-add-to-tmp-hide "\\*scratch\\*"))) + +;:*====================== +;:* Sawfish mode +(require 'sawfish) +(add-to-list 'auto-mode-alist '("\\.sawfishrc$" . sawfish-mode)) +(add-to-list 'auto-mode-alist '("\\.jl$" . sawfish-mode)) + +;:*====================== +;:* from.el - check whose sent us mail +;(require 'from) +;(setq +; from-mailspools +; '("~/mail/INBOX") +; from-use-other-window nil +; from-quit-command 'kill-buffer +; from-highlight-regexp +; #r"Merge-Req\|e\(icq\|mchat\)\|pa\(?:ckages\|tch\)\|sxemacs\|x\(?:e\(?:macs\|tla\)\|wem\)") + +;:*====================== +;:* PS-Print +;; FIXME: make this work, it looks interesting! +;(require 'ps-print) +;(require 'ps-mule) +;(require 'ps-bdf) +;(require 'lpr) +;(setq +; bdf-directory-list +; '("/usr/share/fonts/bdf") +; ps-multibyte-buffer 'bdf-font-except-latin +; ps-paper-type 'a4 +; printer-name "/dev/lp0" +; ps-printer-name "" +; ps-print-color-p nil) + +;:*====================== +;:* Line and Column numbers. +(line-number-mode 1) +(column-number-mode 1) + +;:*====================== +;:* Setting initial default-directory. +(setq default-directory (file-name-as-directory (user-home-directory))) + +;:*====================== +;:* Sane ChangeLogs +(when (featurep 'mule) + (add-to-list 'file-coding-system-alist '("ChangeLog" . binary))) + +;:*====================== +;:* Directory Abbrevs +(setq directory-abbrev-alist + `(("^/instcore" . ,(concat (car emacs-roots) + "share/sxemacs-" + emacs-program-version)) + ("^/instpkg" . ,(concat (car emacs-roots) + "share/sxemacs")) + ("^/prog" . "~/programming") + ("^/linux" . "/usr/src/linux") + ("^/src" . "/usr/src") + ("^/sexy" . "~/programming/SXEmacs") + ("^/sexycore" . "~/programming/SXEmacs/core") + ("^/sexyweb" . "~/programming/SXEmacs/web"))) + +;:*====================== +;:* The beginnings of procmail-mode.el. +;; +;; I can't remember who I stole this from, but if it was you, please +;; let me know so I can give you the credit you deserve. +(defvar procmail-font-lock-keywords) + +(define-derived-mode procmail-mode fundamental-mode "Procmail" + "Major mode for editing procmail recipes." + + (setq comment-start "#") + (setq comment-start-skip "#[ \t]*") + + ;;register keywords + (setq procmail-font-lock-keywords + (list '("#.*" + . font-lock-comment-face) + '("^[\t ]*:.*" + . font-lock-type-face) + '("[A-Za-z_]+=.*" + . font-lock-keyword-face) + '("^[\t ]*\\*.*" + . font-lock-doc-string-face) + '("\$[A-Za-z0-9_]+" + . font-lock-function-name-face))) + (font-lock-mode)) + +(add-to-list 'auto-mode-alist '("\\.procmailrc$" . procmail-mode)) + +;; And because my ~/.procmailrc has lots of high ASCII to defeat +;; Chinese SPAM I set its coding to binary. +(when (featurep 'mule) + (add-to-list 'file-coding-system-alist '("\\.procmailrc$" . binary))) + +;:*====================== +;:* Build Reports +(setq + build-rpt-prompts '(("Status?: " + ("Success" + "Success (tests fail)" + "Failure" + "Failure (tests fail)" + "OK (with issues)"))) + build-rpt-use-gnus-group "nnml:sxemacs.builds" + build-rpt-use-gnus-p t + build-rpt-make-output-files + '(;"~/programming/SXEmacs/core/sxemacs.git/=build/,,vars.out" + ;"~/programming/SXEmacs/core/sxemacs.git/=build/,,beta.out" + ;"~/programming/SXEmacs/core/sxemacs.git/=build/,,make-all.out" + ;"~/programming/SXEmacs/core/sxemacs.git/=build/,,make-check-temacs.out" + ;"~/programming/SXEmacs/core/sxemacs.git/=build/,,make-check.out" + ;"~/programming/SXEmacs/core/sxemacs.git/=build/,,make-install.out" + "/usr/src/sxemacs/make.err" + "/usr/src/sxemacs/check.err" + "/usr/src/sxemacs/install.err" + )) + +;:*====================== +;:* Set the frame geometry +(unless (getenv "XWEM_RUNNING") + (setq initial-frame-plist '(top 23 left 26 width 95 height 40) + default-frame-plist '(top 3 left 26 width 95 height 40))) + +;:*====================== +;:* The Beginnings of a Finance package +(require 'emoney) +(setq + emoney-bank-url "https://internetbanking.suncorpbank.com.au/" + emoney-date-format "%Y-%m-%d" + emoney-default-account "metway-main.emy" + emoney-recalculate-on-quit t + emoney-save-after-recalculate t + emoney-use-new-frame t) + +;:*====================== +;:* Modeline enhancements. +;; +;; Reorganise the modeline so that the line and column numbers are on +;; the left where you can see them. Also add a bit of colour to the +;; left and right ID extents so they stand out. +(when (or (< emacs-minor-version 5) + (featurep 'sxemacs)) + (setq-default modeline-buffer-identification + (list (cons modeline-buffer-id-left-extent + (cons 10 (list + (list 'line-number-mode "L%l ") + (list 'column-number-mode "C%c ") + (list (cons -3 (list "%p"))) + ":"))) + (cons modeline-buffer-id-right-extent "%17b"))) + + (setq-default + modeline-format + (list + "" + (if (boundp 'modeline-multibyte-status) + "%C" ;modeline-multibyte-status + "NoMule") + (cons modeline-modified-extent 'modeline-modified) + (cons modeline-buffer-id-extent 'modeline-buffer-identification) + " " + 'global-mode-string + " %[(" + (cons modeline-minor-mode-extent + (list "" 'mode-name 'minor-mode-alist)) + (cons modeline-narrowed-extent "%n") + 'modeline-process + ")%]----" + "-%-")) + + (set-extent-face modeline-buffer-id-left-extent 'font-lock-warning-face) + (set-extent-face modeline-buffer-id-right-extent 'font-lock-comment-face)) + +;:*====================== +;:* Enable funky completion. +;; +;; This allows you to do things like type "M-x b-c-f RET" and it will +;; expand to `byte-compile-file'. +(require 'completer) + +;:*====================== +;:* Misc Stuff that I haven't yet put anywhere permanent +(setq + abbrev-mode t + allow-deletion-of-last-visible-frame t + bookmark-save-flag 1 + ;;; Mozilla + ;; browse-url-browser-function #'browse-url-mozilla + ;; browse-url-new-window-flag t + ;; browse-url-mozilla-new-window-is-tab t + ;;; Firefox + ;; browse-url-browser-function #'browse-url-firefox + ;; browse-url-new-window-flag t + ;; browse-url-firefox-new-window-is-tab t + ;;; Conkeror + ;; browse-url-browser-function #'browse-url-firefox + ;; browse-url-new-window-flag t + ;; browse-url-firefox-new-window-is-tab t + ;;; SeaMonkey + ;; browse-url-browser-function #'browse-url-seamonkey + ;; browse-url-new-window-flag t + ;; browse-url-seamonkey-new-window-is-tab t + ;;; Midori + ;; browse-url-generic-program "midori" + ;; browse-url-browser-function #'browse-url-generic + ;;; Google Chrome + browse-url-generic-program "google-chrome" + browse-url-browser-function #'browse-url-generic + browse-url-netscape-version 7 + browse-url-save-file t + ;; browse-url-xterm-program "xterm" + complex-buffers-menu-p t + etalk-process-file "talk" + find-function-source-path nil + font-menu-ignore-scaled-fonts nil + ges-post-use-mime t + mail-user-agent 'message-user-agent + modeline-scrolling-method 'scrollbar + progress-feedback-use-echo-area t + report-xemacs-bug-no-explanations t + scroll-step 1 + lookup-syntax-properties nil) + +(quietly-read-abbrev-file) +(add-hook 'text-mode-hook 'turn-on-auto-fill) +;(customize-set-variable 'gutter-buffers-tab-visible-p nil) +(setq gutter-buffers-tab-enabled nil) +(customize-set-variable 'user-mail-address "steve@sxemacs.org") +(setq query-user-mail-address nil) +(blink-cursor-mode 1) +(when (featurep 'mule) + (set-language-environment "Latin-1")) +(when (eq 0 (length (shell-command-to-string "ps -U steve|grep gnuserv||false"))) + (gnuserv-start)) +(require 'mozmail) + +;:*======================= +;:* Info-mode +(require 'info) + +(setq toolbar-info-frame-plist + '((width . 85) + (name . "InfoFrame"))) + +(unless (fboundp 'Info-search-next) + (defun Info-search-next () + "Repeat search starting from point with last regexp used in `Info-search'." + (interactive) + (Info-search Info-last-search)) + (define-key Info-mode-map "z" 'Info-search-next)) + +(setq + Info-directory-list + '("/home/steve/.sxemacs/site-packages/info" + "/usr/share/info" + "/usr/share/sxemacs/site-packages/info" + "/usr/share/sxemacs/sxemacs-packages/info" + "/usr/share/sxemacs/xemacs-packages/info" + "/usr/share/sxemacs/mule-packages/info") + Info-dir-contents-directory + "/home/steve/.sxemacs/site-packages/info" + Info-save-auto-generated-dir 'always) + +;:*======================= +;:* gdb-highlight +(add-hook 'gdb-mode-hook #'(lambda () (require 'gdb-highlight))) + +;:*======================= +;:* etags +(require 'etags) +(defun sy-find-tag-regex (tagname) + "Use `igrep-find' command to find all occurances of tag with TAGNAME." + (interactive (if current-prefix-arg (list (current-word)) + (list (find-tag-tag "Find tag: ")))) + (let ((dir (file-name-directory tags-file-name))) + (igrep-find "grep" tagname (concat dir "/*")))) + +;:*======================= +;:* Google +(require 'google-query) +(setq google-query-mirror "www.google.com.au" + google-query-result-count 100) +(global-set-key [(control f9)] 'google-query) +(global-set-key [(meta f9)] 'google-query-region) + +;:*======================= +;:* What the fuck does that acronym mean? +;; This requires wtf(6). No idea where you get it from, but it comes +;; with Slackware. +;; (wtf "lol") => LOL: laughing out loud +(defun wtf (acronym) + "What the fuck is... ACRONYM" + (interactive "sWhat the fuck is: ") + (let* ((wtf (executable-find "wtf")) + (term (substring (shell-command-to-string + (concat wtf " " acronym)) 0 -1))) + (if (interactive-p) + (if current-prefix-arg + (insert term) + (message term)) + term))) + +;:*======================= +;:* Interactively append to the latest kill +;; +(defun sy-add-to-kill (start end &optional prepend) + "Copy region START END and append it to the latest kill. + +Or, PREPEND with prefix arg. + +With this you could select \"THIS \" word, `\\[kill-ring-save]' to save it +to the kill ring, then select this \"WORD \" and do `\\[sy-add-to-kill]', +then select this word \"HERE\", do `\\[sy-add-to-kill]', then select these +words \"DON'T WANT \", do `\\[universal-argument] \\[sy-add-to-kill]', and +finally do `\\[yank]' and you'd get... + + DON'T WANT THIS WORD HERE" + (interactive "r\nP") + (let ((prepend (or prepend + current-prefix-arg))) + (if prepend + (kill-append (buffer-substring start end) 'before) + (kill-append (buffer-substring start end) nil)))) + +(global-set-key [(meta ?W)] 'sy-add-to-kill) + +;:*======================= +;:* DNS +(add-to-list 'auto-mode-alist '("/var/chroot/named/etc/zones/.*$" . dns-mode)) + +(defun dig-mx (domain) + "View MX records for DOMAIN. + +With a prefix arg, prompt for a server to query." + (interactive "sDomain: ") + (unless (interactive-p) + (error 'invalid-operation "`dig-mx' must be called interactively")) + (if current-prefix-arg + (dig domain "MX" nil nil nil + (format "%s" (read-string "Server: " nil nil "localhost"))) + (dig domain "MX"))) + +(defun dig-ns (domain) + "View NS records for DOMAIN. + +With a prefix arg, prompt for a server to query." + (interactive "sDomain: ") + (unless (interactive-p) + (error 'invalid-operation "`dig-ns' must be called interactively")) + (if current-prefix-arg + (dig domain "NS" nil nil nil + (format "%s" (read-string "Server: " nil nil "localhost"))) + (dig domain "NS"))) + +(defun dig-any (domain) + "View DNS records for DOMAIN. + +With a prefix arg, prompt for a server to query." + (interactive "sDomain: ") + (unless (interactive-p) + (error 'invalid-operation "`dig-any' must be called interactively")) + (if current-prefix-arg + (dig domain "ANY" nil nil nil + (format "%s" (read-string "Server: " nil nil "localhost"))) + (dig domain "ANY"))) + +;:*======================= +;:* Hard disk temperature! +;(or (ignore-errors (require 'hddtemp)) +; (progn +; (load-module "cl-loop") +; (require 'hddtemp))) + +;;; get fancy and stick it in the modeline +;(defvar hddtemp-global-mode-string "sda:0°C" +; "Default hddtemp modeline string.") +;(setq global-mode-string (append global-mode-string +; (list hddtemp-global-mode-string))) + +;(defun hddtemp-modeline-string () +; (let* ((disc0 (hddtemp 0)) +; (str (format "sda:%s°%s" +; (nth 2 disc0) (nth 3 disc0)))) +; (setq hddtemp-global-mode-string str))) + +;(start-itimer "hdd-modeline" +; #'(lambda () +; (progn +; (setq global-mode-string +; (delq hddtemp-global-mode-string global-mode-string)) +; (hddtemp-modeline-string) +; (setq global-mode-string +; (append global-mode-string +; (list hddtemp-global-mode-string))))) +; 10 10) + +;:*======================= +;:* Term +; M-x term usually gives really horrid "staircase" output. This fixes +; that. +(add-hook 'term-exec-hook + #'(lambda () + (set-buffer-process-coding-system 'binary 'binary))) + +;:*======================= +;:* Phonetic Alphabet +(defvar phonetics-hash + #s(hash-table test equal + data ("a" "alpha" + "b" "bravo" + "c" "charlie" + "d" "delta" + "e" "echo" + "f" "foxtrot" + "g" "golf" + "h" "hotel" + "i" "india" + "j" "juliet" + "k" "kilo" + "l" "lima" + "m" "mike" + "n" "november" + "o" "oscar" + "p" "papa" + "q" "quebec" + "r" "romeo" + "s" "sierra" + "t" "tango" + "u" "uniform" + "v" "victor" + "w" "whiskey" + "x" "x-ray" + "y" "yankee" + "z" "zulu" + " " "SPC" + "0" "zero" + "1" "one" + "2" "two" + "3" "three" + "4" "four" + "5" "five" + "6" "six" + "7" "seven" + "8" "eight" + "9" "niner")) + "Hash table of phonetic alphabet.") + +(defun phoneticise (string) + "Return STRING rewritten using the phonetic alphabet. + +For example: \"cat\" => \"charlie alpha tango\". +With a prefix arg, insert phoneticised string at point. +It ignores punctuation." + (interactive "sString to phoneticise: ") + (let ((str (string-to-list (downcase string))) + phonetics) + (with-temp-buffer + (while str + (insert (or (gethash (char-to-string (car str)) phonetics-hash) + (char-to-string (car str))) " ") + (setq str (cdr str))) + (setq phonetics (buffer-string))) + (if current-prefix-arg + (insert phonetics) + (if (interactive-p) + (message "%s" phonetics) + phonetics)))) + +;:*======================= +;:* Copy the text without the extents +(defun sy-extent-kill-save () + "Save the extent under point's string to kill ring." + (interactive) + (kill-new (extent-string (extent-at (point))))) + +;:*======================= +;:* PkgUsr tools +(require 'pkgusr) + +;:*======================= +;:* There's a new sexy rc.d style init in SXEmacs, and this is how I +;; deal with it. +;; +;; I now have my init files named with a 2 digit numerical prefix. +;; This is that I can control which order `lisp-initd-compile-and-load' +;; will load my stuff. Consequently, finding a particular init file is +;; much harder now because I can never remember what bloody number it +;; has. This takes the remembering out of the equation. +(defvar sy-init-hash (make-hash-table :test #'equal :size 20) + "A hash table of my numbered init files.") + +(defvar sy-init-files + (directory-files lisp-initd-dir nil ".*\.el$" 'sorted-list t) + "List of my init files.") + +(mapc + (lambda (value) + (let ((key (substring value 3 -3))) + (puthash key value sy-init-hash))) + sy-init-files) + +(defvar sy-init-hash-vector (hash-keys-to-vector sy-init-hash) + "A vector from my init file hash to use for completion.") + +(defvar sy-init-history nil + "History for `sy-init-file-other-window'.") + +(defun sy-init-file-other-window (initf &optional codesys) + "Basically, `find-file-other-window', but for my init files. + +Argument INITF is the \"base\" name of the init file. +Optional prefix arg, CODESYS, is to specify a coding system to use. + +I have this because I've prefixed all of my init files with a 2 +digit number so I can ensure they get loaded in the right order with +`lisp-initd-compile-and-load'. And I can never remember what init +files are assigned what numbers." + (interactive (list (completing-read "Init file: " + (mapcar #'list sy-init-hash-vector) + nil nil nil sy-init-history) + (when current-prefix-arg + (read-coding-system "Coding System: ")))) + (let* ((lib (gethash initf sy-init-hash)) + (expanded (expand-file-name lib lisp-initd-dir))) + (find-file-other-window expanded codesys))) + +(global-set-key [(control ?x) ?4 ?i] #'sy-init-file-other-window) +;:*======================= +;:* "Active" menubar +;; Nifty little thing that hides the menubar and makes it visible when +;; the rat is on the toolbar. +;; but it's annoying +;(require 'active-menu) +;(active-menu 1) + +;:*======================= +;:* LiveJournal posting thingy +(require 'lj) +(setq lj-cookie-flavour 'chrome) +;(setq lj-cookie-flavour 'firefox) +(setq lj-user-id "bastard_blog") +(setq lj-archive-posts t) +(setq lj-bcc-address "Steve Youngs ") +(setq lj-default-location "Brisbane, Australia") +(setq lj-signature + "
+

+Till next time...
+Steve +

") +(add-hook 'lj-before-post-hook #'lj-validate) +(add-hook 'lj-after-post-hook #'lj-get-tags) + +;:*======================= +;:* Handy kbd macros +;; +;; numpoints -- make numbered list points. Before using, initialise +;; numeric register `n' to zero +(number-to-register 0 ?n) +(defalias 'numpoints + (read-kbd-macro "2*RET 2*SPC C-x r + n C-x r i n C-f ) SPC")) +(global-set-key [(control ?c) (control ?n)] #'numpoints) + +;:*======================= +;:* Do things with environment variables let-bound +;; +;; (with-environment-variables (("VAR" "VALUE") ("VAR2" "VALUE2")) +;; (do-shit-here)) +;; +;(require 'with-environment-variables) + +;:*======================= +;:* Play Sudoku +(require 'sudoku) +(setq sudoku-level 'easy) + +;:*======================= +;:* Stupid fucking Google Chrome is MIME-illiterate +(defun sy-browse-url-of-file (&optional file) + "Ask a WWW browser to display FILE. + +Display the current buffer's file if FILE is nil or if called +interactively. Turn the filename into a URL with function +`browse-url-file-url'. Pass the URL to a browser using the +`browse-url' function then run `browse-url-of-file-hook'. + +This has been reworked a little to cater for Google Chrome not knowing +anything about MIME types." + (interactive) + (let (oldfile) + (or file + (setq file (buffer-file-name)) + (error "Current buffer has no file")) + (unless (string-match "^\\.html?$" (file-name-extension file t)) + (setq oldfile file) + (rename-file file (concat file ".html")) + (setq file (concat file ".html"))) + (let ((buf (get-file-buffer file))) + (if buf + (save-excursion + (set-buffer buf) + (cond ((not (buffer-modified-p))) + (browse-url-save-file (save-buffer)) + (t (message "%s modified since last save" file)))))) + (unwind-protect + (progn + (browse-url (browse-url-file-url file)) + (sit-for 1)) + (and oldfile (rename-file file oldfile)))) + (run-hooks 'browse-url-of-file-hook)) + +(when (equal browse-url-generic-program "google-chrome") + (fset #'browse-url-of-file #'sy-browse-url-of-file)) + +;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::* +(message "miscellaneous initialised") diff --git a/14-fonts-sy.el b/14-fonts-sy.el new file mode 100644 index 0000000..74dd17a --- /dev/null +++ b/14-fonts-sy.el @@ -0,0 +1,431 @@ +;; 14-fonts-sy.el --- Fonts/Faces Settings -*- Emacs-Lisp -*- + +;; Copyright (C) 2007 - 2012 Steve Youngs + +;; Author: Steve Youngs +;; Maintainer: Steve Youngs +;; Created: <2007-12-02> +;; Time-stamp: +;; Download: +;; HTMLised: +;; Git Repo: git clone http://git.sxemacs.org/syinit +;; Keywords: init, compile + +;; This file is part of SYinit + +;; Redistribution and use in source and binary forms, with or without +;; modification, are permitted provided that the following conditions +;; are met: +;; +;; 1. Redistributions of source code must retain the above copyright +;; notice, this list of conditions and the following disclaimer. +;; +;; 2. Redistributions in binary form must reproduce the above copyright +;; notice, this list of conditions and the following disclaimer in the +;; documentation and/or other materials provided with the distribution. +;; +;; 3. Neither the name of the author nor the names of any contributors +;; may be used to endorse or promote products derived from this +;; software without specific prior written permission. +;; +;; THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR +;; IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +;; WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +;; DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +;; FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +;; CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +;; SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR +;; BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +;; WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE +;; OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +;; IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +;;; Commentary: +;; +;; Sets all my pretty colours and shit. +;; + +;;; Credits: +;; +;; The HTML version of this file was created with Hrvoje Niksic's +;; htmlize.el which is part of the XEmacs "text-modes" package. +;; + +;;; Todo: +;; +;; + +;;; Code: +;:*======================= +;:* Turn on Lazy-(lock|shot) +;; Lazy-lock +;; (require 'lazy-lock) +;; (if (eq emacs-minor-version 5) +;; (setq font-lock-support-mode 'lazy-lock-mode) +;; (add-hook 'font-lock-mode-hook 'turn-on-lazy-lock)) +;; (setq lazy-lock-stealth-time 15) + +;; Lazy-shot (my preference) +(require 'lazy-shot) +(setq lazy-shot-verbose nil) +(setq lazy-shot-stealth-verbose nil) +(add-hook 'font-lock-mode-hook 'turn-on-lazy-shot) + +;:*======================= +;:* describe-face-at-point, a function to find out which face is which +(defun describe-face-at-point () + "Describe faces at point." + (interactive) + (let ((faces (get-char-property (point) 'face))) + (if (listp faces) + (hyper-apropos + (mapconcat + #'(lambda (f) + (symbol-name f)) faces "\\|") nil) + (hyper-describe-face faces) + (other-window 1)))) + +;; Some convenience face stuff +(require 'facemenu) + +;:*======================= +;:* Alex Schroeder's color-theme +;; +;; A very nice package, get it from: +;; +(autoload 'color-theme-install "color-theme") +(defun sy-colour-theme () + "Colour theme by Steve Youngs, created 2001-09-01." + (interactive) + (color-theme-install + `(sy-colour-theme + ;; Misc basic stuff. + ((background-color . "black") + (frame-background-mode . dark) + (background-toolbar-color . "#cccccccccccc") + (border-color . "#000000000000") + (bottom-toolbar-shadow-color . "#7a7a7a7a7a7a") + (cursor-color . "red3") + (foreground-color . "white") + (top-toolbar-shadow-color . "#f5f5f5f5f5f5")) + ((buffers-tab-face . buffers-tab) + (cperl-here-face . font-lock-string-face) + (cperl-invalid-face quote underline) + (cperl-pod-face . font-lock-comment-face) + (cperl-pod-head-face . font-lock-variable-name-face) + (paren-match-face . paren-face-match) + (paren-mismatch-face . paren-face-mismatch) + (paren-no-match-face . paren-face-no-match) + (smiley-mouse-face . highlight) + (vc-mode-face . highlight)) + (about-headline-face ((t (:bold t :foreground "HotPink")))) + (about-link-face ((t (:bold t :foreground "Yellow")))) + (blue ((t (:foreground "blue")))) + (buffers-tab ((t (:bold t :background "grey65" :foreground "black")))) + (green ((t (:foreground "green")))) + (gui-button-face ((t (:background "grey75" :foreground "black")))) + (highlight ((t (:background "darkseagreen2" :foreground "red")))) + (list-mode-item-selected ((t (:background "gray68" :foreground "white")))) + (primary-selection ((t (:background "gray65")))) + (red ((t (:foreground "red")))) + (secondary-selection ((t (:background "paleturquoise")))) + (text-cursor ((t (:background "red3" :foreground "black")))) + (underline ((t (:underline t)))) + (yellow ((t (:foreground "yellow")))) + ;; Calendar/Diary. + (calendar-today-face ((t (:bold t :foreground "HotPink")))) + (calendar-week-face ((t (:bold t :foreground "yellow")))) + (calendar-header-face ((t (:bold t :foreground "HotPink")))) + (calendar-sunday-face ((t (:bold t :foreground "Red")))) + (diary-face ((t (:foreground "Cyan")))) + (holiday-face ((t ( :foreground "Yellow")))) + ;; cperl-mode. + (cperl-array-face ((t (:bold t :foreground "Blue")))) + (cperl-hash-face ((t (:bold t :foreground "Red")))) + (cperl-nonoverridable-face ((t (:foreground "chartreuse3")))) + ;; Custom + (custom-group-tag-face ((t (:foreground "Yellow")))) + (custom-state-face ((t (:foreground "Cyan")))) + (custom-variable-tag-face ((t (:foreground "LawnGreen")))) + ;; PCL-CVS + ;(cvs-filename-face ((t (:bold t :foreground "Yellow")))) + ;(cvs-header-face ((t (:foreground "Green")))) + ;(cvs-msg-face ((t ( :foreground "Cyan")))) + ;; XEtla + ;(xetla-archive-name ((t (:foreground "yellow")))) + ;(xetla-location-http ((t (:foreground "sandybrown")))) + ;(xetla-location-local ((t (:foreground "indianred")))) + ;(xetla-location-sftp ((t (:foreground "wheat")))) + ;; dictionary + (dictionary-word-entry-face ((t (:italic nil :foreground "Green")))) + (dictionary-reference-face ((t (:foreground "Yellow")))) + ;; diff-mode + (diff-added-face ((t ( :foreground "LawnGreen")))) + (diff-changed-face ((t ( :foreground "Cyan")))) + (diff-file-header-face + ((t ( :foreground "BlanchedAlmond")))) + (diff-header-face ((t ( :foreground "BlanchedAlmond")))) + (diff-hunk-header-face ((t ( :foreground "Yellow")))) + (diff-index-face ((t ( :foreground "Orange")))) + (diff-removed-face ((t ( :foreground "HotPink")))) + ;; Dired. + (dired-face-boring ((t (:foreground "Gray65")))) + (dired-face-directory ((t (:bold t :foreground "yellow")))) + (dired-face-executable ((t (:bold t :foreground "LimeGreen")))) + (dired-face-flagged ((t (:background "LightSlateGray" :foreground "black")))) + (dired-face-header ((t (:background "Orange" :foreground "black" :bold t)))) + (dired-face-marked ((t (:background "PaleVioletRed" :foreground "black" :bold t)))) + (dired-face-permissions ((t (:background "Turquoise" :foreground "black")))) + (dired-face-setuid ((t (:foreground "Red" :bold t)))) + (dired-face-socket ((t (:foreground "magenta")))) + (dired-face-symlink ((t (:foreground "cyan")))) + ;; Balloon Help. + (display-time-mail-balloon-enhance-face ((t (:background "red")))) + (display-time-mail-balloon-gnus-group-face ((t (:foreground "blue")))) + (display-time-time-balloon-face ((t (:foreground "magenta")))) + ;; Ediff + (ediff-current-diff-face-A + ((t (:background "pale green" :foreground "firebrick")))) + (ediff-current-diff-face-Ancestor + ((t (:background "VioletRed" :foreground "Black")))) + (ediff-current-diff-face-B + ((t (:background "Yellow" :foreground "DarkOrchid")))) + (ediff-current-diff-face-C ((t (:background "Pink" :foreground "Navy")))) + (ediff-even-diff-face-A ((t (:background "light grey" :foreground "Black")))) + (ediff-even-diff-face-Ancestor ((t (:background "Grey" :foreground "White")))) + (ediff-even-diff-face-B ((t (:background "Grey" :foreground "White")))) + (ediff-even-diff-face-C ((t (:background "light grey" :foreground "Black")))) + (ediff-fine-diff-face-A ((t (:background "sky blue" :foreground "Navy")))) + (ediff-fine-diff-face-Ancestor + ((t (:background "Green" :foreground "Black")))) + (ediff-fine-diff-face-B ((t (:background "cyan" :foreground "Black")))) + (ediff-fine-diff-face-C ((t (:background "Turquoise" :foreground "Black")))) + (ediff-odd-diff-face-A ((t (:background "Grey" :foreground "White")))) + (ediff-odd-diff-face-Ancestor + ((t (:background "light grey" :foreground "Black")))) + (ediff-odd-diff-face-B ((t (:background "light grey" :foreground "Black")))) + (ediff-odd-diff-face-C ((t (:background "Grey" :foreground "White")))) + ;; EMchat. + (emchat-face-away ((t (:foreground "red")))) + (emchat-face-dnd ((t (:foreground "lightblue")))) + (emchat-face-ffc ((t (:foreground "yellow")))) + (emchat-face-log-read ((t (:foreground "turquoise")))) + (emchat-face-log-unread ((t (:foreground "red")))) + (emchat-face-na ((t (:foreground "pink")))) + (emchat-face-occ ((t (:foreground "orange")))) + (emchat-face-offline ((t (:foreground "grey")))) + (emchat-face-online ((t (:foreground "green")))) + (emchat-face-selected ((t (:background "yellow" :foreground "darkblue")))) + (emchat-wharf-default-face ((t (:foreground "Green" :size "10pt")))) + ;; MPD + (mpd-dock-face ((t (:foreground "Red" :size "10pt")))) + ;; LaTeX + (font-latex-bold-face ((t (:foreground "brown")))) + (font-latex-italic-face ((t (:foreground "lightcoral")))) + (font-latex-math-face ((t (:foreground "dodgerblue")))) + (font-latex-sedate-face ((t (:foreground "gray51")))) + (font-latex-string-face ((t (:foreground "green3")))) + (font-latex-warning-face ((t (:foreground "red")))) + ;; Font Lock + (font-lock-comment-face ((t (:foreground "SkyBlue")))) + (font-lock-doc-string-face ((t (:foreground "LimeGreen")))) + (font-lock-function-name-face ((t (:foreground "yellow" :bold t)))) + (font-lock-keyword-face ((t (:foreground "Salmon")))) + (font-lock-preprocessor-face ((t (:foreground "magenta3")))) + (font-lock-reference-face ((t (:foreground "Turquoise")))) + (font-lock-string-face ((t (:foreground "green3")))) + (font-lock-type-face ((t (:foreground "dodgerblue")))) + (font-lock-variable-name-face ((t (:foreground "PeachPuff")))) + (font-lock-warning-face ((t (:bold t :foreground "Red")))) + ;; gdb highlight + (gdb-highlight-face ((t (:bold t :foreground "BlanchedAlmond")))) + (gdb-breakpoint-number-face ((t (:foreground "magenta3")))) + (gdb-breakpoint-enabled-face ((t (:foreground "steelblue")))) + (gdb-function-name-face ((t (:bold t :foreground "yellow")))) + (gdb-function-location-face ((t (:foreground "Salmon")))) + (gdb-variable-name-face ((t (:foreground "PeachPuff")))) + (gdb-type-name-face ((t (:foreground "dodgerblue")))) + ;; Gnus/Message + (gnus-cite-attribution ((t (:foreground "hotpink")))) + (gnus-cite-1 ((t (:foreground "LawnGreen")))) + (gnus-cite-10 ((t (:foreground "magenta")))) + (gnus-cite-11 ((t (:foreground "MediumBlue")))) + (gnus-cite-2 ((t (:foreground "PeachPuff")))) + (gnus-cite-3 ((t (:foreground "Cyan")))) + (gnus-cite-4 ((t (:foreground "Salmon")))) + (gnus-cite-5 ((t (:foreground "DarkSalmon")))) + (gnus-cite-6 ((t (:foreground "LavenderBlush")))) + (gnus-cite-7 ((t (:foreground "LawnGreen")))) + (gnus-cite-8 ((t (:foreground "LightSkyBlue")))) + (gnus-cite-9 ((t (:foreground "LightSeaGreen")))) + (gnus-emphasis-bold ((t (:bold t)))) + (gnus-emphasis-bold-italic ((t (:italic t :bold t)))) + (gnus-emphasis-highlight-words ((t (:foreground "yellow")))) + (gnus-emphasis-italic ((t (:italic t)))) + (gnus-emphasis-underline ((t (:underline t)))) + (gnus-emphasis-underline-bold ((t (:underline t :bold t)))) + (gnus-emphasis-underline-bold-italic ((t (:underline t :italic t :bold t)))) + (gnus-emphasis-underline-italic ((t (:underline t :italic t)))) + (gnus-group-mail-1-empty ((t (:foreground "DeepPink3")))) + (gnus-group-mail-1 ((t (:bold t :foreground "DeepPink3")))) + (gnus-group-mail-2-empty ((t (:foreground "HotPink3")))) + (gnus-group-mail-2 ((t (:bold t :foreground "HotPink3")))) + (gnus-group-mail-3-empty ((t (:foreground "BlanchedAlmond")))) + (gnus-group-mail-3 ((t (:foreground "Yellow")))) + (gnus-group-mail-low-empty ((t (:foreground "DeepPink4")))) + (gnus-group-mail-low ((t (:bold t :foreground "DeepPink4")))) + (gnus-group-news-1-empty ((t (:foreground "BlanchedAlmond")))) + (gnus-group-news-1 ((t (:foreground "LawnGreen")))) + (gnus-group-news-2-empty ((t (:foreground "CadetBlue4")))) + (gnus-group-news-2 ((t (:bold t :foreground "CadetBlue4")))) + (gnus-group-news-3 ((t (:foreground "HotPink")))) + (gnus-group-news-4 ((t (:bold t)))) + (gnus-group-news-5 ((t (:bold t)))) + (gnus-group-news-6 ((t (:bold t)))) + (gnus-group-news-low-empty ((t (:foreground "DarkGreen")))) + (gnus-group-news-low ((t (:bold t :foreground "DarkGreen")))) + (gnus-header-content ((t (:foreground "LightGreen")))) + (gnus-header-from ((t (:foreground "Cyan")))) + (gnus-header-name ((t (:foreground "hotpink")))) + (gnus-header-newsgroups ((t (:bold t :foreground "yellow")))) + (gnus-header-subject ((t (:bold t :foreground "SkyBlue")))) + (gnus-picon ((t (:background "white" :foreground "white")))) + (gnus-picon-xbm ((t (:background "white" :foreground "white")))) + (gnus-server-agent ((t (:bold t :foreground "HotPink")))) + (gnus-server-opened ((t (:foreground "green")))) + (gnus-server-closed ((t (:foreground "gray55")))) + (gnus-server-denied ((t (:foreground "red")))) + (gnus-server-offline ((t (:foreground "BlanchedAlmond")))) + (gnus-signature ((t (:bold t :foreground "BlanchedAlmond")))) + (gnus-summary-cancelled ((t (:foreground "yellow")))) + (gnus-summary-high-ancient ((t (:bold t :foreground "RoyalBlue")))) + (gnus-summary-high-read ((t (:foreground "SlateGrey")))) + (gnus-summary-high-ticked ((t (:bold t :foreground "firebrick")))) + (gnus-summary-high-unread ((t (:bold t :foreground "HotPink")))) + (gnus-summary-low-ancient ((t (:italic t :foreground "RoyalBlue")))) + (gnus-summary-low-read ((t (:foreground "Grey")))) + (gnus-summary-low-ticked ((t (:italic t :foreground "firebrick")))) + (gnus-summary-low-unread ((t ( :foreground "coral")))) + (gnus-summary-normal-ancient ((t (:foreground "RoyalBlue")))) + (gnus-summary-normal-read ((t (:foreground "SlateGrey")))) + (gnus-summary-normal-ticked ((t (:foreground "firebrick")))) + (gnus-summary-normal-unread ((t (:bold t :foreground "white")))) + (gnus-summary-selected ((t (:underline t :foreground "Cyan")))) + (gnus-x ((t (:background "white" :foreground "black")))) + (message-cited-text ((t (:foreground "Cyan")))) + (message-header-cc ((t (:foreground "LawnGreen")))) + (message-header-name ((t (:foreground "hotpink")))) + (message-header-newsgroups ((t (:bold t :foreground "yellow")))) + (message-header-other ((t (:foreground "Green")))) + (message-header-subject ((t (:bold t :foreground "SkyBlue")))) + (message-header-to ((t (:foreground "BlanchedAlmond")))) + (message-header-xheader ((t (:foreground "blue")))) + (message-mml ((t (:foreground "ForestGreen")))) + (message-separator ((t (:bold t :foreground "yellow")))) + ;; MMM-mode + (mmm-default-submode-face ((t (:background "black")))) + ;; Hyper-apropos. + (hyper-apropos-documentation ((t (:foreground "white")))) + (hyper-apropos-hyperlink ((t (:foreground "yellow")))) + ;; ibuffer + (ibuffer-deletion-face ((t (:foreground "BlanchedAlmond")))) + (ibuffer-dired-buffer-face ((t (:foreground "cyan")))) + (ibuffer-help-buffer-face ((t (:foreground "Yellow")))) + (ibuffer-hidden-buffer-face ((t (:foreground "DarkMagenta")))) + (ibuffer-marked-face ((t (:foreground "green")))) + (ibuffer-occur-match-face ((t (:bold t :foreground "Red")))) + (ibuffer-read-only-buffer-face ((t (:foreground "hotpink")))) + (ibuffer-special-buffer-face ((t (:foreground "skyblue")))) + ;; Info + (info-node ((t (:bold t :foreground "yellow")))) + (info-xref ((t (:bold t :foreground "BlanchedAlmond")))) + ;; Isearch + (isearch ((t (:background "yellow" :foreground "red")))) + (isearch-secondary ((t (:foreground "red3")))) + ;; Riece + (riece-ctcp-action-face ((t (:foreground "PaleGreen" :bold t)))) + (riece-dialogue-prefix-face ((t (:foreground "red" :bold t)))) + (riece-channel-list-default-face ((t (:foreground "yellow" :bold t)))) + (riece-keyword-face ((t (:foreground "hotpink" :bold t)))) + ;; Man + (man-italic ((t (:italic t :size "14pt" :foreground "BlanchedAlmond")))) + (man-heading ((t (:bold t :foreground "yellow")))) + (man-xref ((t (:underline t :foreground "hotpink")))) + ;; Modeline + (modeline ((t (:background "Gray80" :foreground "Black")))) + (modeline-buffer-id ((t (:background "Gray80" :foreground "blue4")))) + (modeline-mousable ((t (:background "Gray80" :foreground "firebrick")))) + (modeline-mousable-minor-mode + ((t (:background "Gray80" :foreground "green4")))) + ;; Paren + (paren-blink-off ((t (:foreground "black")))) + (paren-face-match ((t (:background "turquoise")))) + (paren-face-mismatch ((t (:background "purple" :foreground "white")))) + (paren-face-no-match ((t (:background "yellow" :foreground "black")))) + (paren-match ((t (:background "darkseagreen2" :foreground "yellow3")))) + (paren-mismatch ((t (:background "DeepPink" :foreground "white")))) + ;; Eshell + (eshell-ls-directory-face ((t (:foreground "Yellow" :bold t)))) + ;; Shell + (shell-option-face ((t (:foreground "Cyan")))) + (shell-output-2-face ((t (:foreground "LawnGreen")))) + (shell-output-3-face ((t (:foreground "HotPink")))) + (shell-output-face ((t (:foreground "BlanchedAlmond")))) + (shell-prompt-face ((t (:foreground "Yellow")))) + ;; Speedbar + (speedbar-button-face ((t (:foreground "green4")))) + (speedbar-directory-face ((t (:foreground "BlanchedAlmond")))) + (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")))) + ;; Widget + (widget-button-face ((t (:foreground "magenta")))) + (widget-button-pressed-face ((t (:foreground "red")))) + (widget-documentation-face ((t (:foreground "BlanchedAlmond")))) + (widget-field-face ((t (:background "Grey30" :foreground "Yellow")))) + (widget-inactive-face ((t (:foreground "dim gray")))) + (zmacs-region ((t (:background "gray30" :foreground "yellow")))) + ;; xwem + ;(xwem-framei-dockapp-face ((t (:foreground "cyan" :background "black" :bold t)))) + ;; EasyPG + (epa-field-body-face ((t (:foreground "turquoise" :italic t)))) + (epa-field-name-face ((t (:foreground "BlanchedAlmond")))) + (epa-mark-face ((t (:foreground "red" :bold t)))) + (epa-string-face ((t (:foreground "green")))) + (epa-validity-disabled-face ((t (:foreground "grey50")))) + (epa-validity-high-face ((t (:foreground "hotpink" :bold t)))) + (epa-validity-low-face ((t (:foreground "grey80")))) + (epa-validity-medium-face ((t (:foreground "PaleTurquoise")))) + ;; howm + (action-lock-face ((t (:underline t)))) + (howm-menu-key-face ((t (:foreground "HotPink")))) + (howm-menu-list-face ((t (:foreground "black" :background "yellow")))) + (howm-mode-ref-face ((t (:foreground "yellow")))) + (howm-mode-title-face ((t (:foreground "BlanchedAlmond")))) + (howm-mode-wiki-face ((t (:foreground "SkyBlue")))) + (howm-reminder-defer-face ((t (:foreground "white")))) + (howm-reminder-done-face ((t (:foreground "grey65")))) + (howm-reminder-schedule-face ((t (:foreground "cyan")))) + (howm-reminder-todo-face ((t (:foreground "hotpink" :bold t)))) + (howm-reminder-normal-face ((t (:foreground "Salmon")))) + ;; Sudoku + (sudoku-value-face ((t (:foreground "yellow" :bold t :size ,sudoku-font-size)))) + ))) + +(sy-colour-theme) + +;:*======================= :* +; Use a sexy background pixmap. +;(set-face-background-pixmap 'default +; [xpm :file "~/documents/pictures/marble.xpm"])) +;:*======================= +;:* Set background-mode to dark (why isn't this autodetected?) +(setq frame-background-mode 'dark) + +;; Highlight 'FIXME:' and '--SY' in comments. So far, just lisp mode. +(add-to-list 'lisp-font-lock-keywords-2 + '(";+.*\\(FIXME:\\|--SY\\.?$\\)" 1 font-lock-warning-face prepend)) +;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +(message "fonts initialised") + diff --git a/15-supercite-sy.el b/15-supercite-sy.el new file mode 100644 index 0000000..0704121 --- /dev/null +++ b/15-supercite-sy.el @@ -0,0 +1,141 @@ +;; 15-supercite-sy.el --- Mail citing Settings -*- Emacs-Lisp -*- + +;; Copyright (C) 2007 - 2012 Steve Youngs + +;; Author: Steve Youngs +;; Maintainer: Steve Youngs +;; Created: <2007-12-02> +;; Time-stamp: +;; Download: +;; HTMLised: +;; Git Repo: git clone http://git.sxemacs.org/syinit +;; Keywords: init, compile + +;; This file is part of SYinit + +;; Redistribution and use in source and binary forms, with or without +;; modification, are permitted provided that the following conditions +;; are met: +;; +;; 1. Redistributions of source code must retain the above copyright +;; notice, this list of conditions and the following disclaimer. +;; +;; 2. Redistributions in binary form must reproduce the above copyright +;; notice, this list of conditions and the following disclaimer in the +;; documentation and/or other materials provided with the distribution. +;; +;; 3. Neither the name of the author nor the names of any contributors +;; may be used to endorse or promote products derived from this +;; software without specific prior written permission. +;; +;; THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR +;; IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +;; WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +;; DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +;; FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +;; CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +;; SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR +;; BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +;; WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE +;; OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +;; IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +;;; Commentary: +;; +;; Setting up citing in Gnus with Supercite. +;; + +;;; Credits: +;; +;; The HTML version of this file was created with Hrvoje Niksic's +;; htmlize.el which is part of the XEmacs "text-modes" package. +;; + +;;; Todo: +;; +;; + +;;; Code: +(require 'supercite) +(require 'time-date) + +(defun sy-september-citation-line () + (let ((sc-mumble "") + (whofrom (sc-whofrom))) + (if whofrom + (insert sc-reference-tag-string + (sc-hdr "On " + (int-to-string + (- + (time-to-days (mail-header-parse-date + (sc-mail-field "date"))) + (time-to-days (encode-time 0 0 0 01 09 1993)))) + " September 1993, ") + (sc-mail-field "sc-author") + " wrote:\n")))) + +(setq sc-rewrite-header-list + '((sc-no-header) + (sc-header-on-said) + (sc-header-inarticle-writes) + (sc-header-regarding-adds) + (sc-header-attributed-writes) + (sc-header-author-writes) + (sc-header-verbose) + (sc-no-blank-line-or-header) + (sc-header-author-email-writes) + (sy-september-citation-line))) + +(setq sc-preferred-attribution-list + (list + '"sc-lastchoice" + "x-attribution" + "sc-consult" + "initials" + "firstname" + "emailname" + "lastname")) + +(setq + message-cite-function 'sc-cite-original + sc-confirm-always-p nil + sc-preferred-header-style 8 + sc-auto-fill-region-p nil + sc-fixup-whitespace-p nil + sc-electric-references-p t + sc-cite-blank-lines-p nil + sc-nested-citation-p t + sc-citation-leader " " + sc-citation-separator " " + sc-reference-tag-string "* " + sc-citation-delimiter "> " + sc-extract-address-components 'gnus-extract-address-components) + +(defun sy-sc-remove-signature () + "Removes the signature from the original message. + +To use, hang it off the appropriate hook such as `sc-pre-hook' so +you're not citing useless stuff." + (save-excursion + (let ((start (point)) + (end (mark t)) + (sig-sep gnus-signature-separator) + mark) + (while sig-sep + (goto-char end) + (when (re-search-backward (car sig-sep) start t) + (forward-line -1) + (while (looking-at "[ \t]*$") + (forward-line -1)) + (forward-line 1) + (setq mark (set-marker (make-marker) (point))) + (delete-region mark (mark t))) + (setq sig-sep (cdr sig-sep)))))) + +(add-hook 'sc-load-hook 'sc-setup-filladapt) +(add-hook 'sc-pre-hook 'sy-sc-remove-signature) +(add-hook 'mail-citation-hook 'sc-cite-original) + +;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +(message "Supercite settings loaded successfully") + diff --git a/16-riece-sy.el b/16-riece-sy.el new file mode 100644 index 0000000..4ce8736 --- /dev/null +++ b/16-riece-sy.el @@ -0,0 +1,786 @@ +;; 16-riece-sy.el --- Riece (IRC) Settings -*- Emacs-Lisp -*- + +;; Copyright (C) 2007 - 2012 Steve Youngs + +;; Author: Steve Youngs +;; Maintainer: Steve Youngs +;; Created: <2007-12-02> +;; Time-stamp: +;; Download: +;; HTMLised: +;; Git Repo: git clone http://git.sxemacs.org/syinit +;; Keywords: init, compile + +;; This file is part of SYinit + +;; Redistribution and use in source and binary forms, with or without +;; modification, are permitted provided that the following conditions +;; are met: +;; +;; 1. Redistributions of source code must retain the above copyright +;; notice, this list of conditions and the following disclaimer. +;; +;; 2. Redistributions in binary form must reproduce the above copyright +;; notice, this list of conditions and the following disclaimer in the +;; documentation and/or other materials provided with the distribution. +;; +;; 3. Neither the name of the author nor the names of any contributors +;; may be used to endorse or promote products derived from this +;; software without specific prior written permission. +;; +;; THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR +;; IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +;; WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +;; DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +;; FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +;; CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +;; SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR +;; BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +;; WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE +;; OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +;; IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +;;; Commentary: +;; +;; My Riece settings. +;; +;; Riece is a very nice IRC client for emacs. Unlike ERC which +;; tries to be like "traditional" IRC clients, Riece is much more +;; emacs like. +;; + +;;; Credits: +;; +;; The HTML version of this file was created with Hrvoje Niksic's +;; htmlize.el which is part of the XEmacs "text-modes" package. +;; + +;;; Todo: +;; +;; + +;;; Code: +(require 'riece-options) +(require 'riece-biff) +(require 'riece-log) +(require 'riece) + +;; Misc setq's +(setq riece-alias-percent-hack-mask "*.net" + riece-biff-check-channels '(;"#sxemacs" + "#harmattan" + "#meego" + "#n9") + ;"#emchat" + ;"#xwem" + ;"#fresse" + ;"#xemacs") + riece-channel-buffer-mode t + riece-default-channel-binding nil + riece-default-coding-system 'binary + riece-gather-channel-modes t + riece-ignore-discard-message nil + riece-keywords '("JackaLX" "jackalx" "Eicq" "eicq" "EMchat" "emchat" + "SXEmacs" "sxemacs" "XWEM" "xwem" "XLIB" "xlib" "tla" + "arch" "xtla" "XEtla" "xetla" "eMoney" "emoney" + "JackaLX_N9" "jackalx_n9") + riece-layout '"bottom-right" + riece-retry-with-new-nickname t + riece-server-alist + '(("irc.sxemacs.org" :host "irc.sxemacs.org") + ("irc.au.freenode.net" :host "irc.au.freenode.net") + ("azimov.freenode.net" :host "azimov.freenode.net") + ("brin.freenode.net" :host "brin.freenode.net") + ("irc.freenode.org" :host "irc.freenode.org") + ("irc.freenode.net" :host "irc.freenode.net") + ("kornbluth.freenode.net" :host "kornbluth.freenode.net") + ("orwell.freenode.net" :host "orwell.freenode.net") + ("calvino.freenode.net" :host "calvino.freenode.net") + ("wells.freenode.net" :host "wells.freenode.net") + ("zelazny.freenode.net" :host "zelazny.freenode.net") + ("anthony.freenode.net" :host "anthony.freenode.net") + ("irc.nac.net" :host "irc.nac.net") + ("irc.efnet.org" :host "irc.efnet.org") + ("irc.efnet.net" :host "irc.efnet.net")) + riece-user-agent 'emacs-riece-config + riece-user-list-buffer-mode t) + +;; Addons +(riece-command-insinuate-addon 'riece-yank) +(riece-command-insinuate-addon 'riece-hangman) +(riece-command-insinuate-addon 'riece-keepalive) +(riece-command-insinuate-addon 'riece-shrink-buffer) +(riece-command-insinuate-addon 'riece-xfaceb) +(riece-command-insinuate-addon 'riece-button) +(riece-command-insinuate-addon 'riece-epg) + +(riece-command-enable-addon 'riece-hangman) + +;; Leave this OFF it is too annoying. Fun, but annoying. +;; (riece-command-insinuate-addon 'riece-doctor) +;; (riece-command-enable-addon 'riece-doctor) + +;; A few handy functions that extend Riece's features a bit. +(defvar riece-unread-channels) +(defun sy-riece-clear-unread-chans () + "Get rid of the unread mark on all channels." + (interactive) + (let ((current riece-current-channel)) + (setq riece-unread-channels nil) + (riece-switch-to-channel current))) + +(defun sy-riece-relist-chans-clear-blanks () + "Relist the channel buffer removing any blanks in the sequence. + +When you part from a channel/user you are left with a gap in the +sequence of channel numbers in the channels buffer. This removes +those gaps." + (interactive) + (let ((current riece-current-channel)) + (setq riece-current-channels + (remove-if #'null riece-current-channels)) + (riece-switch-to-channel current))) + +(defun sy-riece-command-memoserv (command) + "Send COMMAND, a string, to MEMOSERV. + +With prefix arg, also /join." + (interactive "sMemoserv: ") + (when current-prefix-arg + (riece-command-join ["MemoServ" ""])) + (riece-send-string (format "MEMOSERV %s\r\n" command))) + +(defun sy-riece-command-chanserv (command) + "Send COMMAND, a string, to CHANSERV. + +With prefix arg, also /join." + (interactive "sChanserv: ") + (when current-prefix-arg + (riece-command-join ["ChanServ" ""])) + (riece-send-string (format "CHANSERV %s\r\n" command))) + +(defun sy-riece-command-nickserv (command) + "Send COMMAND, a string, to NICKSERV. + +With prefix arg, also /join." + (interactive "sNickserv: ") + (when current-prefix-arg + (riece-command-join ["NickServ" ""])) + (riece-send-string (format "NICKSERV %s\r\n" command))) + +(defun sy-riece-command-seenserv (command) + "Send COMMAND, a string, to SEENSERV. + +With prefix arg, also /join." + (interactive "sSeenserv: ") + (when current-prefix-arg + (riece-command-join ["SeenServ" ""])) + (riece-send-string (format "SEENSERV %s\r\n" command))) + +(defun sy-riece-command-quick-op () + "Request Ops from ChanServ in the current channel." + (interactive) + (let ((chan (riece-identity-prefix riece-current-channel))) + (sy-riece-command-chanserv (format "OP %s" chan)))) + +(defun sy-riece-command-mute-user (&optional user unmute) + "Set mode +q on USER, effectively muting them. + +Optional prefix arg, UNMUTE to let them speak again." + (interactive "i\nP") + (let ((user (or user + (completing-read + "(Un)Mute user: " + (riece-with-server-buffer + (riece-identity-server riece-current-channel) + (riece-channel-get-users (riece-identity-prefix + riece-current-channel))))))) + (riece-send-string + (format "MODE %s %sq %s\r\n" + (riece-identity-prefix riece-current-channel) + (if (or unmute + current-prefix-arg) + "-" + "+") + user)))) + +(defun sy-riece-list-banned (channel) + "List the banned users on CHANNEL, current if omitted." + (interactive "P") + (let ((channel (if current-prefix-arg + (vector (read-string "Channel: ") "") + riece-current-channel))) + (riece-send-string + (format "MODE %s b\r\n" (riece-identity-prefix channel))))) + +(defun sy-riece-command-ban-user (&optional user unban) + "Ban USER from current channel. + +Optional prefix arg, UNBAN removes the ban." + (interactive "i\nP") + (let ((user (or user + (completing-read + "(Un)Ban user: " + (riece-with-server-buffer + (riece-identity-server riece-current-channel) + (riece-channel-get-users (riece-identity-prefix + riece-current-channel)))))) + reason) + (if (or unban + current-prefix-arg) + (riece-send-string + (format "MODE %s -b %s\r\n" + (riece-identity-prefix riece-current-channel) + user)) + (setq reason (read-string "Reason: " nil nil + "Need a reason? Look in a mirror!")) + (riece-send-string + (format "MODE %s +b %s\r\n" + (riece-identity-prefix riece-current-channel) + user)) + (riece-command-kick user reason)))) + +;; Share the muzak! +(defun sy-riece-say-now-playing (&optional notice) + "Say into the current channel what mp3 is playing. + +With non-nil optional prefix arg, NOTICE, send it as a notice." + (interactive "P") + (let ((song (if **mpd-var-Title* + (format "%s --- [%s]" + **mpd-var-Title* + **mpd-var-Artist*) + "The Sounds of Silence --- [Marcel Marceau]"))) + (riece-command-send-message (format "NP: %s" song) + (if current-prefix-arg + 'notice + nil)))) + +(defun sy-riece-say-all-purpose (&optional notice) + "Send the all-purpose answer to everything." + (interactive "P") + (riece-command-send-message "Adolf Hitler in fishnets" + (if current-prefix-arg + 'notice + nil))) + + +;; Tell the world what we're using. +(defun sy-riece-say-version (&optional notice) + "Say the version of Riece we are running. + +With non-nil prefix arg, NOTICE, send as a notice." + (interactive "P") + (riece-command-send-message + (format "I'm using: %s" (riece-extended-version)) + (if current-prefix-arg + 'notice + nil))) + +;; say (foo) => bar +(defun sy-riece-send-form () + "Sends a form and it's eval" + (interactive) + (let* ((form (read-string "sexp: ")) + (value (eval (read form)))) + (riece-command-send-message (format "%s => %s" form value) + (if current-prefix-arg + 'notice + nil)))) + +(defun sy-make-rot13-translation-table () + "Create a rot13 table." + (let ((i -1) + (table (make-string 256 0)) + (a (char-to-int ?a)) + (A (char-to-int ?A))) + (while (< (incf i) 256) + (aset table i i)) + (concat + (substring table 0 A) + (substring table (+ A 13) (+ A 13 (- 26 13))) + (substring table A (+ A 13)) + (substring table (+ A 26) a) + (substring table (+ a 13) (+ a 13 (- 26 13))) + (substring table a (+ a 13)) + (substring table (+ a 26) 255)))) + +(defun sy-rot13-string (string) + "Convert TEXT to rot13-ese." + (let ((table (sy-make-rot13-translation-table))) + (with-temp-buffer + (insert string) + (translate-region (point-min) (point-max) table) + (buffer-string)))) + +(defun sy-riece-send-rot13 (text) + "Talk in rot13-ese." + (interactive "srot13: ") + (riece-command-send-message + (sy-rot13-string text) + (if current-prefix-arg + 'notice + nil))) + +(defun sy-morse-string (string) + "Return STRING in morse code." + (with-temp-buffer + (insert string) + (morse-region (point-min) (point-max)) + (goto-char (point-min)) + (while (re-search-forward "/" nil t) + (replace-match " ")) + (buffer-string))) + +(defun sy-riece-send-morse (text) + "Talk in morse code." + (interactive "sMorse: ") + (riece-command-send-message + (sy-morse-string text) + (if current-prefix-arg + 'notice + nil))) + +;; Show off! +(autoload 'riece-command-ctcp-action "riece-ctcp" nil t) +(defun sy-riece-show-off () + "Brag about how many channels/people we're talking to." + (interactive) + (sy-riece-relist-chans-clear-blanks) + (let* ((channels riece-current-channels) + (numchans (length channels)) + (numppl 0) + currchan) + (while channels + (setq currchan (car channels)) + (setq numppl (+ numppl + (length (riece-with-server-buffer + (riece-identity-server currchan) + (riece-channel-get-users + (riece-identity-prefix currchan)))))) + (setq channels (cdr channels))) + (riece-command-ctcp-action + riece-current-channel + (format + "is in %d channels, talking to %d people :-P" + numchans numppl)))) + +;; Brag about how long SXEmacs has been up +(defun sy-riece-sxe-uptime () + "Display as action SXEmacs uptime." + (interactive) + (let* ((ut (uptime)) + (days (car ut)) + (hours (cadr ut)) + (minutes (caddr ut)) + (seconds (cadddr ut))) + (riece-command-ctcp-action + riece-current-channel + (concat "-=[ SXEmacs Uptime: " + (unless (zerop days) + (if (eq days 1) + "1 day, " + (concat (number-to-string days) " days, "))) + (unless (zerop hours) + (if (eq hours 1) + "1 hour, " + (concat (number-to-string hours) " hours, "))) + (unless (zerop minutes) + (if (eq minutes 1) + "1 minute, " + (concat (number-to-string minutes) " minutes, "))) + (if (zerop seconds) + "and 0 seconds" + (if (eq seconds 1) + "and 1 second." + (concat "and " + (number-to-string seconds) + " seconds"))) + " ]=-")))) + + +;; segassem desrever eikeeg ylbirreT +(defun sy-riece-reverse () + ".sdrawkcab kaepS" + (interactive) + (let ((str (read-string "Say backwards: "))) + (riece-command-send-message + (concat (nreverse (string-to-list str))) nil))) + +;; .oO0{ what's he thinking? } +(defun sy-riece-think () + "Send a .oO0{ think balloon action }." + (interactive) + (let ((think (read-string "What are you thinking? "))) + (riece-command-ctcp-action + riece-current-channel + (format ".oO0{ %s }" think)))) + +;; When pictures speak louder than words... +(defun sy-riece-fuck-you (&optional upyours) + "For those occasions where... you know what I mean." + (interactive "P") + (let ((fuckyou " + _ _ + |_| |_| + | | /^^^\\ | | + _| |_ (| \"o\" |) _| |_ + _| | | | _ (_---_) _ | | | |_ +| | | | |' | _| |_ | `| | | | | +| | / \\ | | + \\ / / /(. .)\\ \\ \\ / + \\ / / / | . | \\ \\ \\ / + \\ \\/ / ||Y|| \\ \\/ / + \\__/ || || \\__/ + () () + || || + ooO Ooo") + (upyours " + .-. + |U| + | | + | | + _| |_ + | | | |-. + /| ` | +| | | +| | +\\ / + | | + | |") + (riece-yank-tick 0.1)) + (with-temp-buffer + (if current-prefix-arg + (insert upyours) + (insert fuckyou)) + (kill-region (point-min) (point-max))) + (riece-command-yank nil nil))) + +;; Nick completion. Lets face it, compared to other IRC clients like +;; BitchX or even ERC, Riece's nick completion is pretty sucky. :-( +;; This is my vain attempt to improve it. +(defun sy-riece-command-complete-user () + "Like `riece-command-complete-user' but restrict to current chan. + +This version of nick completion maintains the original case of the +nick being completed. The version in Riece downcases the completion +\(could be a bug\). + +If the completion is being inserted at column zero, `: ' is appended, +otherwise ` ' is added. + +The following is not yet implemented, but I'd also like to be able to +complete from the middle of a nick... + + Nickname User Types Expands To + -------- ---------- ---------- + MyNick nic MyNick:" + (interactive) + (let* ((completion-ignore-case t) + (table (riece-with-server-buffer + (riece-identity-server riece-current-channel) + (riece-channel-get-users (riece-identity-prefix + riece-current-channel)))) + (current (or (current-word) "")) + (completion (try-completion current table)) + (all (all-completions current table))) + (if (eq completion t) + nil + (if (null completion) + (message "Can't find completion for \"%s\"" current) + (if (equal current completion) + (with-output-to-temp-buffer "*Help*" + (display-completion-list all)) + (re-search-forward "\\>" nil t) + (delete-region (point) (- (point) (length current))) + (if (eq (point) (point-at-bol)) + (insert completion ": ") + (insert completion " "))))))) + +;(defalias 'riece-command-complete-user 'sy-riece-command-complete-user) + +;; "schme" funky cycling completion +;; Reworked to support cycling in both directions using dllists, plus +;; other misc improvements by me. --SY. +(defvar riece-me:completion-time 3 + "Time in seconds before completion list is reset.") +(defvar riece-me:*completion-timer* (make-itimer) + "Completion timer.") +(defvar riece-me:*completion-list* nil + "Completion list.") + +(defvar sy-riece-nick-syntax-table + (let ((table (copy-syntax-table text-mode-syntax-table))) + (modify-syntax-entry ?~ "w " table) + (modify-syntax-entry ?` "w " table) + (modify-syntax-entry ?- "w " table) + (modify-syntax-entry ?_ "w " table) + (modify-syntax-entry ?+ "w " table) + (modify-syntax-entry ?{ "w " table) + (modify-syntax-entry ?[ "w " table) + (modify-syntax-entry ?} "w " table) + (modify-syntax-entry ?] "w " table) + (modify-syntax-entry ?\\ "w " table) + (modify-syntax-entry ?| "w " table) + (modify-syntax-entry ?: "w " table) + (modify-syntax-entry ?\; "w " table) + (modify-syntax-entry ?' "w " table) + (modify-syntax-entry ?< "w " table) + (modify-syntax-entry ?, "w " table) + (modify-syntax-entry ?> "w " table) + table) + "Syntax table used in funky nick cycling completion.") + +(defun sy-riece-init-completion-timer () + "Initialise the completion timer." + (let ((timer riece-me:*completion-timer*)) + (set-itimer-function timer #'(lambda () + (setq riece-me:*completion-list* nil))) + (set-itimer-value timer riece-me:completion-time))) +(add-hook 'riece-after-login-hook #'sy-riece-init-completion-timer) + +(defsubst sy-riece-cycle-list (list &optional reverse) + "Return a list of head of LIST, and LIST rotated 1 place forward. + +If optional argument, REVERSE is non-nil, rotate the list in the other +direction." + (let ((list (apply #'dllist list)) + name) + (if reverse + (dllist-rrotate list) + (dllist-lrotate list)) + (setq name (dllist-car list)) + (list name (dllist-to-list list)))) + +(defsubst sy-riece-set-completion-timer () + "(Re)set completion timer's value." + (let ((timer riece-me:*completion-timer*)) + (and (itimerp timer) + (set-itimer-value timer riece-me:completion-time)))) + +(defun sy-riece-complete-user-backwards () + "Complete nick, cycling backwards. +See `riece-me:command-complete-user'." + (interactive) + (riece-me:command-complete-user 'reverse)) + +(add-hook 'riece-command-mode-hook + #'(lambda () + (local-set-key [iso-left-tab] #'sy-riece-complete-user-backwards))) + +(defun riece-me:command-complete-user (&optional reverse) + "Like `riece-command-complete-user' but restrict to current chan. + +This completion does not pop up any completion buffers, instead it +cycles through the user names \"in-place\" with each successive TAB. + +With non-nil optional argument, REVERSE, the cycling goes in the other +direction. + +If the completion is being inserted at column zero, \": \" is appended, +otherwise \" \" is added. " + (interactive) + (unless riece-me:*completion-list* + (unless (itimer-live-p riece-me:*completion-timer*) + (sy-riece-set-completion-timer) + (activate-itimer riece-me:*completion-timer*)) + (let* ((completion-ignore-case t) + (table (riece-with-server-buffer + (riece-identity-server riece-current-channel) + (riece-channel-get-users (riece-identity-prefix + riece-current-channel)))) + (current (current-word)) + (completion (try-completion current table)) + (all (all-completions current table))) + (if (null completion) + (message "Can't find completion for \"%s\"" current) + (setq riece-me:*completion-list* all)))) + (when riece-me:*completion-list* + (multiple-value-bind (completion newlist) + (sy-riece-cycle-list riece-me:*completion-list* reverse) + (setq riece-me:*completion-list* newlist) + (with-syntax-table sy-riece-nick-syntax-table + (unless (string= "" (current-word)) + (backward-delete-word)) + (insert completion) + (let ((nicksuffix " ")) + (save-excursion + (backward-word) + (and (bolp) + (setq nicksuffix ": "))) + (insert nicksuffix))) + (sy-riece-set-completion-timer)))) + +(defalias 'riece-command-complete-user 'riece-me:command-complete-user) +;;; + +(defun sy-riece-add-rem-biff-channel (&optional remove) + "Add the current channel to the list of channels for riece-biff. + +With optional prefix arg, REMOVE, remove the current channel from the +biff list." + (interactive "P") + (if (or current-prefix-arg + remove) + ;; Remove chan. + (progn + (setq riece-biff-check-channels + (remove (riece-identity-prefix riece-current-channel) + riece-biff-check-channels)) + (message "Channel: %s removed from riece-biff channel list." + (riece-identity-prefix riece-current-channel))) + ;; Add chan. + (add-to-list 'riece-biff-check-channels + (riece-identity-prefix riece-current-channel)) + (message "Channel: %s added to riece-biff channel list." + (riece-identity-prefix riece-current-channel)))) + + +;; Define keys for those functions. +(define-key riece-command-map (kbd "C-c C") #'sy-riece-clear-unread-chans) +(define-key riece-command-map (kbd "C-c r") + #'sy-riece-relist-chans-clear-blanks) +(define-key riece-command-map (kbd "C-c m") #'sy-riece-command-mute-user) +(define-key riece-command-map (kbd "C-b") #'sy-riece-command-ban-user) +(define-key riece-command-map (kbd "C-o") #'sy-riece-command-quick-op) +(define-key riece-command-map (kbd "C-c n") #'sy-riece-say-now-playing) +(define-key riece-command-map (kbd "C-c V") #'sy-riece-say-version) +(define-key riece-command-map (kbd "C-c s") #'sy-riece-show-off) +(define-key riece-command-map (kbd "C-c f") #'sy-riece-fuck-you) +(define-key riece-command-map (kbd "C-c b") #'sy-riece-add-rem-biff-channel) +(define-key riece-command-map (kbd "C-c ?") #'sy-riece-think) +(define-key riece-command-map (kbd "C-c R") #'sy-riece-reverse) +(define-key riece-command-map (kbd "C-c U") #'sy-riece-sxe-uptime) +(define-key riece-command-map [a] #'sy-riece-say-all-purpose) + +;; So I can start Riece in a new frame +(defvar riece-frame nil + "Frame for Riece.") + +(defun sy-riece (&optional ask) + "Run Riece in a new frame. + +With non-nil optional prefix ASK Riece will prompt for a server to +connect to." + (interactive "P") + (let ((riece-server (if current-prefix-arg + nil + "irc.sxemacs.org"))) + (setq riece-frame (new-frame '((name . "RieceFrame")))) + (select-frame riece-frame) + (call-interactively 'riece) + (focus-frame riece-frame))) + +(defun sy-riece-exit-hook () + (when (frame-live-p riece-frame) + (delete-frame riece-frame)) + (setq riece-frame nil)) + +(add-hook 'riece-exit-hook #'sy-riece-exit-hook) + +;; riece-startup-channel-list doesn't fit in with the way I do things +;; and the way freenode functions. It gets called too damned early. +;; What follows is my attempt to make Riece behave better with logging +;; into freenode, registering to nickserv, joining initial channels, +;; and getting ops with chanserv. +(defvar sy-riece-startup-channel-list + '("#sxemacs" + "#harmattan" + "#meego" + "#n9" + "#emchat" + ;"#xwem" + ;"#fresse" + "#xemacs" + "#emacs" +; "#e" +; "#pulseaudio" + "#latex" +; "#iptables" +; "#netfilter" + "#postgresql" +; "##c" +; "##kernel" +; "#linux-kernel" +; "#glibc" +; "#gcc" + "#zsh") + "List of channels to join after logging in and identifying to nickserv.") + +;; Set up channel coding systems +;; +;; This is a PITA... turn on utf and can't read iso-8859-1 special +;; chars, turn it off and can't read utf. Have I mentioned how much I +;; hate this crap? --SY. +(mapcar + #'(lambda (chan) + (if (string-match #r"#\(sxemacs\|e\(mchat\|icq\)\|xwem\|fresse\)" chan) + (push (cons chan 'iso-8859-1) riece-channel-coding-system-alist) + (push (cons chan 'utf-8) riece-channel-coding-system-alist))) + sy-riece-startup-channel-list) + +(defun sy-riece-login () + (riece-send-string (format "PRIVMSG NickServ :identify %s\r\n" + (getenv "IRCPASSWD"))) + (sleep-for 3) + (let ((channel-list sy-riece-startup-channel-list) + entry identity) + (while channel-list + (unless (listp (setq entry (car channel-list))) + (setq entry (list (car channel-list)))) + (if (equal (riece-identity-server + (setq identity (riece-parse-identity (car entry)))) + riece-server-name) + (riece-command-join-channel identity (nth 1 entry))) + (setq channel-list (cdr channel-list)))) + (riece-send-string "PRIVMSG ChanServ :op #sxemacs\r\n")) + ;(riece-send-string "PRIVMSG ChanServ :op #emchat\r\n") + ;(riece-send-string "PRIVMSG ChanServ :op #xwem\r\n") + ;(riece-send-string "PRIVMSG ChanServ :op #fresse\r\n") + ;(riece-send-string "PRIVMSG ChanServ :op #xemacs\r\n")) + +(add-hook 'riece-after-login-hook #'sy-riece-login) + +;; Until I can find a solution to my hook problem (login hook not +;; running to completion) I use this to finish the job +(defun sy-riece-cleanup-login () + (interactive) + (riece-command-switch-to-channel-by-number 2) + (riece-part-channel riece-current-channel) + ;(riece-part-channel ["MemoServ" ""]) + (riece-part-channel ["ChanServ" ""]) + (riece-part-channel ["NickServ" ""]) + (sy-riece-relist-chans-clear-blanks) + (riece-command-switch-to-channel-by-number 1)) + +;(add-hook 'riece-after-login-hook #'sy-riece-cleanup-login 'append) + +(define-key riece-command-map (kbd "C-c l") 'sy-riece-cleanup-login) + +;; Automatically clear Riece Biff indicator by switching to the right +;; window/frame +(defun sy-riece-check-command-buffer () + (and (get-buffer-window (or riece-command-buffer "*Command*")) + (riece-biff-clear))) + +(defadvice switch-to-buffer (after riece-update (&rest args) activate) + "After switching buffers, check to see if riece-biff should be cleared. +The riece-biff modeline indicator will only be cleared if +`riece-command-buffer' is visible in the selected frame." + (sy-riece-check-command-buffer)) + +(add-hook 'select-frame-hook #'sy-riece-check-command-buffer) + +;; Easier switch to Riece when running on TTY. +(defun sy-switch-to-riece () + "I use this to switch to Riece when I'm on a tty." + (interactive) + (when (buffer-live-p riece-command-buffer) + (pop-to-buffer riece-command-buffer) + (riece-command-configure-windows))) + +(define-key global-tty-map [(control ?c) ?r] #'sy-switch-to-riece) + +;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +(message "Riece settings loaded successfully") + diff --git a/17-emchat-sy.el b/17-emchat-sy.el new file mode 100644 index 0000000..efafba5 --- /dev/null +++ b/17-emchat-sy.el @@ -0,0 +1,317 @@ +;; 17-emchat-sy.el --- EMchat Settings -*- Emacs-Lisp -*- + +;; Copyright (C) 2007 - 2012 Steve Youngs + +;; Author: Steve Youngs +;; Maintainer: Steve Youngs +;; Created: <2007-12-02> +;; Time-stamp: +;; Download: +;; HTMLised: +;; Git Repo: git clone http://git.sxemacs.org/syinit +;; Keywords: init, compile + +;; This file is part of SYinit + +;; Redistribution and use in source and binary forms, with or without +;; modification, are permitted provided that the following conditions +;; are met: +;; +;; 1. Redistributions of source code must retain the above copyright +;; notice, this list of conditions and the following disclaimer. +;; +;; 2. Redistributions in binary form must reproduce the above copyright +;; notice, this list of conditions and the following disclaimer in the +;; documentation and/or other materials provided with the distribution. +;; +;; 3. Neither the name of the author nor the names of any contributors +;; may be used to endorse or promote products derived from this +;; software without specific prior written permission. +;; +;; THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR +;; IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +;; WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +;; DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +;; FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +;; CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +;; SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR +;; BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +;; WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE +;; OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +;; IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +;;; Commentary: +;; +;; My EMchat settings. +;; + +;;; Credits: +;; +;; The HTML version of this file was created with Hrvoje Niksic's +;; htmlize.el which is part of the XEmacs "text-modes" package. +;; + +;;; Todo: +;; +;; + +;;; Code: +;:*======================= +;:* emchat settings +(load "emchat") + +;;; Experimental stuff + + +;; EMchat works great in a tty, but some setttings I use are best +;; suited for X, so this just turns them off. +(defun tty-im-setup () + "Set some things so I can use EMchat/Riece in tty." + (interactive) + (setq emchat-status-use-gutter nil + emchat-start-in-new-frame nil + emchat-wharf-frame-use-p nil)) +;;; + +(when (device-on-window-system-p) + (setq emchat-status-use-gutter t + emchat-start-in-new-frame t)) + +(setq + emchat-doctor-enabled-flag t + emchat-emphasis-enabled-flag t + emchat-history-enabled-flag t + emchat-log-fill-column 72 + emchat-smiley t + emchat-track-enable t + emchat-track-indicator-type 'char + emchat-user-alias "JackaLX" + emchat-user-password (getenv "ICQPASSWD") + emchat-user-meta-nickname "JackaLX" + emchat-user-meta-firstname "Steve" + emchat-user-meta-lastname "Youngs" + emchat-user-meta-primary-email "steve@sxemacs.org" + emchat-user-meta-secondary-email "steve@steveyoungs.com" + emchat-user-meta-city "Brisbane" + emchat-user-meta-state "DOA" + emchat-user-meta-hide-ip t + emchat-user-meta-authorization t + emchat-user-meta-about + "EMchat Maintainer.\n + If you'd like to help out with the EMchat project, + please send me a message. Or go to: + \n + SXEmacs - It's not just an editor. + It's a way of life! + " + emchat-user-meta-homepage "http://www.sxemacs.org/" + emchat-user-meta-sex 'male + emchat-user-meta-language-1 12 + emchat-user-meta-language-2 12 + emchat-user-meta-language-3 12 + emchat-user-meta-web-aware t + emchat-user-initial-status "online" + emchat-user-meta-age 38 + emchat-user-meta-birth-day 19 + emchat-user-meta-birth-month 6 + emchat-user-meta-birth-year 66 + emchat-user-meta-cell-phone "6666 6666" + emchat-user-meta-country 61 + emchat-user-meta-fax "7777 7777" + emchat-user-meta-phone "8888 8888" + emchat-user-meta-street "1 Linux Lane" + emchat-user-meta-work-homepage "http://www.sxemacs.org/" + emchat-user-meta-work-address "What me, work?" + emchat-user-meta-work-city "Penguinville" + emchat-user-meta-work-company "SlackBiz" + emchat-user-meta-work-department "Slackers" + emchat-user-meta-work-fax "9999 9999" + emchat-user-meta-work-phone "5555 5555" + emchat-user-meta-work-position "Seated" + emchat-user-meta-work-state "DOA" + emchat-user-meta-zipcode "9999" + emchat-buddy-view 'emchat-all-aliases + emchat-use-sound-flag nil + emchat-save-log-on-exit-p nil + emchat-log-debug-flag t + emchat-user-meta-invisible nil + emchat-buddy-show-xface t) + +;; PulseAudio only seems to work if X is running +(when (getenv "DISPLAY") + (setq emchat-use-sound-flag t)) + +(customize-set-variable 'emchat-auto-away-timeout 1200) + +(emchat-world-update) + +(when emchat-use-sound-flag + (setq emchat-audio-device + ;(make-audio-device 'alsa :device "plughw:0,0")) + ;(make-audio-device 'ao :driver "alsa")) + ;; Pulseaudio is CRAP!! + (make-audio-device 'pulse + :client "SXEmacs::EMchat" + :stream "EMchat::Stream")) + ;; SXEmacs doesn't like current ffmpeg + (setq emchat-media-driver 'sndfile) + (setq emchat-sound-alist + '((auth-sound . "Auth.wav") + (buddy-sound . "Online.wav") + (chat-sound . "Chat.wav") + (emailx-sound . "System.wav") + (message-sound . "Message.wav") + (pager-sound . "System.wav") + (system-sound . "System.wav") + (url-sound . "URL.wav")))) + + +;:*======================= +;:* Addons/extensions + +(defvar **mpd-var-Title* nil) +(defvar **mpd-var-Artist* nil) +(defun sy-emchat-now-playing () + "Return title/artist of current song." + (interactive) + (let ((song (if **mpd-var-Title* + (format "%s --- [%s]" + **mpd-var-Title* + **mpd-var-Artist*) + "The Sounds of Silence --- [Marcel Marceau]"))) + (format "NP: %s" song))) + +(defun sy-emchat-send-now-playing () + "Send title/artist of current song." + (interactive) + (let ((song (sy-emchat-now-playing)) + (alias (emchat-alias-around))) + (emchat-send-message song alias))) + +(defun sy-emchat-yow () + "When you can't think of what to say..." + (interactive) + (let ((message (yow)) + (alias (emchat-alias-around))) + (emchat-send-message message alias))) + + +(require 'emchat-menu) +(define-key emchat-log-mode-map (kbd "C-c p") #'sy-emchat-send-now-playing) +(define-key emchat-log-mode-map (kbd "C-c y") #'sy-emchat-yow) + +;:*======================= +;:* Hooks +(eval-when-compile + (defvar alias) + (defvar message)) + +;;(defun sy-emchat-temp (&optional fahrenheit) +;; "Returns a string to send to a ICQ user saying the current temp. + +;;With optional arg, FAHRENHEIT, don't send the temp in celsius." +;; (if fahrenheit +;; (let ((xwem-weather-temperature-format 'fahrenheit)) +;; (format "The current temperature here is: %s°F" +;; (substring (xwem-weather-get-temp) 0 -2))) +;; (let ((xwem-weather-temperature-format 'celsius)) +;; (format "The current temperature here is: %s°C" +;; (substring (xwem-weather-get-temp) 0 -2))))) + +(defconst sy-beer-love + ["when you realise, 24 beers in a case, 24 hours in a day. Coincidence?" + "when you wake up with `CRS'... Can't Remember Shit." + "when, to you, it's not a six-pack, it's a support group." + "when it is the reason you get up every afternoon." + "when you favour the 2 party system... party on Friday, party on Saturday." + "when getting f#@ked up is your hobby."] + "Proof you love beer.") + +(defun sy-emchat-beer-love () + (let ((prefix "You know you love beer... ") + (love (aref sy-beer-love + (% (+ (% (random t) 1000) 1000) + (length sy-beer-love))))) + (concat prefix love))) + +(defun sy-emchat-incoming-msg-hook () + (when (or (member alias emchat-visible-contacts) + (not (member alias emchat-invisible-contacts))) + (let ((repo "The main EMchat git repo is: +git clone http://git.emchat.org/emchat") + (download "EMchat source tarballs and (S)XEmacs pkg tarballs +can be downloaded from: Offline ATM, sorry") + (latest (shell-command-to-string + "cd ~/programming/EMchat/emchat && git describe")) + (lastlog (shell-command-to-string + "cd ~/programming/EMchat/emchat && git log -1")) + (time (format-time-string "The local time here is: %c")) + (beer (sy-emchat-beer-love)) + (song (sy-emchat-now-playing)) + (help "Cmds are prefixed with `,,' (ie, ,,cmd). Only the first +valid cmd in a msg is accepted. The cmd can appear anywhere in +the msg. + +Accepted cmds: version, latest, lastlog, emchat-repo, download, yow, +time, beer, song, help.")) + (cond ((string-match ",,version" message) + (emchat-send-message-helper + (format "I am using %s" (emchat-version)) (list alias) + 'automatic "Version sent")) + ((string-match ",,latest" message) + (emchat-send-message-helper latest (list alias) 'automatic "Latest sent")) + ((string-match ",,lastlog" message) + (emchat-send-message-helper lastlog (list alias) 'automatic "Lastlog sent")) + ((string-match ",,emchat-repo" message) + (emchat-send-message-helper repo (list alias) 'automatic "Repo sent")) + ((string-match ",,download" message) + (emchat-send-message-helper download (list alias) 'automatic "Download sent")) + ((string-match ",,yow" message) + (emchat-send-message-helper (format "%s" (yow)) (list alias) + 'automatic "Yow sent")) + ((string-match ",,time" message) + (emchat-send-message-helper time (list alias) 'automatic "Time sent")) + ;((string-match ",,temp-f" message) + ; (emchat-send-message (sy-emchat-temp 'fahrenheit) alias)) + ;((string-match ",,temp" message) + ; (emchat-send-message (sy-emchat-temp) alias)) + ((string-match ",,beer" message) + (emchat-send-message-helper beer (list alias) 'automatic "Beer sent")) + ((string-match ",,song" message) + (emchat-send-message-helper song (list alias) 'automatic "Song sent")) + ((string-match ",,help" message) + (emchat-send-message-helper help (list alias) 'automatic "Help sent")))))) + +(add-hook 'emchat-new-message-hook #'sy-emchat-incoming-msg-hook) + +(defun sy-emchat-zero-wharf () + "Helper func to zero wharf counters." + (interactive) + (emchat-wharf-change-messages "New" -9999) + (emchat-wharf-change-messages "Sys" -9999)) + +;; Use the Wharf if not using XWEM +(unless (or (string= "notyet" (getenv "XWEM_RUNNING")) + (string= "yes" (getenv "XWEM_RUNNING")) + (not (device-on-window-system-p))) + (require 'emchat-wharf) + (setq emchat-wharf-frame-use-p t) + (setq emchat-wharf-notice-riece-flag t) + (push (cons 'left 1578) emchat-wharf-frame-props) + (push (cons 'top 289) emchat-wharf-frame-props) + (push (cons 'internal-border-width 4) emchat-wharf-frame-props) + ;; `override-redirect' means no WM decorations, and you also get + ;; sticky and always on top + ;(push (cons 'override-redirect t) emchat-wharf-frame-props) + (push (cons 'border-width 1) emchat-wharf-frame-props) + (push (cons 'border-color "red") emchat-wharf-frame-props) + (add-hook 'emchat-new-message-hook #'emchat-wharf-inc-messages) + (add-hook 'emchat-system-message-hook #'emchat-wharf-inc-system) + (add-hook 'emchat-read-message-hook #'emchat-wharf-dec-messages) + (add-hook 'riece-biff-activity-hook #'emchat-wharf-riece-active) + (add-hook 'riece-biff-clear-hook #'emchat-wharf-riece-inactive) + (add-hook 'emchat-track-clear-hook #'sy-emchat-zero-wharf) + (define-key emchat-log-mode-map [?C] #'sy-emchat-zero-wharf)) + +;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::* +(message "EMchat settings loaded") diff --git a/init-el b/init-el new file mode 100644 index 0000000..7f61643 --- /dev/null +++ b/init-el @@ -0,0 +1,87 @@ +;; -*- Emacs-Lisp -*- +;; +;;; Personal SXEmacs configuration of Steve Youngs +;; +;; Download this rls=../inits/init.el;rld=init.el source here;rle. + +;; This is my `user-init-file' (~/.sxemacs/init.el). I like a +;; "modular" approach to things, so all this file does is load the +;; various other init files. This is done via SXEmacs' new SysV +;; style rc.d mechanism: lisp-initd.el +;; + +;:*======================= +;:* W A R N I N G --- D A N G E R (thar be dragons!) +;; +;; I have absolutely no problem or issues with anyone stealing +;; any (or all) of these configs. But please understand that it +;; most likely WILL NOT run "out of the box" for you. This is my +;; personal config and it is not meant to be a "one size fits +;; all" or a "newbie fast-track" type of setup. +;; +;; In fact, if you are a newbie I would strongly suggest that you +;; don't put any of this stuff into your own setup until you +;; understand what it does. Just keep it somewhere away from your +;; SXEmacs' load-path and gradually incorporate things as you get +;; to know what it all does. +;; +;; I'm happy to help you out with your config and/or answer questions +;; about this one. Email me at +;; + +;;; Credits: +;; +;; The HTML version of this file was created with Hrvoje Niksic's +;; htmlize.el which is part of the XEmacs "text-modes" package. +;; + +;; For debugging... +;(setq debug-on-error t) +;(setq debug-on-signal t) +;(setq stack-trace-on-signal t) + + +;:*======================= +;:* On with the show! +(save-window-excursion + (lisp-initd-compile-and-load)) + +;:*======================= +;:* XWEM/XLIB (I'm using Sawfish these days) +;(when (and (string= "notyet" (getenv "XWEM_RUNNING")) +; (device-on-window-system-p)) +; (xwem-init) +; (setenv "XWEM_RUNNING" "yes")) + + +;:*======================= +;:* Links to the rest of my config +;; +;; The descriptions are hyperlinks to the HTML versions of the init +;; files for easy viewing online. And the filenames are hyperlinks +;; to the source init files themselves. +;; +;; All the source files are the real deal. They're actually symlinks +;; to the ones I have in ~/.sxemacs/init.d In other words, these +;; babies are live! :-) +;; +;; +; +; rls=00-build.html;rld=Pre-Loads for byte-compiling the init files;rle: rls=../inits/00-build.el;rld=00-build.el;rle +; rls=01-vars-sy.html;rld=Misc Variables;rle: rls=../inits/01-vars-sy.el;rld=01-vars-sy.el;rle +; rls=02-keys-sy.html;rld=Key bindings;rle: rls=../inits/02-keys-sy.el;rld=02-keys-sy.el;rle +; rls=03-c-mode-sy.html;rld=C-mode Settings;rle: rls=../inits/03-c-mode-sy.el;rld=03-c-mode-sy.el;rle +; rls=04-w3-sy.html;rld=Emacs/W3 Settings;rle: rls=../inits/04-w3-sy.el;rld=04-w3-sy.el;rle +; rls=05-latex-sy.html;rld=LaTeX Settings;rle: rls=../inits/05-latex-sy.el;rld=05-latex-sy.el;rle +; rls=06-tex-site-sy.html;rld=Replace AUCTeX' tex-site.el;rle: rls=../inits/06-tex-site-sy.el;rld=06-tex-site-sy.el;rle +; rls=07-html-sy.html;rld=HTML (coding) Settings;rle: rls=../inits/07-html-sy.el;rld=07-html-sy.el;rle +; rls=08-bbdb-sy.html;rld=BBDB Settings;rle: rls=../inits/08-bbdb-sy.el;rld=08-bbdb-sy.el;rle +; rls=09-sounds-sy.html;rld=Sound Settings;rle: rls=../inits/09-sounds-sy.el;rld=09-sounds-sy.el;rle +; rls=10-toolbar-sy.html;rld=Toolbar Settings;rle: rls=../inits/10-toolbar-sy.el;rld=10-toolbar-sy.el;rle +; rls=11-pkgs-sy.html;rld=Lots of XE packages Settings;rle: rls=../inits/11-pkgs-sy.el;rld=11-pkgs-sy.el;rle +; rls=12-cal-sy.html;rld=Calendar/Diary Settings;rle: rls=../inits/12-cal-sy.el;rld=12-cal-sy.el;rle +; rls=13-misc-sy.html;rld=Misc Stuff;rle: rls=../inits/13-misc-sy.el;rld=13-misc-sy.el;rle +; rls=14-fonts-sy.html;rld=Pretty Colours;rle: rls=../inits/14-fonts-sy.el;rld=14-fonts-sy.el;rle +; rls=15-supercite-sy.html;rld=Mail citing;rle: rls=../inits/15-supercite-sy.el;rld=15-supercite-sy.el;rle +; rls=16-riece-sy.html;rld=Riece (IRC) Settings;rle: rls=../inits/16-riece-sy.el;rld=16-riece-sy.el;rle +; rls=17-emchat-sy.html;rld=EMchat Settings;rle: rls=../inits/17-emchat-sy.el;rld=17-emchat-sy.el;rle -- 2.25.1