"Fossies" - the Fresh Open Source Software Archive

Member "emacs-25.3/doc/misc/gnus-news.el" (14 Apr 2017, 4032 Bytes) of package /linux/misc/emacs-25.3.tar.xz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Lisp source code syntax highlighting (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file. See also the last Fossies "Diffs" side-by-side code changes report for "gnus-news.el": 25.1_vs_25.2.

    1 ;;; gnus-news.el --- a hack to create GNUS-NEWS from texinfo source
    2 ;; Copyright (C) 2004-2017 Free Software Foundation, Inc.
    3 
    4 ;; Author: Reiner Steib  <Reiner.Steib@gmx.de>
    5 ;; Keywords: tools
    6 
    7 ;; This file is part of GNU Emacs.
    8 
    9 ;; GNU Emacs is free software: you can redistribute it and/or modify
   10 ;; it under the terms of the GNU General Public License as published by
   11 ;; the Free Software Foundation, either version 3 of the License, or
   12 ;; (at your option) any later version.
   13 
   14 ;; GNU Emacs is distributed in the hope that it will be useful,
   15 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
   16 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   17 ;; GNU General Public License for more details.
   18 
   19 ;; You should have received a copy of the GNU General Public License
   20 ;; along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.
   21 
   22 ;;; Commentary:
   23 
   24 ;;; Code:
   25 
   26 (defvar gnus-news-header-disclaimer
   27 "GNUS NEWS -- history of user-visible changes.
   28 
   29 Copyright (C) 1999-2017 Free Software Foundation, Inc.
   30 See the end of the file for license conditions.
   31 
   32 Please send Gnus bug reports to bugs@gnus.org.
   33 For older news, see Gnus info node \"New Features\".\n\n")
   34 
   35 (defvar gnus-news-trailer
   36 "
   37 * For older news, see Gnus info node \"New Features\".
   38 
   39 ----------------------------------------------------------------------
   40 
   41 This file is part of GNU Emacs.
   42 
   43 GNU Emacs is free software: you can redistribute it and/or modify
   44 it under the terms of the GNU General Public License as published by
   45 the Free Software Foundation, either version 3 of the License, or
   46 \(at your option) any later version.
   47 
   48 GNU Emacs is distributed in the hope that it will be useful,
   49 but WITHOUT ANY WARRANTY; without even the implied warranty of
   50 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   51 GNU General Public License for more details.
   52 
   53 You should have received a copy of the GNU General Public License
   54 along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.
   55 
   56 \nLocal variables:\nmode: outline
   57 paragraph-separate: \"[     ]*$\"\nend:\n")
   58 
   59 (defvar gnus-news-makeinfo-command "makeinfo")
   60 
   61 (defvar gnus-news-fill-column 80)
   62 
   63 (defvar gnus-news-makeinfo-switches
   64   (concat " --no-headers --paragraph-indent=0"
   65       " --no-validate" ;; Allow unresolved references.
   66       " --fill-column=" (number-to-string
   67                  (+ 3 ;; will strip leading spaces later
   68                 (or gnus-news-fill-column 80)))))
   69 
   70 (defun batch-gnus-news ()
   71   "Make GNUS-NEWS in batch mode."
   72   (let (infile outfile)
   73     (setq infile (car command-line-args-left)
   74       command-line-args-left (cdr command-line-args-left)
   75       outfile (car command-line-args-left)
   76       command-line-args-left nil)
   77     (if (and infile outfile)
   78     (message "Creating `%s' from `%s'..." outfile infile)
   79       (error "Not enough files given."))
   80     (gnus-news-translate-file infile outfile)))
   81 
   82 (defun gnus-news-translate-file (infile outfile)
   83   "Translate INFILE (texinfo) to OUTFILE (GNUS-NEWS)."
   84   (let* ((dir (concat (or (getenv "srcdir") ".") "/"))
   85      (infile (concat dir infile))
   86      (buffer (find-file-noselect (concat dir outfile))))
   87     (with-temp-buffer
   88       ;; Could be done using 'texinfmt' stuff as in 'infohack.el'.
   89       (insert
   90        (shell-command-to-string
   91     (concat gnus-news-makeinfo-command " "
   92         gnus-news-makeinfo-switches " " infile)))
   93       (goto-char (point-max))
   94       (delete-char -1)
   95       (goto-char (point-min))
   96       (save-excursion
   97     (while (re-search-forward "^   \\* " nil t)
   98       (replace-match "\f\n* ")))
   99       (save-excursion
  100     (while (re-search-forward "^        \\* " nil t)
  101       (replace-match "** ")))
  102       (save-excursion
  103     (while (re-search-forward "^     " nil t)
  104       (replace-match "")))
  105       ;; Avoid '*' from @ref at beginning of line:
  106       (save-excursion
  107     (while (re-search-forward "^\\*Note" nil t)
  108       (replace-match " \\&")))
  109       (goto-char (point-min))
  110       (insert gnus-news-header-disclaimer)
  111       (goto-char (point-max))
  112       (insert gnus-news-trailer)
  113       (write-region (point-min) (point-max) outfile))))
  114 
  115 ;;; gnus-news.el ends here