1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-12-23 10:34:07 +00:00
emacs/lisp/gnus/score-mode.el
Glenn Morris b27c670b9f Leading "*" in the doc of defvars is long obsolete.
* lisp/plstore.el (plstore-encrypt-to):
* lisp/cedet/semantic/lex-spp.el
(semantic-lex-spp-macro-max-length-to-save):
* lisp/cedet/semantic/symref.el (semantic-symref-tool):
* lisp/cedet/semantic/bovine/el.el
(semantic-elisp-store-documentation-in-tag):
* lisp/cedet/semantic/wisent/comp.el (wisent-verbose-flag)
(wisent-expected-conflicts):
* lisp/cedet/semantic/wisent/wisent.el (wisent-parse-verbose-flag):
* lisp/gnus/gnus-agent.el (gnus-category-menu-hook):
* lisp/gnus/gnus-group.el (gnus-group-listing-limit):
* lisp/gnus/gnus-srvr.el (gnus-server-menu-hook)
(gnus-browse-menu-hook):
* lisp/gnus/message.el (message-shoot-gnksa-feet):
* lisp/gnus/mm-decode.el (mm-path-name-rewrite-functions):
* lisp/gnus/mm-util.el (mm-extra-numeric-entities):
* lisp/gnus/mm-view.el (mm-w3m-standalone-supports-m17n-p):
* lisp/gnus/mml.el (mml-generate-multipart-alist):
* lisp/gnus/nndraft.el (nndraft-required-headers):
* lisp/gnus/nnheader.el (nnheader-max-head-length)
(nnheader-head-chop-length, nnheader-file-name-translation-alist)
(nnheader-directory-separator-character)
(nnheader-pathname-coding-system):
* lisp/gnus/nnmail.el (nnmail-pathname-coding-system)
(nnmail-active-file-coding-system):
* lisp/gnus/nnrss.el (nnrss-file-coding-system):
* lisp/gnus/nntp.el (nntp-record-commands):
* lisp/gnus/score-mode.el (gnus-score-edit-done-hook)
(gnus-score-mode-hook, gnus-score-menu-hook):
* lisp/mail/rfc2047.el (rfc2047-header-encoding-alist)
(rfc2047-allow-irregular-q-encoded-words)
(rfc2047-allow-incomplete-encoded-text):
* lisp/mh-e/mh-alias.el (mh-alias-system-aliases):
* lisp/mh-e/mh-e.el (mh-mail-header-separator, mh-x-mailer-string):
* lisp/mh-e/mh-scan.el (mh-scan-format-mh, mh-scan-format-nmh):
* lisp/net/pop3.el (pop3-password):
* lisp/play/animate.el (animate-n-steps):
* lisp/progmodes/cc-vars.el (c-old-style-variable-behavior):
Convert from defvar with leading * to defcustom.

; * lisp/cedet/semantic/lex.el: Comments.

* lisp/emulation/viper-init.el (viper-heading-end):
* lisp/gnus/mm-url.el (mm-url-html-entities):
* lisp/gnus/nnmaildir.el (nnmaildir-article-file-name):
* lisp/mh-e/mh-e.el (mh-invisible-header-fields-compiled):
* lisp/net/tramp-adb.el (tramp-adb-method): Remove leading * from doc.

* lisp/gnus/messcompat.el: Mark (pointless) file not for compilation.
(message-from-style, message-interactive, message-indentation-spaces)
(message-signature, message-signature-file):
Remove settings that match the defaults.
(message-setup-hook, message-mode-hook, message-default-headers)
(message-send-hook, message-send-mail-function):
Just use setq rather than redefining.

* lisp/gnus/nnrss.el (nnrss):
* lisp/mail/rfc2047.el (rfc2047):
* lisp/play/animate.el (animate): New custom groups.
2016-06-10 00:23:33 -04:00

117 lines
3.6 KiB
EmacsLisp

;;; score-mode.el --- mode for editing Gnus score files
;; Copyright (C) 1996, 2001-2016 Free Software Foundation, Inc.
;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
;; Keywords: news, mail
;; This file is part of GNU Emacs.
;; GNU Emacs 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 3 of the License, or
;; (at your option) any later version.
;; GNU Emacs 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. If not, see <http://www.gnu.org/licenses/>.
;;; Commentary:
;;; Code:
(eval-when-compile (require 'cl))
(require 'mm-util) ; for mm-universal-coding-system
(require 'gnus-util) ; for gnus-pp, gnus-run-mode-hooks
(defcustom gnus-score-edit-done-hook nil
"Hook run at the end of closing the score buffer."
:group 'gnus-score
:type 'hook)
(defcustom gnus-score-mode-hook nil
"Hook run in score mode buffers."
:group 'gnus-score
:type 'hook)
(defcustom gnus-score-menu-hook nil
"Hook run after creating the score mode menu."
:group 'gnus-score
:type 'hook)
(defvar gnus-score-edit-exit-function nil
"Function run on exit from the score buffer.")
(defvar gnus-score-mode-map
(let ((map (make-sparse-keymap)))
(set-keymap-parent map emacs-lisp-mode-map)
(define-key map "\C-c\C-c" 'gnus-score-edit-exit)
(define-key map "\C-c\C-d" 'gnus-score-edit-insert-date)
(define-key map "\C-c\C-p" 'gnus-score-pretty-print)
map))
(defvar score-mode-syntax-table
(let ((table (copy-syntax-table lisp-mode-syntax-table)))
(modify-syntax-entry ?| "w" table)
table)
"Syntax table used in score-mode buffers.")
;; We need this to cope with non-ASCII scoring.
(defvar score-mode-coding-system mm-universal-coding-system)
;;;###autoload
(define-derived-mode gnus-score-mode emacs-lisp-mode "Score"
"Mode for editing Gnus score files.
This mode is an extended emacs-lisp mode.
\\{gnus-score-mode-map}"
(gnus-score-make-menu-bar)
(make-local-variable 'gnus-score-edit-exit-function))
(defun gnus-score-make-menu-bar ()
(unless (boundp 'gnus-score-menu)
(easy-menu-define
gnus-score-menu gnus-score-mode-map ""
'("Score"
["Exit" gnus-score-edit-exit t]
["Insert date" gnus-score-edit-insert-date t]
["Format" gnus-score-pretty-print t]))
(run-hooks 'gnus-score-menu-hook)))
(defun gnus-score-edit-insert-date ()
"Insert date in numerical format."
(interactive)
(princ (time-to-days (current-time)) (current-buffer)))
(defun gnus-score-pretty-print ()
"Format the current score file."
(interactive)
(goto-char (point-min))
(let ((form (read (current-buffer))))
(erase-buffer)
(let ((emacs-lisp-mode-syntax-table score-mode-syntax-table))
(gnus-pp form)))
(goto-char (point-min)))
(defun gnus-score-edit-exit ()
"Stop editing the score file."
(interactive)
(unless (file-exists-p (file-name-directory (buffer-file-name)))
(make-directory (file-name-directory (buffer-file-name)) t))
(let ((coding-system-for-write score-mode-coding-system))
(save-buffer))
(bury-buffer (current-buffer))
(let ((buf (current-buffer)))
(when gnus-score-edit-exit-function
(funcall gnus-score-edit-exit-function))
(when (eq buf (current-buffer))
(switch-to-buffer (other-buffer (current-buffer))))))
(provide 'score-mode)
;;; score-mode.el ends here