On Tue, Sep 09, 2014 at 10:47:19PM +0100, Thomas Adam wrote: > I ... was wondering what others on this list do to make their lives easier
Automatic removal of trailing whitespace in xemacs (see attachment): ;; Removes all trailing whitespace at the end of all lines--this setting ;; makes it ask you by default. ;; (load-library "/usr/local/lib/xemacs/site-lisp/rm-tspaces.el") ;(require 'rm-tspaces) (setq-default rm-trailing-spaces 1) ;; Turn it on unconditionally for various programming modes ;; ;(add-hook 'emacs-lisp-mode-hook 'rm-trailing-spaces-always) ;(add-hook 'cperl-mode-hook 'rm-trailing-spaces-always) ;(add-hook 'c-mode-common-hook 'rm-trailing-spaces-always) ;(add-hook 'makefile-mode-hook 'rm-trailing-spaces-always) ;; Turn it off unconditionally in other places ;; (add-hook 'message-mode-hook 'rm-trailing-spaces-never) (add-hook 'nnfolder-save-buffer-hook 'rm-trailing-spaces-never) > * GDB; Acticate command line history, but I don't have the option at hand right now. Also disable some stupid warnings. Compile with -g3 to have macros available inside gdb. > * Make/compilation Zsh command line history. > Anything fvwm-specific as well would be welcomed. Fvwm NEWS file mode for xemacs (attached): (load-library "~/lib/xemacs/lisp/news-file.el") Ciao Dominik ^_^ ^_^ -- Dominik Vogt
;; rm-tspaces.el: Automatically clean trailing whitespace from buffers. ;; ;; Copyright (C) 1995 Paul D. Smith <[email protected]> ;; ;; This file requires Emacs 19 or above. It should work with both Emacs ;; and XEmacs. Use (require 'rm-tspaces) to load this file (don't ;; autoload it). ;; ;; For user-invoked whitespace cleanup, the function rm-trailing-spaces ;; can be bound to a key or invoked via M-x. ;; ;; The variable rm-trailing-spaces controls behavior when the buffer is ;; saved. By default nothing is done. See the documentation of this ;; variable for details. ;; ;; The variable rm-trailing-spaces is buffer-local. Use setq-default to ;; set the default value for all buffers. Use setq to override the ;; default value for a particular buffer. If you're going to put the ;; setq in a hook, use the handy hook functions at the end of this file ;; to avoid having to write your own. ;; ;; For example, to be asked about removal for all buffers, except ;; automatically remove spaces in C files, try something like this: ;; ;; (require 'rm-tspaces) ;; (setq-default rm-trailing-spaces 1) ; any non-nil, non-t value ;; ;; (add-hook 'c-mode-hook 'rm-trailing-spaces-always) ;; ;; Note the user is only queried when there is actually trailing ;; whitespace in the buffer (e.g., the buffer would be modified). ;; ;; This program is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by ;; the Free Software Foundation; either version 2, or (at your option) ;; any later version. ;; ;; Changes: ;; 1.2 - Add version info. ;; Add simple functions to make installing in hooks simpler. (defvar rm-trailing-spaces nil "*Value of t says silently remove all trailing spaces when a file is saved. Non-nil but not t says ask user whether to remove trailing spaces or not. nil means don't remove trailing spaces.") (make-variable-buffer-local 'rm-trailing-spaces) ;; What are we? ;; (defconst rm-tspaces-version (substring "$Revision: 1.2 $" 11 -2) "$Id: rm-tspaces.el,v 1.2 1996/05/29 19:16:38 psmith Exp $") (defun rm-trailing-spaces-internal () "Deletes trailing whitespace from all lines in the current buffer." (if (and (not buffer-read-only) rm-trailing-spaces) (save-excursion (goto-char (point-min)) (if (or (eq rm-trailing-spaces t) (and (re-search-forward "[ \t]$" nil 1) (y-or-n-p (format "Remove trailing spaces in buffer %s? " (buffer-name))))) (while (< (point) (point-max)) (end-of-line nil) (delete-horizontal-space) (forward-line 1))))) nil) ; indicates buffer-not-saved for write-file-hooks (defun rm-trailing-spaces () "Deletes trailing whitespace from all lines in the current buffer." (interactive "*") (message "Deleting trailing spaces... ") (let ((rm-trailing-spaces t)) (rm-trailing-spaces-internal)) (message "Deleting trailing spaces... done")) ;; Apply this function automatically to all buffers before they're saved. ;; (add-hook 'write-file-hooks 'rm-trailing-spaces-internal) ;; Provide some simple functions for inclusion in hooks variables ;; (defun rm-trailing-spaces-never () "Don't automatically delete trailing whitespace in this buffer." (setq rm-trailing-spaces nil)) (defun rm-trailing-spaces-ask () "Ask before deleting trailing whitespace in this buffer." (setq rm-trailing-spaces 1)) (defun rm-trailing-spaces-always () "Always automatically delete trailing whitespace in this buffer." (setq rm-trailing-spaces t)) (provide 'rm-tspaces) ;; rm-tspaces.el ends here
;; NEWS file Major Mode for XEmacs (draft) ; ; (C) 2004 Dominik Vogt <[email protected]> ; This program is free software; you can redistribute it and/or modify ; it under the terms of the GNU General Public License as published by ; the Free Software Foundation; either version 2 of the License, or ; (at your option) any later version. ; ; This program is distributed in the hope that it will be useful, ; but WITHOUT ANY WARRANTY; without even the implied warranty of ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ; GNU General Public License for more details. ; ; You should have received a copy of the GNU General Public License ; along with this program; if not, write to the Free Software ; Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ; Note: The major mode was designed for xemacs and may or may not work with ; plain emacs. ; ; Copy this file to a lisp library directory, for example ; /usr/share/xemacs/site-lisp or $HOME/share/xemacs/site-lisp ; To acticate put this line in your xemacs configuration file: ; ; (load-library "news-file.el") ; ; or ; ; (load-library "<path>/news-file.el") ;; basic mode setup ; option group (defgroup news-file nil "NEWS file mode." :tag "NEWS file" :group 'wp) ; mode hook (defcustom news-file-mode-hook nil "Hook to be run when `news-file-mode' is entered." :type 'hook :group 'news-file) ;!!!how do you do this the right way? (add-hook 'news-file-mode-hook (lambda () (setq fill-column 66))) (add-hook 'news-file-mode-hook 'auto-fill-mode) ; mode map (defvar news-file-mode-map () "Keymap used in `news-file-mode' buffers.") (if news-file-mode-map () (setq myws-mode-map (make-sparse-keymap)) ;; So far there aren't any news-file-mode specific functions ) ; auto mode definition (add-to-list 'auto-mode-alist '("O*NEWS$" . news-file-mode)) ;; syntax highlighting (defconst news-file-font-lock-keywords (list ; complain about tabs '(" " . highlight) ; separator '("^--*$" . font-lock-keyword-face) ; title + date '("^\\(Changes in \\)\\(.*\\)$" (1 font-lock-keyword-face t) (2 highlight t t)) '("^Changes in \\(alpha\\|beta\\|official\\|stable\\|development\\).*$" 1 font-lock-variable-name-face t) '("^Changes in [a-z]*\\( release \\).*$" 1 font-lock-keyword-face t) '("^Changes in [a-z]* release \\([0-9]+\\(\\.[0-9]+\\)*\\).*$" (1 font-lock-variable-name-face t t)) '("^Changes in [a-z]* release [0-9.]*\\( (\\).*$" 1 font-lock-keyword-face t) '("^Changes in [a-z]* release [0-9.]*\\( (\\)\\(\\([0-9][0-9]?-\\(Jan\\|Feb\\|Mar\\|Apr\\|May\\|Jun\\|Jul\\|Aug\\|Sep\\|Oct\\|Nov\\|Dec\\)-[1-9][0-9][0-9][0-9][0-9]*\\)\\|\\(not released yet\\)\\)).*$" (1 font-lock-keyword-face t) (2 font-lock-variable-name-face t t)) '("^Changes in [a-z]* release [0-9.]* ([-a-z0-9 ]*\\()\\).*$" 1 font-lock-keyword-face t) ; section '("^\\(\\* \\)?[a-z][ a-z]*[a-z]:$" . font-lock-preprocessor-face) ; bullets '("^\\(\\* \\).*$" 1 font-lock-keyword-face) '("^\\( +- \\).*$" 1 font-lock-keyword-face) ; faulty lines '("^[^ \n].*[^:]$" . highlight) '("^.$" . highlight) ) "Minimal highlighting expressions for NEWS file mode") (defun news-file-mode () "Major mode for editing NEWS files" (interactive) (kill-all-local-variables) (use-local-map news-file-mode-map) (setq major-mode 'news-file-mode) (setq mode-name "NEWS file") (set (make-local-variable 'font-lock-defaults) '(news-file-font-lock-keywords nil t)) (run-hooks 'news-file-mode-hook) ) (provide 'news-file-mode)
