Commit fd499c87 authored by Dave Cooper's avatar Dave Cooper
Browse files

removed emacs-goodies-el from our distro --- we only redistribute color-theme...

removed emacs-goodies-el from our distro --- we only redistribute color-theme which is still included.
parent 9b73f676
;;; align-string.el --- align string components over several lines
;; Copyright (c) 2001 Markus Bjartveit Krüger
;; Author: Markus Bjartveit Krüger <markusk@pvv.org>
;; Created: 20-Sep-2001
;; Version: 0.1
;; Keywords: convenience
;; X-URL: http://www.pvv.org/~markusk/align-string.el
;; This 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. This 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 GNU
;; Emacs; see the file `COPYING'. If not, write to the Free Software
;; Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
;; 02111-1307, USA.
;;; Code:
;;;###autoload
(defun align-string (begin end regexp count)
"Align first occurrence of REGEXP in each line of region.
If given a prefix argument, align occurrence number COUNT on each line."
(interactive "r
sAlign by:
p")
(undo-boundary)
(save-excursion
;; Move begin point to start of line.
(goto-char begin)
(setq begin (line-beginning-position))
;; Make end a marker, to track updates made in buffer. Point the
;; marker at the end of the last line, unless at start of line.
(goto-char end)
(setq end (set-marker (make-marker) (if (bolp)
(point)
(line-end-position))))
(let ((max-col 0))
;; Find max column of first occurrence of string in the lines
;; bounded by begin-marker and end-marker
(goto-char begin)
(while (< (point) end)
(when (re-search-forward regexp (line-end-position) t count)
(goto-char (match-beginning 0))
(setq max-col (max max-col (current-column))))
(beginning-of-line 2))
;; For each line in region, indent first occurrence of string
;; to max column.
(goto-char begin)
(while (< (point) end)
(when (re-search-forward regexp (line-end-position) t count)
(goto-char (match-beginning 0))
(indent-to max-col))
(beginning-of-line 2)))
;; Clear end marker.
(set-marker end nil)))
;;;###autoload
(defun align-all-strings (begin end regexp)
"Align all occurrences of REGEXP in each line of region.
That is to say, align the first occurrence of each line with each other,
align the second occurence of each line with each other, and so on."
(interactive "r
sAlign by: ")
(save-excursion
;; Move begin point to start of line.
(goto-char begin)
(setq begin (line-beginning-position))
;; Make end a marker, to track updates made in buffer. Point the
;; marker at the end of the last line.
(goto-char end)
(setq end (set-marker (make-marker) (if (bolp)
(point)
(line-end-position))))
;; Count max number of occurrences in any line in region, then
;; run align-string for each enumerated occurrence.
(let ((max-occs 0))
(goto-char begin)
(while (< (point) end)
(let ((occs-this-line 0)
(line-end (line-end-position)))
(while (and (< (point) line-end)
(re-search-forward regexp line-end t))
(setq occs-this-line (1+ occs-this-line))
; Ensure that search moves forward even if match is empty
(when (= (match-beginning 0) (point))
(forward-char)))
(setq max-occs (max max-occs occs-this-line)))
(beginning-of-line 2))
(let ((i 1))
(while (<= i max-occs)
(align-string begin end regexp i)
(setq i (1+ i)))))
;; Clear end marker.
(set-marker end nil)))
(provide 'align-string)
;;; all.el --- Edit all lines matching a given regexp.
;; Copyright (C) 1985, 1986, 1987, 1992, 1994 Free Software Foundation, Inc.
;; Copyright (C) 1994 Per Abrahamsen
;; Author: Per Abrahamsen <abraham@dina.kvl.dk>
;; Version: $Id: all.el,v 1.2 2003/05/09 16:22:59 psg Exp $
;; Keywords: matching
;; LCD Archive Entry:
;; all|Per Abrahamsen|abraham@dina.kvl.dk|
;; Edit all lines matching a given regexp|
;; $Date: 2003/05/09 16:22:59 $|$Revision: 1.2 $|~/misc/all.Z|
;; 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.
;;
;; 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., 675 Mass Ave, Cambridge, MA 02139, USA.
;;; Comments:
;; Just like occur, except that changes in the *All* buffer is
;; propagated to the original buffer.
;; I also added highlighting of the matches.
;; You can no longer use mouse-2 to find a match in the original file,
;; since the default definition of mouse to is useful.
;; However, `C-c C-c' still works.
;; Line numbers are not listed in the *All* buffer.
;; Ok, it is _not_ just like occur.
;; Some limitations:
;; - Undo in the *All* buffer is an ordinary change in the original.
;; - Changes to the original buffer is not reflected in the *All* buffer.
;; - A single change in the *All* buffer must be limited to a single match.
;; Requires GNU Emacs 19.23 or later.
;;; Code:
(defvar all-mode-map ())
(if all-mode-map
()
(setq all-mode-map (make-sparse-keymap))
(define-key all-mode-map "\C-c\C-c" 'all-mode-goto))
(defvar all-buffer nil)
(defun all-mode ()
"Major mode for output from \\[all].
All changes made in this buffer will be propagated to the buffer where
you ran \\[all].
Press \\[all-mode-goto] to go to the same spot in the original buffer."
(kill-all-local-variables)
(use-local-map all-mode-map)
(setq major-mode 'all-mode)
(setq mode-name "All")
(make-local-variable 'all-buffer)
(run-hooks 'all-mode-hook))
(defun all-mode-find (pos)
;; Find position in original buffer corresponding to POS.
(let ((overlay (all-mode-find-overlay pos)))
(if overlay
(+ (marker-position (overlay-get overlay 'marker))
(- pos (overlay-start overlay))))))
(defun all-mode-find-overlay (pos)
;; Find the overlay containing POS.
(let ((overlays (overlays-at pos)))
(while (and overlays (null (overlay-get (car overlays) 'marker)))
(setq overlays (cdr overlays)))
(car-safe overlays)))
(defun all-mode-goto ()
"Move point to the corresponding position in the original buffer."
(interactive)
(let ((pos (all-mode-find (point))))
(if pos
(pop-to-buffer all-buffer)
(error "This text is not from the original buffer"))
(goto-char pos)))
(defvar all-initialization-p nil)
(defun all-before-change-function (from to)
;; Check that change is legal
(and all-buffer
(not all-initialization-p)
(let ((start (all-mode-find-overlay from))
(end (all-mode-find-overlay to)))
(not (and start (eq start end))))
(error "Changes should be limited to a single text piece")))
(add-hook 'before-change-functions 'all-before-change-function)
(defun all-after-change-function (from to length)
;; Propagate changes from *All* buffer.
(and all-buffer
(null all-initialization-p)
(let ((buffer (current-buffer))
(pos (all-mode-find from)))
(if pos
(progn
(set-buffer all-buffer)
(delete-region pos (+ pos length))
(save-excursion
(goto-char pos)
(insert-buffer-substring buffer from to))
(set-buffer buffer))))))
(add-hook 'after-change-functions 'all-after-change-function)
;;;###autoload
(defun all (regexp &optional nlines)
"Show all lines in the current buffer containing a match for REGEXP.
If a match spreads across multiple lines, all those lines are shown.
Each line is displayed with NLINES lines before and after, or -NLINES
before if NLINES is negative.
NLINES defaults to `list-matching-lines-default-context-lines'.
Interactively it is the prefix arg.
The lines are shown in a buffer named `*All*'.
Any changes made in that buffer will be propagated to this buffer."
(interactive (list (let* ((default (car regexp-history))
(input
(read-from-minibuffer
(if default
(format
"Edit lines matching regexp (default `%s'): " default)
"Edit lines matching regexp: ")
nil nil nil
'regexp-history)))
(if (> (length input) 0) input
(setcar regexp-history default)))
current-prefix-arg))
(setq nlines (if nlines (prefix-numeric-value nlines)
list-matching-lines-default-context-lines))
(setq all-initialization-p t)
(let ((first t)
(buffer (current-buffer))
(prevend nil)
(prevstart nil)
(prevpos (point-min)))
(with-output-to-temp-buffer "*All*"
(save-excursion
(set-buffer standard-output)
(all-mode)
(setq all-buffer buffer)
(insert "Lines matching ")
(prin1 regexp)
(insert " in buffer " (buffer-name buffer) ?. ?\n)
(insert "--------\n"))
(if (eq buffer standard-output)
(goto-char (point-max)))
(save-excursion
(beginning-of-buffer)
;; Find next match, but give up if prev match was at end of buffer.
(while (and (not (= prevpos (point-max)))
(re-search-forward regexp nil t))
(goto-char (match-beginning 0))
(beginning-of-line)
(setq prevpos (point))
(goto-char (match-end 0))
(let* ((start (save-excursion
(goto-char (match-beginning 0))
(forward-line (if (< nlines 0) nlines (- nlines)))
(point)))
(end (save-excursion
(goto-char (match-end 0))
(if (> nlines 0)
(forward-line (1+ nlines))
(forward-line 1))
(point)))
marker)
(cond ((null prevend)
(setq prevstart start
prevend end))
((> start prevend)
(all-insert)
(setq prevstart start
prevend end))
(t
(setq prevend end)))))
(if prevend
(all-insert)))))
(setq all-initialization-p nil))
(defun all-insert ()
;; Insert match.
(save-excursion
(setq marker (make-marker))
(set-marker marker prevstart)
(set-buffer standard-output)
(let ((from (point))
to)
(insert-buffer-substring buffer prevstart prevend)
(setq to (point))
(overlay-put (make-overlay from to) 'marker marker)
(goto-char from)
(while (re-search-forward regexp to t)
(overlay-put (make-overlay (match-beginning 0) (match-end 0))
'face 'highlight))
(goto-char to)
(if (> nlines 0)
(insert "--------\n")))))
(provide 'all)
;;; all.el ends here
;;; apache-mode.el --- major mode for editing Apache configuration files
;; Copyright (c) 2004, 2005 Karl Chen <quarl@nospam.quarl.org>
;; Copyright (c) 1999 Jonathan Marten <jonathan.marten@uk.sun.com>
;; Author: Karl Chen <quarl@nospam.quarl.org>
;; Keywords: languages, faces
;; Last edit: 2005-01-06
;; Version: 2.0 $Id: apache-mode.el,v 1.5 2009-09-03 14:41:25 psg Exp $
;; apache-mode.el 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.
;;
;; It 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 your copy of Emacs; see the file COPYING. If not, write to the Free
;; Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
;; 02111-1307, USA.
;;; Commentary:
;;
;; (autoload 'apache-mode "apache-mode" nil t)
;; (add-to-list 'auto-mode-alist '("\\.htaccess\\'" . apache-mode))
;; (add-to-list 'auto-mode-alist '("httpd\\.conf\\'" . apache-mode))
;; (add-to-list 'auto-mode-alist '("srm\\.conf\\'" . apache-mode))
;; (add-to-list 'auto-mode-alist '("access\\.conf\\'" . apache-mode))
;; (add-to-list 'auto-mode-alist '("sites-\\(available\\|enabled\\)/" . apache-mode))
;;
;;; History:
;; 1999-10 Jonathan Marten <jonathan.marten@uk.sun.com>
;; initial version
;; 2004-09-12 Karl Chen <quarl@nospam.quarl.org>
;; rewrote pretty much everything using define-derived-mode; added support
;; for Apache 2.x; fixed highlighting in GNU Emacs; created indentation
;; function
;;
;; 2005-06-29 Kumar Appaiah <akumar_NOSPAM@ee.iitm.ac.in>
;; use syntax table instead of font-lock-keywords to highlight comments.
;;; Code:
;; Requires
(require 'regexp-opt)
(defvar apache-indent-level 4
"*Number of spaces to indent per level")
(defvar apache-mode-syntax-table
(let ((table (make-syntax-table)))
(modify-syntax-entry ?_ "_" table)
(modify-syntax-entry ?- "_" table)
(modify-syntax-entry ?( "()" table)
(modify-syntax-entry ?) ")(" table)
(modify-syntax-entry ?< "(>" table)
(modify-syntax-entry ?> ")<" table)
(modify-syntax-entry ?\" "\"" table)
(modify-syntax-entry ?, "." table)
(modify-syntax-entry ?# "<" table)
(modify-syntax-entry ?\n ">#" table)
table))
;;;###autoload
(define-derived-mode apache-mode fundamental-mode "Apache"
"Major mode for editing Apache configuration files."
(set (make-local-variable 'comment-start) "# ")
(set (make-local-variable 'comment-start-skip) "#\\W*")
(set (make-local-variable 'comment-column) 48)
(set (make-local-variable 'indent-line-function) 'apache-indent-line)
(set (make-local-variable 'font-lock-defaults)
'(apache-font-lock-keywords nil t
((?_ . "w")
(?- . "w"))
beginning-of-line)))
;; Font lock
(defconst apache-font-lock-keywords
(purecopy
(list
;; see syntax table for comment highlighting
;; (list "^[ \t]*#.*" 0 'font-lock-comment-face t)
(list (concat ; sections
"^[ \t]*</?"
(regexp-opt '(
"Directory"
"DirectoryMatch"
"Files"
"FilesMatch"
"IfDefine"
"IfModule"
"Limit"
"LimitExcept"
"Location"
"LocationMatch"
"Proxy"
"ProxyMatch"
"VirtualHost"
) 'words)
".*?>")
1 'font-lock-function-name-face)
(list (concat ; directives
"^[ \t]*"
(regexp-opt '
(
"AcceptMutex"
"AcceptPathInfo"
"AccessConfig"
"AccessFileName"
"Action"
"AddAlt"
"AddAltByEncoding"
"AddAltByType"
"AddCharset"
"AddDefaultCharset"
"AddDescription"
"AddEncoding"
"AddHandler"
"AddIcon"
"AddIconByEncoding"
"AddIconByType"
"AddInputFilter"
"AddLanguage"
"AddModule"
"AddModuleInfo"
"AddOutputFilter"
"AddOutputFilterByType"
"AddType"
"AgentLog"
"Alias"
"AliasMatch"
"Allow from"
"Allow"
"AllowCONNECT"
"AllowEncodedSlashes"
"AllowOverride"
"Anonymous"
"Anonymous_Authoritative"
"Anonymous_LogEmail"
"Anonymous_MustGiveEmail"
"Anonymous_NoUserID"
"Anonymous_VerifyEmail"
"AssignUserID"
"AuthAuthoritative"
"AuthDBAuthoritative"
"AuthDBGroupFile"
"AuthDBMAuthoritative"
"AuthDBMGroupFile"
"AuthDBMType"
"AuthDBMUserFile"
"AuthDBUserFile"
"AuthDigestAlgorithm"
"AuthDigestDomain"
"AuthDigestFile"
"AuthDigestGroupFile"
"AuthDigestNcCheck"
"AuthDigestNonceFormat"
"AuthDigestNonceLifetime"
"AuthDigestQop"
"AuthDigestShmemSize"
"AuthGroupFile"
"AuthLDAPAuthoritative"
"AuthLDAPBindDN"
"AuthLDAPBindPassword"
"AuthLDAPCharsetConfig"
"AuthLDAPCompareDNOnServer"
"AuthLDAPDereferenceAliases"
"AuthLDAPEnabled"
"AuthLDAPFrontPageHack"
"AuthLDAPGroupAttribute"
"AuthLDAPGroupAttributeIsDN"
"AuthLDAPRemoteUserIsDN"
"AuthLDAPUrl"
"AuthName"
"AuthType"
"AuthUserFile"
"BS2000Account"
"BindAddress"
"BrowserMatch"
"BrowserMatchNoCase"
"CGIMapExtension"
"CacheDefaultExpire"
"CacheDirLength"
"CacheDirLevels"
"CacheDisable"
"CacheEnable"
"CacheExpiryCheck"
"CacheFile"
"CacheForceCompletion"
"CacheGcClean"
"CacheGcDaily"
"CacheGcInterval"
"CacheGcMemUsage"
"CacheGcUnused"
"CacheIgnoreCacheControl"
"CacheIgnoreNoLastMod"
"CacheLastModifiedFactor"
"CacheMaxExpire"
"CacheMaxFileSize"
"CacheMinFileSize"
"CacheNegotiatedDocs"
"CacheRoot"
"CacheSize"
"CacheTimeMargin"
"CharsetDefault"
"CharsetOptions"
"CharsetSourceEnc"
"CheckSpelling"
"ChildPerUserID"
"ClearModuleList"
"ContentDigest"
"CookieDomain"
"CookieExpires"
"CookieLog"
"CookieName"
"CookieStyle"
"CookieTracking"
"CoreDumpDirectory"
"CustomLog"
"Dav"
"DavDepthInfinity"
"DavLockDB"
"DavMinTimeout"
"DefaultIcon"
"DefaultLanguage"
"DefaultMode"
"DefaultType"
"DeflateBufferSize"
"DeflateCompressionLevel"
"DeflateFilterNote"
"DeflateMemLevel"
"DeflateWindowSize"
"Deny"
"DirectoryIndex"
"DirectorySlash"
"DocTitle"
"DocTrailer"
"DocumentRoot"
"EnableExceptionHook"
"EnableMMAP"
"EnableSendfile"
"ErrorDocument"
"ErrorLog"
"Example"
"ExpiresActive"
"ExpiresByType"
"ExpiresDefault"
"ExtFilterDefine"
"ExtFilterOptions"
"ExtendedStatus"
"FancyIndexing"
"FileETag"
"ForceLanguagePriority"
"ForceType"
"ForensicLog"
"Group"
"HTMLDir"
"HTTPLogFile"