From 19853445e669052da5ae27ef784fdac4ce0eefbe Mon Sep 17 00:00:00 2001 From: Jonas Bernoulli Date: Sun, 14 Oct 2018 15:53:36 +0200 Subject: fix indentation and remove excessive whitespace --- apt-sources.el | 128 ++++++++++++++++++++++----------------------------------- apt-utils.el | 46 ++++++++++----------- deb-view.el | 4 +- debian-bug.el | 42 +++++++++---------- debian-el.el | 26 ++++++------ preseed.el | 8 +++- 6 files changed, 116 insertions(+), 138 deletions(-) diff --git a/apt-sources.el b/apt-sources.el index e6458f2..bb36e40 100644 --- a/apt-sources.el +++ b/apt-sources.el @@ -12,18 +12,18 @@ ;; Copyright (C) 2001-2003, Dr. Rafael Sepúlveda ;; Copyright (C) 2009 Peter S. Galbraith -;; 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. +;; 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. -;; 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. +;; 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. +;; 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. ;;; Commentary: @@ -180,7 +180,6 @@ inserted." "\\([^ ]+\\)" "A regexp that matches the distribution name part of the source line.") - (defvar apt-sources-font-lock-keywords (list ;; Comments @@ -254,8 +253,6 @@ inserted." (define-key map [menu-bar apt-sources new-source] '("Add new source" . apt-sources-new-source)))) - - ;;;###autoload (defun apt-sources-mode () "Major mode for editing apt's sources.list file. @@ -263,23 +260,17 @@ Sets up command `font-lock-mode'. \\{apt-sources-mode-map}" (interactive) - ;; (kill-all-local-variables) (setq mode-name "apt-sources") (setq major-mode 'apt-sources-mode) (use-local-map apt-sources-mode-map) - ;; (set (make-local-variable 'comment-start) "#") (set (make-local-variable 'comment-start-skip) "#+ *") (set-syntax-table apt-sources-mode-syntax-table) - ;; (make-local-variable 'font-lock-defaults) (setq font-lock-defaults '(apt-sources-font-lock-keywords)) - ;; (run-hooks 'apt-sources-mode-hook)) - - (defun apt-sources-new-source (name) "Insert interactively a new source line into the current buffer. This will insert a new source in the current line. @@ -290,20 +281,19 @@ NAME is the name you want to this source line; it will be a comment. You should read sources.list documentation for further explanation of the format." (interactive "*sName of new source: ") - (let ((source-type (completing-read "Source type: " '(("deb" 1) ("deb-src" 2)) nil t)) (uri-type (completing-read "URI type: " ;type used to retrieve the URI, like http, ftp, etc. - '(("cdrom:/" 1) - ("copy://" 2) - ("file://" 3) - ("ftp://" 4) - ("http://" 5) - ("https://" 6) - ("rsh://" 7) - ("ssh://" 8)) nil t)) + '(("cdrom:/" 1) + ("copy://" 2) + ("file://" 3) + ("ftp://" 4) + ("http://" 5) + ("https://" 6) + ("rsh://" 7) + ("ssh://" 8)) nil t)) (uri-address (read-from-minibuffer "URI address: ")) ;URI that will be used to specify the base - ;of the Debian distribution, from which APT - ;will find the information it needs. + ;of the Debian distribution, from which APT + ;will find the information it needs. (distribution (completing-read "Distribution: " ;specific arquitecture or an exact path. '(("unstable" 1) ("testing" 2) @@ -321,21 +311,19 @@ of the format." ("contrib non-free") ("non-free")))) (blank-line (if apt-sources-around-lines "\n" ""))) - (save-excursion (beginning-of-line) - (insert blank-line) ;insert line if `apt-sources-around-lines' + (insert blank-line) ; insert line if `apt-sources-around-lines' (and (< 0 (length name)) (insert (format apt-sources-source-name name))) - (insert ;insert rest of arguments except components + (insert ; insert rest of arguments except components (format "%s %s%s %s" source-type uri-type uri-address distribution)) - ;if `distribution' ends in '/', then don't process components. + ;; if `distribution' ends in '/', then don't process components. (if (string-match "/$" distribution) distribution (insert " " components) - (insert blank-line))))) ;insert line if `apt-sources-around-lines' - + (insert blank-line))))) ; insert line if `apt-sources-around-lines' (defun apt-sources-around-lines () "Toggle insertion of newlines around a future creation of source lines. @@ -345,7 +333,6 @@ This modifies the state of variable `apt-sources-around-lines'." (message "Surrounding blank lines %s" (if apt-sources-around-lines "On" "Off"))) - (defun apt-sources-insert-local-vars () "Insert the current values of buffer local variables." (interactive) @@ -357,7 +344,6 @@ This modifies the state of variable `apt-sources-around-lines'." comment-start " mode: " (format "%s\n" (or mode-name "apt-sources")) comment-start " End:\n")) - (defun apt-sources-next-source-line (arg) "Go to the next source line. @@ -372,14 +358,12 @@ ARG is the prefix argument." '("^\\(deb \\|deb-src \\)" nil)) (beginning-of-line)))) - (defun apt-sources-previous-source-line () "Go to the previous source line." (interactive) (apt-sources-next-source-line -1)) - -;;Modifying functions +;; Modifying functions (defun apt-sources-source-line-p () "Return t if we are in an apt source line." (save-excursion @@ -389,45 +373,42 @@ ARG is the prefix argument." (message "Not in a source line!") nil))) ;return nil if we aren't in an apt source line - (defun apt-sources-change-source-type () "Change the type of the source line. TYPE is either 'd' or 's' to change the type to 'deb' or 'deb-src'. This function will rise an error if we are not in a source line." (interactive) - (and (apt-sources-source-line-p) - ;type used to retrieve the URI, like http, ftp, etc. - (let ((new-type (completing-read "'deb' or 'deb-src': " '(("deb" 1) ("deb-src" 2)) nil t))) - (save-excursion - (beginning-of-line) - (delete-region (point) (re-search-forward "^deb[^ ]*" (line-end-position) nil 1)) - (insert new-type))))) - + (and (apt-sources-source-line-p) + ;; type used to retrieve the URI, like http, ftp, etc. + (let ((new-type (completing-read "'deb' or 'deb-src': " '(("deb" 1) ("deb-src" 2)) nil t))) + (save-excursion + (beginning-of-line) + (delete-region (point) (re-search-forward "^deb[^ ]*" (line-end-position) nil 1)) + (insert new-type))))) (defun apt-sources-change-uri-type () "Change the URI type of the source line. This function will rise an error if we are not in a source line." (interactive) - (and (apt-sources-source-line-p) - (let ((uri-type (completing-read "URI type: " ;type used to retrieve the URI, like http, ftp, etc. - '(("cdrom:/" 1) - ("copy://" 2) - ("file://" 3) - ("ftp://" 4) - ("http://" 5) - ("https://" 6) - ("rsh://" 7) - ("ssh://" 8)) nil t))) + ;; type used to retrieve the URI, like http, ftp, etc. + (let ((uri-type (completing-read "URI type: " + '(("cdrom:/" 1) + ("copy://" 2) + ("file://" 3) + ("ftp://" 4) + ("http://" 5) + ("https://" 6) + ("rsh://" 7) + ("ssh://" 8)) nil t))) (save-excursion (beginning-of-line) (delete-region (re-search-forward "^deb[^ ]*." (line-end-position) nil 1) (re-search-forward ":/*" (line-end-position) nil 1)) (insert uri-type))))) - (defun apt-sources-change-uri-address (uri-address) "Change the URI address of the source line. String URI-ADDRESS is the address (without the type of address, @@ -435,21 +416,18 @@ ex: 'http://'). This function will rise an error if we are not in a source line." (interactive "sURI address: ") - - (and (apt-sources-source-line-p) - (save-excursion - (beginning-of-line) - (delete-region (re-search-forward ":/*" (line-end-position) nil 1) - (re-search-forward "[^ ]*" (line-end-position) nil 1)) - (insert uri-address)))) - + (and (apt-sources-source-line-p) + (save-excursion + (beginning-of-line) + (delete-region (re-search-forward ":/*" (line-end-position) nil 1) + (re-search-forward "[^ ]*" (line-end-position) nil 1)) + (insert uri-address)))) (defun apt-sources-change-distribution () "Change the distribution of the source line. This function will rise an error if we are not in a source line." (interactive) - (and (apt-sources-source-line-p) (let ((distribution (completing-read "Distribution: " ;specific arquitecture or an exact path. '(("unstable" 1) @@ -466,13 +444,11 @@ This function will rise an error if we are not in a source line." (re-search-forward "[^ ]*" (line-end-position) t 1)) (insert distribution))))) - (defun apt-sources-change-components () "Change the components of the source line. This function will rise an error if we are not in a source line." (interactive) - (and (apt-sources-source-line-p) (let ((components (completing-read "Components: " ;list of componenst used by APT. '(("main") @@ -490,18 +466,15 @@ This function will rise an error if we are not in a source line." (looking-at "[^ ]")) (insert " ")) (insert components))))) - - (defun apt-sources-deb-or-src-replicate () "Copy the source line and change the 'deb' to 'deb-src' or viceversa. This function will rise an error if we are not on a source line." (interactive) - (and (apt-sources-source-line-p) (let ((copy (buffer-substring (line-beginning-position) - (line-end-position)))) + (line-end-position)))) (save-excursion (end-of-line) (insert (concat "\n" copy)) @@ -514,11 +487,10 @@ This function will rise an error if we are not on a source line." (re-search-forward "^deb[^ ]*" (line-end-position) t 1)) (insert "deb")))))) - - (run-hooks 'apt-sources-load-hook) (add-to-list 'auto-mode-alist '("sources\\.list\\'" . apt-sources-mode)) (add-to-list 'auto-mode-alist '("sources\\.list\\.d/.*\\.list\\'" . apt-sources-mode)) + (provide 'apt-sources) ;;; apt-sources.el ends here diff --git a/apt-utils.el b/apt-utils.el index 297fef4..e9df31a 100644 --- a/apt-utils.el +++ b/apt-utils.el @@ -1,6 +1,6 @@ ;;; apt-utils.el --- Emacs interface to APT (Debian package management) -;;; Copyright (C) 2002-2010 Matthew P. Hodges +;; Copyright (C) 2002-2010 Matthew P. Hodges ;; Author: Matthew P. Hodges ;; $Id: apt-utils.el,v 1.23 2016/11/05 22:18:48 psg Exp $ @@ -753,8 +753,8 @@ See also `apt-utils-toggle-package-info'." (let* ((package (caar apt-utils-package-history)) (file (apt-utils-changelog-file package))) (if file - (apt-utils-view-file file) - (message "No ChangeLog file found for %s." package)))))) + (apt-utils-view-file file) + (message "No ChangeLog file found for %s." package)))))) (defun apt-utils-changelog-file (&optional package) "Find ChangeLog file for PACKAGE or the current package." @@ -764,7 +764,7 @@ See also `apt-utils-toggle-package-info'." (format "/usr/share/doc/%s/" package) '("CHANGELOG" "ChangeLog" "Changelog" "changelog") '("" ".gz")))) - file)) + file)) ;; Find Debian ChangeLog files @@ -791,7 +791,7 @@ See also `apt-utils-toggle-package-info'." (format "/usr/share/doc/%s/" package) '("changelog.Debian") '(".gz")))) - file)) + file)) ;; Find NEWS files @@ -1181,7 +1181,7 @@ ARG may be negative to move backward." (not (eq (cdar apt-utils-package-history) 'search-file-names))) (goto-char (point-min)) (goto-char (next-single-property-change (point) - 'apt-package))) + 'apt-package))) (t (let ((old (apt-utils-package-at))) ;; Forward. @@ -1436,8 +1436,8 @@ indicated in `mode-name'." ;; Add text properties (add-text-properties (point) (+ (point) length-no-version) `(,apt-utils-face-property ,face - mouse-face highlight - apt-package ,package)) + mouse-face highlight + apt-package ,package)) ;; Version? (when (> length length-no-version) (add-text-properties (+ (point) length-no-version 1) @@ -1513,9 +1513,9 @@ indicated in `mode-name'." (apt-utils-current-links-add-package link) (add-text-properties (match-beginning 1) (match-end 1) `(,apt-utils-face-property ,face - mouse-face highlight - apt-package ,link))) - (forward-line)))) + mouse-face highlight + apt-package ,link))) + (forward-line)))) (setq keywords (cdr keywords)))) (when (and apt-utils-display-installed-status (memq (apt-utils-package-type package t) @@ -1567,8 +1567,8 @@ The type of search is specified by TYPE." (apt-utils-current-links-add-package link) (add-text-properties (match-beginning 1) (match-end 1) `(,apt-utils-face-property ,face - mouse-face highlight - apt-package ,link)) + mouse-face highlight + apt-package ,link)) ;; Multiple fields separated by commas (when (eq type 'search-file-names) (if (eq (char-before) ?\:) @@ -1697,11 +1697,11 @@ TYPE can be forward, backward, or toggle." ;; Make the key unique; we could visit the same package more ;; than once (apt-utils-puthash (format "%s/%s/%d" - (caar apt-utils-package-history) - (cdar apt-utils-package-history) - (length apt-utils-package-history)) - (list (point) (window-start (selected-window))) - apt-utils-buffer-positions)) + (caar apt-utils-package-history) + (cdar apt-utils-package-history) + (length apt-utils-package-history)) + (list (point) (window-start (selected-window))) + apt-utils-buffer-positions)) ((eq type 'backward) ;; Remove old values (remhash (format "%s/normal/%d" @@ -1735,11 +1735,11 @@ TYPE can be forward, backward, or toggle." new 'normal)) ;; Set position for old entry (apt-utils-puthash (format "%s/%s/%d" - package - old - (length apt-utils-package-history)) - (list (point) (window-start (selected-window))) - apt-utils-buffer-positions) + package + old + (length apt-utils-package-history)) + (list (point) (window-start (selected-window))) + apt-utils-buffer-positions) ;; Get position for new entry (setq posns (gethash (format "%s/%s/%d" diff --git a/deb-view.el b/deb-view.el index 6223258..7dad836 100644 --- a/deb-view.el +++ b/deb-view.el @@ -273,7 +273,7 @@ See also the variable deb-find-directory." (define-key debview-mode-map "u" 'undefined) (define-key debview-mode-map "x" 'undefined) (define-key debview-mode-map "" 'undefined) - + (define-key debview-mode-map "?" 'deb-view-help) (define-key debview-mode-map "q" 'deb-view-dired-view-cleanup) (define-key debview-mode-map "N" 'deb-view-tar-man) @@ -498,7 +498,7 @@ easily repeat a `deb-find' command." (interactive) (require 'compile) (let* ((deb-file-string (read-from-minibuffer "deb file to find: " - nil nil nil 'deb-find-history)) + nil nil nil 'deb-find-history)) (output-buffer-name "*deb-find*") (command (cond ((string-equal deb-find-method "locate") (concat "locate '" deb-file-string diff --git a/debian-bug.el b/debian-bug.el index b856b65..45979eb 100644 --- a/debian-bug.el +++ b/debian-bug.el @@ -484,7 +484,7 @@ Will only actually do it if the variable `debian-bug-From-address' is set." (defcustom debian-bug-menu-action-default 'browse "Default action enabled at startup in Bugs menu-bar." :group 'debian-bug -;; :set 'debian-bug-menu-action-set + ;; :set 'debian-bug-menu-action-set :set (lambda (symbol value) (set-default symbol value) (setq-default debian-bug-menu-action debian-bug-menu-action-default) @@ -542,7 +542,7 @@ when the shell commands \"bug\" and \"reportbug\" are not available") (defvar debian-bug-tags-alist '(("patch") ("security") ("upstream")) -;;'(("patch") ("security") ("upstream") ("potato") ("woody") ("sarge") ("sid")) + ;;'(("patch") ("security") ("upstream") ("potato") ("woody") ("sarge") ("sid")) "Alist of valid Tags aimed at Debian users. The complete list of valid tags is longer, but the others are for use by Debian maintainers.") @@ -557,12 +557,12 @@ Debian maintainers.") (defvar debian-bug-pseudo-packages '("base" "bugs.debian.org" "buildd.debian.org" "buildd.emdebian.org" - "cdimage.debian.org" "cdrom" "debian-i18n" "debian-maintainers" - "ftp.debian.org" "general" "installation-reports" "lists.debian.org" - "mirrors" "nm.debian.org" "press" "project" "qa.debian.org" "release-notes" - "release.debian.org" "security-tracker" "security.debian.org" - "snapshot.debian.org" "tech-ctte" "upgrade-reports" "wiki.debian.org" - "wnpp" "www.debian.org") + "cdimage.debian.org" "cdrom" "debian-i18n" "debian-maintainers" + "ftp.debian.org" "general" "installation-reports" "lists.debian.org" + "mirrors" "nm.debian.org" "press" "project" "qa.debian.org" "release-notes" + "release.debian.org" "security-tracker" "security.debian.org" + "snapshot.debian.org" "tech-ctte" "upgrade-reports" "wiki.debian.org" + "wnpp" "www.debian.org") "List of Debian pseudo-packages available for completion. See http://www.debian.org/Bugs/pseudo-packages") @@ -799,8 +799,8 @@ If such script exists, otherwise nil is returned." ((debian-bug-file-is-executable script-alt2) script-alt2)))) (defun debian-bug-script-sentinel - (process event package severity subject filename - bug-script-temp-file win-config) + (process event package severity subject filename + bug-script-temp-file win-config) "This function is the process sentinel for bug script processes. When called, if the process has terminated, this function cleans up the buffer used by the process and proceeds to the next step in the @@ -993,7 +993,7 @@ reporting process by calling `debian-bug-compose-report'." (debian-bug-run-bug-script package severity subject filename)))) (defun debian-bug-compose-report - (package severity subject filename &optional bug-script-temp-file) + (package severity subject filename &optional bug-script-temp-file) "Compose the initial contents of the bug report and present it in a buffer. The buffer will be completed by the user." ;;; (require 'reporter) @@ -1643,9 +1643,9 @@ Aug 10th 2001 ["To BTS and Maintainer Only" (debian-bug--set-bts-address (debian-bug-bts-mail "maintonly" debian-bug-bts-address)) - :style radio - :selected (debian-bug--is-bts-address - (debian-bug-bts-mail "maintonly" debian-bug-bts-address))] + :style radio + :selected (debian-bug--is-bts-address + (debian-bug-bts-mail "maintonly" debian-bug-bts-address))] ["To BTS Only" (debian-bug--set-bts-address (debian-bug-bts-mail "quiet" debian-bug-bts-address)) @@ -1863,7 +1863,7 @@ With optional argument prefix ARCHIVED, display archived bugs." (error "This function requires the browse-url elisp package")))) (if (or (not bug-number) (string-equal bug-number "none")) (setq bug-number (completing-read "Bug number to lookup: " - debian-bug-alist nil nil))) + debian-bug-alist nil nil))) (if (string-equal bug-number "") (message "No bug number to look up") (browse-url (concat debian-bug-bts-URL "archive=yes&bug=" bug-number)) @@ -1907,11 +1907,11 @@ In a program, mouse location is in EVENT." (if (string-equal "" pkg-name) (message "No package name to look up") (browse-url (concat "http://packages.debian.org/" pkg-name)) -;; 2007-09-02 This URL is becoming obsolete... -;; (concat -;; "http://packages.debian.org/cgi-bin/search_packages.pl?keywords=" -;; pkg-name -;; "&searchon=names&version=all&release=all") + ;; 2007-09-02 This URL is becoming obsolete... + ;; (concat + ;; "http://packages.debian.org/cgi-bin/search_packages.pl?keywords=" + ;; pkg-name + ;; "&searchon=names&version=all&release=all") (message "Looking up web pages for package %s via browse-url" pkg-name)))) (defvar debian-bug-archive-alist @@ -2184,7 +2184,7 @@ Optionally, if SOURCE is t, make it a source package." "\\(\\(.+\\)\\)\\|\\(\\([^#].+\\)\\)" nil t) (let ((type (match-string 2)) - ;;(URL (match-string 4)) + ;;(URL (match-string 4)) (bugnumber (match-string 5)) (description (match-string 6)) (shortdescription (match-string 6))) diff --git a/debian-el.el b/debian-el.el index a70f02d..11b0f38 100644 --- a/debian-el.el +++ b/debian-el.el @@ -28,9 +28,9 @@ :prefix "apt-sources-" :link '(custom-manual "(debian-el)apt-sources") :load 'apt-sources -;;:require 'apt-sources + ;;:require 'apt-sources :group 'debian-el) - + ;; apt-utils (defgroup apt-utils nil "Emacs interface to APT (Debian package management)" @@ -38,7 +38,7 @@ :link '(url-link "http://www.tc.bham.ac.uk/~matt/AptUtilsEl.html") :link '(custom-manual "(debian-el)apt-utils") :load 'apt-utils -;;:require 'apt-utils + ;;:require 'apt-utils :group 'debian-el) ;; debian-bug.el @@ -47,7 +47,7 @@ :prefix "debian-bug-" :link '(custom-manual "(debian-el)debian-bug") :load 'debian-bug -;;:require 'debian-bug + ;;:require 'debian-bug :group 'debian-el) ;; deb-view.el @@ -69,7 +69,7 @@ ;; The following from Kevin Ryde ;; Closes: #484027 (defun deb-view-control-coding (arg-list) - "Return coding system for the \"control\" file in a deb. + "Return coding system for the \"control\" file in a deb. This function is for use from `file-coding-system-alist'. ARG-LIST is arguments passed to `find-operation-coding-system'. @@ -86,14 +86,14 @@ tell if it's from a deb. Note: This only works in emacs22, in emacs21 or xemacs21 tar-mode does something a bit different and doesn't reach here (and there's no buffer passed to coding system functions)." - (if (and (eq (car arg-list) 'insert-file-contents) ;; first arg - (consp (cadr arg-list)) ;; second arg like ("./control" . BUFFER) - (let ((buffer (cdr (cadr arg-list)))) - (and (buffer-file-name buffer) - (string-match "\\.deb-INFO!\\./control\\'" - (buffer-file-name buffer)) - 'utf-8))) - 'undecided)) + (if (and (eq (car arg-list) 'insert-file-contents) ;; first arg + (consp (cadr arg-list)) ;; second arg like ("./control" . BUFFER) + (let ((buffer (cdr (cadr arg-list)))) + (and (buffer-file-name buffer) + (string-match "\\.deb-INFO!\\./control\\'" + (buffer-file-name buffer)) + 'utf-8))) + 'undecided)) (add-to-list 'file-coding-system-alist '("\\'control\\'" . deb-view-control-coding))) diff --git a/preseed.el b/preseed.el index d555129..3d0ccbd 100644 --- a/preseed.el +++ b/preseed.el @@ -1,4 +1,4 @@ -;;; preseed.el --- a major mode for editing debian-installer preseed files +;;; preseed.el --- a major-mode for editing debian-installer preseed files ;; Copyright (C) 2004 W. Borgert @@ -12,7 +12,13 @@ ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;; GNU General Public License for more details. +;;; Commentary: + +;; This library defines a major-mode for editing debian-installer +;; preseed files. + ;;; Code: + (require 'font-lock) (defvar preseed-mode-abbrev-table nil -- cgit v1.2.3