branch: externals/muse commit 8710adde8fef5fb570e23383900f5cfa1d39060c Author: Stefan Monnier <monn...@iro.umontreal.ca> Commit: Stefan Monnier <monn...@iro.umontreal.ca>
Fix compilation and address some warnings Replace remaining uses of `cl` with `cl-lib`. Activate `lexical-binding` in the files we touch. Adjust code accordingly (especially uses of `add-to-list` applied to local variables). Sync README with the one from github. Adjust to the move to `lisp` subdirectory. --- .gitignore | 1 + README | 258 ++++++++++++++++++++++++++++++++++++++++++-- contrib/cgi.el | 41 ++++--- contrib/htmlize-hack.el | 10 +- contrib/httpd.el | 14 +-- examples/johnw/muse-init.el | 6 +- experimental/muse-split.el | 158 +++++++++++++-------------- lisp/muse-backlink.el | 40 +++---- lisp/muse-docbook.el | 34 +++--- lisp/muse-http.el | 9 +- lisp/muse-ipc.el | 12 +-- lisp/muse-mode.el | 5 +- lisp/muse.el | 9 +- 13 files changed, 410 insertions(+), 187 deletions(-) diff --git a/.gitignore b/.gitignore index 8ff6642769..70c943e954 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,7 @@ *~ /muse-autoloads.el +/lisp/muse-autoloads.el /muse-pkg.el /++xgit-log-edit *.elc diff --git a/README b/README index 5f6e20e9f4..8386278b6b 100644 --- a/README +++ b/README @@ -1,7 +1,253 @@ -Muse is a tool for easily authoring and publishing documents. It -allows for rapid prototyping of hyperlinked text, which may then be -exported to multiple output formats, such as HTML, LaTeX, and Texinfo. + -*- Text -*- +This is the README file for Emacs Muse. -The markup rules used by Muse are intended to be very friendly to -people familiar with Emacs. See the included manual for more -information. +The terms "Emacs Muse", "Emacs-Muse", and "Muse" are used +interchangeably throughout this document to refer to this software. + +Synopsis +======== + +Emacs Muse is an authoring and publishing environment for Emacs. It +simplifies the process of writings documents and publishing them to +various output formats. + +Emacs Muse consists of two main parts: an enhanced text-mode for +authoring documents and navigating within Muse projects, and a set of +publishing styles for generating different kinds of output. + +Directory contents +================== + +The directory structure is as follows. + +etc :: Miscellaneous files like the emacs-wiki migration guide, the + list of ideas for the future, and a RelaxNG schema for Muse XML. + +contrib :: Files that are not a part of Muse proper, but are useful + enough to be bundled with Muse. + +examples :: Example configuration files for use with Muse, a + publishable quickstart guide, and miscellaneous helper stuff. + +experimental :: Source code that is not yet considered stable. + +lisp :: Muse source code. + +scripts :: Scripts that are used when compiling Muse and publishing + the QuickStart document; they might prove useful if you want to + automate the building of Muse documents. + +texi :: The manual (muse.texi) and any supplemental sections. + +Getting started +=============== + +Prerequisites +------------- + +You need either Emacs (21.1 or greater), XEmacs (21.4 or greater), or +SXEmacs (warning: Muse has not been tested with SXEmacs). The current +maintainer recommends using Emacs. + +Compilation +----------- + +This is an optional step, since Emacs Lisp source code does not +necessarily have to be byte-compiled. It may yield a slight speed +increase, however. + +A working copy of Emacs or XEmacs is needed in order to compile the +Emacs Muse. By default, the program that is installed with the name +`emacs' will be used. + +If you want to use the `xemacs' binary to perform the compilation, you +must copy `Makefile.defs.default' to `Makefile.defs' in the top-level +directory, and then edit `Makefile.defs' as follows. You can put +either a full path to an Emacs or XEmacs binary or just the command +name, as long as it is in the PATH. + +EMACS = xemacs +SITEFLAG = -no-site-file +# Edit the section as necessary +install_info = install-info --section "XEmacs 21.4" $(1).info \ + $(INFODIR)/dir || : + +Running `make' in the top-level directory should compile the Muse +source files in the `lisp' directory, and generate an autoloads +file in `lisp/muse-autoloads.el'. + +Installation +------------ + +Muse may be installed into your file hierarchy by doing the following. + +Copy `Makefile.defs.default' to `Makefile.defs' in the top-level +directory, if you haven't done so already. Then edit the +`Makefile.defs' file so that ELISPDIR points to where you want the +source and compiled Muse files to be installed and INFODIR indicates +where to put the Muse manual. You may use a combination of DESTDIR +and PREFIX to further determine where the installed files should be +placed. As mentioned earlier, you will want to edit EMACS and +SITEFLAG as shown in the Compilation section if you are using XEmacs. + +If you are installing Muse on a Debian or Ubuntu system, you might +want to change the value of INSTALLINFO as specified in +`Makefile.defs'. + +If you wish to install Muse to different locations than the defaults +specify, edit `Makefile.defs' accordingly. + +Run `make' as a normal user, if you haven't done so already. + +Run `make install' as the root user if you have chosen installation +locations that require this. + +Insinuation +----------- + +Two things need to happen in order for Muse to be usable with your +version of Emacs or XEmacs. + + 1. The location of the Muse directory needs to be added to the load + path so that your variant of Emacs can find it. + + 2. You need to load whichever Muse files you wish to make use of. + +A quick example that accomplishes both of these follows. + +;; Add this to your .emacs or .xemacs/init.el file. +(setq load-path (add-to-list 'load-path "/path/to/muse")) +(require 'muse-mode) +(require 'muse-publish) +(require 'muse-html) ;; and so on + +Documentation +------------- + +The Muse manual may be generated by running `make doc'. + +It will produce two files: an Info file called `muse.info' and an HTML +document called `muse.html'. Both of these will be created in the +`texi' directory. + +This manual is also available online in several forms. + + - PDF: http://mwolson.org/static/doc/muse.pdf + - HTML (single file): http://mwolson.org/static/doc/muse.html + - HTML (multiple files): http://mwolson.org/static/doc/muse/ + +QuickStart +---------- + +Type "make examples" to generate a quickstart guide for Muse. An HTML +document called QuickStart.html, an Info document called +QuickStart.info, and a PDF file called QuickStart.pdf will be created +in the `examples' directory. + +If you do not have a working LaTeX installation with the proper fonts, +the PDF file will not be successfully generated. + +To see the document that is interpreted in order to generate these +files, take a look at `examples/QuickStart.muse'. + +To view the generated Info document from within Emacs, try the +following. + +C-u M-x info RET /path/to/muse/examples/QuickStart.info RET + +Further Documentation +===================== + +Please consult http://www.emacswiki.org/cgi-bin/wiki/EmacsMuse to find +more information on bugs, unimplemented features, and user-contributed +tweaks. + +The current maintainer's webpage for Muse is at +http://mwolson.org/projects/EmacsMuse.html. + +If you wish to participate in the development of Muse, or track the +latest development changes, please read the `Development' section of +the Muse manual (in the `Obtaining Muse' chapter) for instructions. + +Mailing Lists +============= + +Mailing lists for Muse exist. + +muse-el-announce :: + Low-traffic list for Muse-related announcements. + + You can join this mailing list (muse-el-annou...@gna.org) + using the subscription form at + http://mail.gna.org/listinfo/muse-el-announce/. + + This mailing list is also available via Gmane (http://gmane.org/). + The group is called + gmane.emacs.muse.announce. + +muse-el-discuss :: + Discussion, bugfixes, suggestions, tips, and the like for Muse. + This mailing list also includes the content of muse-el-announce. + + You can join this mailing list (muse-el-disc...@gna.org) + using the subscription form at + http://mail.gna.org/listinfo/muse-el-discuss/. + + This mailing list is also available via Gmane with the identifier + gmane.emacs.muse.general. + +muse-el-logs :: + Log messages for commits made to Muse. + + You can join this mailing list (muse-el-l...@gna.org) using + the subscription form at + http://mail.gna.org/listinfo/muse-el-logs/. + + This mailing list is also available via Gmane with the identifier + gmane.emacs.muse.scm. + +muse-el-commits :: + Generated bug reports for Emacs Muse. If you use our bug-tracker at + https://gna.org/bugs/?group=muse-el, the bug reports will be sent to + this list automatically. + + You can join this mailing list (muse-el-comm...@gna.org) using + the subscription form at + http://mail.gna.org/listinfo/muse-el-commits/. + + This mailing list is also available via Gmane with the identifier + gmane.emacs.muse.cvs. + +License +======= + +Emacs Muse 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, or (at your option) any +later version. + +Emacs Muse 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 Emacs Muse; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +Boston, MA 02110-1301, USA. + +The Muse manual is available under the terms of the GNU Free +Documentation License, Version 1.2 or any later version published by +the Free Software Foundation; with no Invariant Sections, and with the +Front-Cover texts and Back-Cover Texts as specified in the manual. A +copy of the license is included in the section entitled "GNU Free +Documentation License" in the Muse manual. All Emacs Lisp code +contained in the manual may be used, distributed, and modified without +restriction. + +The PNG images included in the examples/ directory may be used, +distributed, and modified without restriction. + +The contents of the contrib/blosxom and contrib/pyblosxom directories +are available under the terms of other licenses. Please consult the +header of each file for the appropriate license text. diff --git a/contrib/cgi.el b/contrib/cgi.el index 0e85a52e7f..1b5d706624 100644 --- a/contrib/cgi.el +++ b/contrib/cgi.el @@ -1,6 +1,6 @@ -;;; cgi.el -- Using Emacs for CGI scripting +;;; cgi.el -- Using Emacs for CGI scripting -*- lexical-binding: t; -*- -;; Copyright (C) 2000, 2006, 2012, 2014 Free Software Foundation, Inc. +;; Copyright (C) 2000-2024 Free Software Foundation, Inc. ;; Author: Eric Marsden <emars...@laas.fr> ;; Michael Olson <mwol...@gnu.org> (slight modifications) @@ -22,9 +22,10 @@ ;; 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: - +;; ;; People who like this sort of thing will find this the sort of ;; thing they like. -- Abraham Lincoln ;; @@ -68,7 +69,7 @@ ;;; Code: (eval-when-compile - (require 'cl) + (require 'cl-lib) (require 'calendar)) (defconst cgi-url-unreserved-chars '( @@ -90,23 +91,23 @@ ;; decode %xx to the corresponding character and + to ' ' (defun cgi-decode-string (str) - (do ((i 0) - (len (length str)) - (decoded '())) + (cl-do ((i 0) + (len (length str)) + (decoded '())) ((>= i len) (concat (nreverse decoded))) (let ((ch (aref str i))) (cond ((eq ?+ ch) (push ?\ decoded) - (incf i)) + (cl-incf i)) ((and (eq ?% ch) (< (+ i 2) len) (cgi-hex-char-p (aref str (+ i 1))) (cgi-hex-char-p (aref str (+ i 2)))) (let ((hex (string-to-number (substring str (+ i 1) (+ i 3)) 16))) (push (cgi-int-char hex) decoded) - (incf i 3))) + (cl-incf i 3))) (t (push ch decoded) - (incf i)))))) + (cl-incf i)))))) (defun cgi-position (item seq &optional start end) (or start (setq start 0)) @@ -158,8 +159,8 @@ (setq buf (get-buffer-create " *cgi*")) (set-buffer buf) (erase-buffer) - (loop for i from 1 to (string-to-number req) - do (insert (read-event))) + (cl-loop for i from 1 to (string-to-number req) + do (insert (read-event))) (cgi-decode (buffer-string))) (t (cgi-lose "Can't handle request method %s" method))))) @@ -178,18 +179,16 @@ ;; your web server's error_log. ;; ==================================================================== -(eval-and-compile +(defalias 'cgi-calendar-extract-month (if (fboundp 'calendar-extract-month) - (defalias 'cgi-calendar-extract-month 'calendar-extract-month) - (defalias 'cgi-calendar-extract-month 'extract-calendar-month)) + #'calendar-extract-month 'extract-calendar-month)) +(defalias 'cgi-calendar-extract-year (if (fboundp 'calendar-extract-year) - (defalias 'cgi-calendar-extract-year 'calendar-extract-year) - (defalias 'cgi-calendar-extract-year 'extract-calendar-year)) + #'calendar-extract-year 'extract-calendar-year)) - (if (fboundp 'calendar-generate) - (defalias 'cgi-calendar-generate 'calendar-generate) - (defalias 'cgi-calendar-generate 'generate-calendar))) +(defalias 'cgi-calendar-generate + (if (fboundp 'calendar-generate) #'calendar-generate #'generate-calendar)) (defun cgi-calendar-string () (require 'calendar) diff --git a/contrib/htmlize-hack.el b/contrib/htmlize-hack.el index b75464efa0..f9f4a3dff8 100644 --- a/contrib/htmlize-hack.el +++ b/contrib/htmlize-hack.el @@ -1,6 +1,6 @@ -;;; htmlize-hack.el --- +;;; htmlize-hack.el --- -*- lexical-binding: t; -*- -;; Copyright (C) 2004-2020 Free Software Foundation, Inc. +;; Copyright (C) 2004-2024 Free Software Foundation, Inc. ;; This file is part of Emacs Muse. It is not part of GNU Emacs. @@ -25,7 +25,7 @@ ;;; Code: -(require 'cl) +(require 'cl-lib) (if t (require 'htmlize)) ; Don't load during compilation. (when (equal htmlize-version "1.34") @@ -33,11 +33,11 @@ ;; The size (height) of FACE, taking inheritance into account. ;; Only works in Emacs 21 and later. (let ((size-list - (loop + (cl-loop for f = face then (face-attribute f :inherit) until (or (null f) (eq f 'unspecified)) for h = (face-attribute f :height) collect (if (eq h 'unspecified) nil h)))) - (reduce 'htmlize-merge-size (cons nil size-list))))) + (cl-reduce #'htmlize-merge-size (cons nil size-list))))) (provide 'htmlize-hack) diff --git a/contrib/httpd.el b/contrib/httpd.el index 1fb64a40d5..681d76129d 100644 --- a/contrib/httpd.el +++ b/contrib/httpd.el @@ -1,6 +1,6 @@ -;;; httpd.el -- A web server in Emacs Lisp +;;; httpd.el -- A web server in Emacs Lisp -*- lexical-binding: t; -*- -;; Copyright (C) 2001, 2003, 2006, 2012 Free Software Foundation, Inc. +;; Copyright (C) 2001-2024 Free Software Foundation, Inc. ;; Author: Eric Marsden <emars...@laas.fr> ;; John Wiegley <jo...@gnu.org> @@ -133,7 +133,7 @@ content.") (save-excursion (goto-char (point-max)) (with-current-buffer (get-buffer-create "*httpd access_log*") - (mapc 'insert strings))))) + (mapc #'insert strings))))) (defun httpd-send-data (&rest strings) (dolist (s strings) @@ -143,7 +143,7 @@ content.") (defun httpd-send (code msg &rest strings) (httpd-log (number-to-string code) " ") - (apply 'httpd-send-data + (apply #'httpd-send-data "HTTP/1.0 " (number-to-string code) " " msg httpd-endl strings)) @@ -167,7 +167,7 @@ content.") "</body></html>" httpd-endl) (httpd-send-eof)) -(defun httpd-handle-redirect (req where) +(defun httpd-handle-redirect (_req where) "Redirect the client to new location WHERE." (httpd-send 301 "Moved permanently" "Location: " where httpd-endl @@ -192,7 +192,7 @@ content.") (let ((attrs (file-attributes filename))) (if (and (string-match "^If-Modified-Since:\\s-+\\(.+\\)" req) (setq modified-since - (apply 'encode-time + (apply #'encode-time (parse-time-string (match-string 1 req)))) (time-less-p (nth 5 attrs) modified-since)) (httpd-send 304 "Not modified" @@ -267,7 +267,7 @@ content.") :buffer (generate-new-buffer "httpd") :host 'local :service port :server t :noquery t - :filter 'httpd-serve) + :filter #'httpd-serve) (and (fboundp 'open-network-stream-server) (open-network-stream-server "httpd" (generate-new-buffer "httpd") diff --git a/examples/johnw/muse-init.el b/examples/johnw/muse-init.el index b9a08aa767..2c54ccd1bb 100644 --- a/examples/johnw/muse-init.el +++ b/examples/johnw/muse-init.el @@ -1,6 +1,6 @@ -;;; muse-init.el --- +;;; muse-init.el --- -*- lexical-binding: t; -*- -;; Copyright (C) 2004-2020 Free Software Foundation, Inc. +;; Copyright (C) 2004-2024 Free Software Foundation, Inc. ;; This file is part of Emacs Muse. It is not part of GNU Emacs. @@ -31,7 +31,7 @@ (require 'muse-journal) (require 'muse-poem) -(require 'muse-message "experimental/muse-message") +(require 'muse-message "../experimental/muse-message") (require 'muse-http) diff --git a/experimental/muse-split.el b/experimental/muse-split.el index 5d3b2cd488..576fec7eaa 100644 --- a/experimental/muse-split.el +++ b/experimental/muse-split.el @@ -1,6 +1,6 @@ -;;; muse-split.el --- split published Muse files +;;; muse-split.el --- split published Muse files -*- lexical-binding: t; -*- -;; Copyright (C) 2006 Free Software Foundation, Inc. +;; Copyright (C) 2006-2024 Free Software Foundation, Inc. ;; Author: Phillip Lord <phillip.l...@newcastle.ac.uk> @@ -23,7 +23,7 @@ ;;; Commentary: -;;; Status: +;;;; Status: ;; This works now, except that anchors will get broken, as they may ;; well point to the wrong thing. @@ -37,9 +37,10 @@ ;; These functions directly over-write the original versions in ;; muse-publish. +;;; Code: + +(require 'cl-lib) (require 'muse-publish) -(eval-when-compile - (require 'cl)) ;; this code duplicates that in muse-publish-markup-regexps and should ;; be factored out. I use this style to pull directives from the front @@ -55,6 +56,30 @@ '((directive . muse-publish-presplit-directive) (anchor . muse-publish-presplit-anchor))) +;; we currently have to store a lot of state to get this to work, +;; which is rather dissatisfying. All of it is let bound from +;; muse-publish-file. Wey hey for dynamic scoping. +(defvar muse-publish-presplit-directive-store nil + "Stores directives from main file during splitting") + +(defvar muse-publish-presplit-anchor-location nil + "Stores anchors during publishing.") + +(defvar muse-publish-split-file-split-values nil + "Cache the values of split locations in files, during publish") + +(defvar muse-publishing-targets-alist nil + "Stores the targets to be published to. + +Changing this will cause bad things to happen. ") + +(defvar muse-publishing-style-in-use nil + "Stores the style currently being published") + +(defvar muse-publish-presplit-splitting-file nil + "The file that we are current publishing for presplit") + + ;; oh dear, this function used to be so simple and now has got so ;; nasty. I'm sure I can amalgamate some of the let bindings and ;; lambda function. @@ -111,8 +136,7 @@ the file is published no matter what." (lambda(elem) (muse-with-temp-buffer ;; not handling the directives yet. - (save-excursion - (set-buffer mainbuffer) + (with-current-buffer mainbuffer (setq subcontents (buffer-substring-no-properties (cadr elem) (caddr elem)))) @@ -176,30 +200,6 @@ the file is published no matter what." ;; these are support functions -;; we currently have to store a lot of state to get this to work, -;; which is rather dissatisfying. All of it is let bound from -;; muse-publish-file. Wey hey for dynamic scoping. -(defvar muse-publish-presplit-directive-store nil - "Stores directives from main file during splitting") - -(defvar muse-publish-presplit-anchor-location nil - "Stores anchors during publishing.") - -(defvar muse-publish-split-file-split-values nil - "Cache the values of split locations in files, during publish") - -(defvar muse-publishing-targets-alist nil - "Stores the targets to be published to. - -Changing this will cause bad things to happen. ") - -(defvar muse-publishing-style-in-use nil - "Stores the style currently being published") - -(defvar muse-publish-presplit-splitting-file nil - "The file that we are current publishing for presplit") - - (defun muse-publish-no-split-function (file) (muse-with-temp-buffer (muse-insert-file-contents file) @@ -232,14 +232,11 @@ where position is the last position that should appear in output-file" name value))) (defun muse-publish-presplit-anchor() - "Stores the location and names of anchors" - (let ((alist (cdr (assoc muse-publish-presplit-splitting-file - muse-publish-presplit-anchor-location)))) - - (add-to-list 'alist - `(,(match-string 2) . ,(match-beginning 2))) - (push (cons muse-publish-presplit-splitting-file alist) - muse-publish-presplit-anchor-location))) + "Store the location and names of anchors." + (cl-pushnew `(,(match-string 2) . ,(match-beginning 2)) + (alist-get muse-publish-presplit-splitting-file + muse-publish-presplit-anchor-location) + :test #'equal)) ;; ;;(setq muse-publish-split-file-split-values nil) @@ -271,7 +268,7 @@ where position is the last position that should appear in output-file" ;; (muse-publish-split-file file)) -(defun test1() +(defun test1() ;; FIXME: Namespace! (interactive) (message "%s" (muse-publish-split-file-for-anchor "d:/home/src/ht/home_website/journal-split/journal.muse" @@ -325,10 +322,10 @@ the anchor will be output" ;; this is an example of why I would want to use the code. (muse-derive-style "journal-html-by-day" "journal-html" - :split 'muse-journal-split-by-entry) + :split #'muse-journal-split-by-entry) (muse-derive-style "journal-html-by-month" "journal-html" - :split 'muse-journal-split-by-month) + :split #'muse-journal-split-by-month) (defun muse-journal-split-by-entry (file) @@ -345,29 +342,29 @@ the anchor will be output" (entry-location (match-beginning 0))) (while (re-search-forward split-regexp nil t) (setq entry-location (match-beginning 0)) - (add-to-list 'split-alist - `(,(concat root-name "-" entry-name) - ,current-position - ,(- entry-location 1))) + (cl-pushnew `(,(concat root-name "-" entry-name) + ,current-position + ,(- entry-location 1)) + split-alist :test #'equal) (setq current-position entry-location entry-name (match-string 1))) + (setq split-alist (nreverse split-alist)) + + (cl-pushnew `(,(concat root-name "-all") + ,(point-min) ,(point-max)) + split-alist :test #'equal) - (add-to-list 'split-alist - `(,(concat root-name "-" entry-name) - ,current-position - ,(point-max)) - t) + (cl-pushnew `(,root-name + ,(cadr (car (last split-alist))) + ,(caddr (car (last split-alist)))) + split-alist :test #'equal) - (add-to-list 'split-alist - `(,root-name - ,(cadr (car (last split-alist))) - ,(caddr (car (last split-alist)))) - t) + (cl-pushnew `(,(concat root-name "-" entry-name) + ,current-position + ,(point-max)) + split-alist :test #'equal) - (add-to-list 'split-alist - `(,(concat root-name "-all") - 1 ,(point-max)) - t)))) + (setq split-alist (nreverse split-alist))))) (defun muse-journal-split-by-month (file) "Split a muse journal file into months. @@ -391,43 +388,46 @@ it isn't then it some of the entries will appear not to be published." (not (equal entry-name (muse-journal-split-by-month-name)))) (setq entry-location (match-beginning 0)) - (add-to-list 'split-alist - `(,(concat root-name "-" entry-name) - ,current-position - ,(- entry-location 1))) + (cl-pushnew `(,(concat root-name "-" entry-name) + ,current-position + ,(- entry-location 1)) + split-alist :test #'equal) (setq current-position entry-location entry-name (muse-journal-split-by-month-name))) ;; add last entry - (add-to-list 'split-alist - `(,(concat root-name "-" entry-name) - ,current-position - ,(point-max))) + (cl-pushnew `(,(concat root-name "-" entry-name) + ,current-position + ,(point-max)) + split-alist :test #'equal) ;; add some duplicate entries in. Add these last, so that ;; anchors go to one of the others. ;; + (setq split-alist (nreverse split-alist)) + + ;; add all entry + (cl-pushnew `(,(concat root-name "-all") + ,(point-min) ,(point-max)) + split-alist :test #'equal) ;; duplicate last entry as current - (add-to-list 'split-alist - `(,root-name - ,(cadr (car (last split-alist))) - ,(caddr (car (last split-alist)))) - t) + (cl-pushnew `(,root-name + ,(cadr (car (last split-alist))) + ,(caddr (car (last split-alist)))) + split-alist + :test #'equal) - ;; add all entry - (add-to-list 'split-alist - `(,(concat root-name "-all") - 1 ,(point-max)) - t)))) + (setq split-alist (nreverse split-alist)) + ))) (defun muse-journal-split-by-month-name() (concat (match-string 1) (match-string 2))) -(defun test2() +(defun test2() ;; FIXME: Namespace! (interactive) (message "%s" (muse-journal-split-by-entry "journal.muse"))) diff --git a/lisp/muse-backlink.el b/lisp/muse-backlink.el index 76c0c9c184..467139b17f 100644 --- a/lisp/muse-backlink.el +++ b/lisp/muse-backlink.el @@ -1,7 +1,6 @@ -;;; muse-backlink.el --- backlinks for Muse +;;; muse-backlink.el --- backlinks for Muse -*- lexical-binding: t; -*- -;; Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2014 -;; Free Software Foundation, Inc. +;; Copyright (C) 2005-2024 Free Software Foundation, Inc. ;; Author: Jim Ottaway <j.otta...@lse.ac.uk> ;; Keywords: @@ -83,10 +82,10 @@ that for the default value of SEPARATORS leading and trailing whitespace are effectively trimmed). If nil, all zero-length substrings are retained, which correctly parses CSV format, for example. -Note that the effect of (split-string STRING) is the same as -(split-string STRING split-string-default-separators t). In the rare +Note that the effect of `(split-string STRING)' is the same as +`(split-string STRING split-string-default-separators t)'). In the rare case that you wish to retain zero-length substrings when splitting on -whitespace, use (split-string STRING split-string-default-separators). +whitespace, use `(split-string STRING split-string-default-separators)'. Modifies the match data; use `save-match-data' if necessary." (let ((keep-nulls (not (if separators omit-nulls t))) @@ -111,7 +110,7 @@ Modifies the match data; use `save-match-data' if necessary." (cons (substring string start) list))) (nreverse list)))) - (defalias 'muse-backlink-split-string 'split-string))) + (defalias 'muse-backlink-split-string #'split-string))) (defgroup muse-backlink nil "Hierarchical backlinking for Muse." @@ -122,51 +121,43 @@ Modifies the match data; use `save-match-data' if necessary." For control over which pages will receive backlinks, see `muse-backlink-exclude-backlink-parent-regexp' and `muse-backlink-exclude-backlink-regexp'." - :type 'boolean - :group 'muse-backlink) + :type 'boolean) (defcustom muse-backlink-avoid-bad-links t "When non-nil, avoid bad links when backlinking." - :type 'boolean - :group 'muse-backlink) + :type 'boolean) ;; The default for exclusion stops backlinks from being added to and ;; from planner day pages. (defcustom muse-backlink-exclude-backlink-parent-regexp "^[0-9][0-9][0-9][0-9]\\.[0-9][0-9]\\.[0-9][0-9]$" "Regular expression matching pages whose children should not have backlinks." - :type 'regexp - :group 'muse-backlink) + :type 'regexp) (defcustom muse-backlink-exclude-backlink-regexp "^[0-9][0-9][0-9][0-9]\\.[0-9][0-9]\\.[0-9][0-9]$" "Regular expression matching pages that should not have backlinks." - :type 'regexp - :group 'muse-backlink) + :type 'regexp) (defcustom muse-backlink-separator "/" "String that separates backlinks. Should be something that will not appear as a substring in an explicit link that has no description." - :type 'string - :group 'muse-backlink) + :type 'string) (defcustom muse-backlink-before-string "backlinks: " "String to come before the backlink list." - :type 'string - :group 'muse-backlink) + :type 'string) (defcustom muse-backlink-after-string "" "String to come after the backlink list." - :type 'string - :group 'muse-backlink) + :type 'string) (defcustom muse-backlink-separator "/" "String that separates backlinks. Should be something that will not appear as a substring in an explicit link that has no description." - :type 'string - :group 'muse-backlink) + :type 'string) (defcustom muse-backlink-regexp (concat "^" @@ -184,8 +175,7 @@ link that has no description." "Regular expression to match backlinks in a buffer. Match 1 is the list of backlinks without `muse-backlink-before-string' and `muse-backlink-after-string'." - :type 'regexp - :group 'muse-backlink) + :type 'regexp) (defun muse-backlink-goto-insertion-point () "Find the right place to add backlinks." diff --git a/lisp/muse-docbook.el b/lisp/muse-docbook.el index a54089fec0..7aef4c7997 100644 --- a/lisp/muse-docbook.el +++ b/lisp/muse-docbook.el @@ -1,7 +1,6 @@ -;;; muse-docbook.el --- publish DocBook files +;;; muse-docbook.el --- publish DocBook files -*- lexical-binding: t; -*- -;; Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 -;; Free Software Foundation, Inc. +;; Copyright (C) 2004-2024 Free Software Foundation, Inc. ;; This file is part of Emacs Muse. It is not part of GNU Emacs. @@ -46,8 +45,7 @@ See `muse-docbook' for more information." (defcustom muse-docbook-extension ".xml" "Default file extension for publishing DocBook XML files." - :type 'string - :group 'muse-docbook) + :type 'string) (defcustom muse-docbook-header "<?xml version=\"1.0\" encoding=\"<lisp> @@ -64,16 +62,14 @@ See `muse-docbook' for more information." <!-- Page published by Emacs Muse begins here -->\n" "Header used for publishing DocBook XML files. This may be text or a filename." - :type 'string - :group 'muse-docbook) + :type 'string) (defcustom muse-docbook-footer " <!-- Page published by Emacs Muse ends here --> <lisp>(muse-docbook-bibliography)</lisp></article>\n" "Footer used for publishing DocBook XML files. This may be text or a filename." - :type 'string - :group 'muse-docbook) + :type 'string) (defcustom muse-docbook-markup-regexps `(;; Beginning of doc, end of doc, or plain paragraph separator @@ -89,8 +85,7 @@ For more on the structure of this list, see `muse-publish-markup-regexps'." (choice regexp symbol) integer (choice string function symbol)) - function)) - :group 'muse-docbook) + function))) (defcustom muse-docbook-markup-functions '((anchor . muse-xml-markup-anchor) @@ -98,8 +93,7 @@ For more on the structure of this list, see `muse-publish-markup-regexps'." "An alist of style types to custom functions for that kind of text. For more on the structure of this list, see `muse-publish-markup-functions'." - :type '(alist :key-type symbol :value-type function) - :group 'muse-docbook) + :type '(alist :key-type symbol :value-type function)) (defcustom muse-docbook-markup-strings '((image-with-desc . "<mediaobject> @@ -190,20 +184,17 @@ For more on the structure of this list, see "Strings used for marking up text. These cover the most basic kinds of markup, the handling of which differs little between the various styles." - :type '(alist :key-type symbol :value-type string) - :group 'muse-docbook) + :type '(alist :key-type symbol :value-type string)) (defcustom muse-docbook-encoding-default 'utf-8 "The default Emacs buffer encoding to use in published files. This will be used if no special characters are found." - :type 'symbol - :group 'muse-docbook) + :type 'symbol) (defcustom muse-docbook-charset-default "utf-8" "The default DocBook XML charset to use if no translation is found in `muse-docbook-encoding-map'." - :type 'string - :group 'muse-docbook) + :type 'string) (defun muse-docbook-encoding () (muse-xml-transform-content-type @@ -230,7 +221,8 @@ found in `muse-docbook-encoding-map'." (and (not (string= (match-string 1) "/")) ;; don't mess up nested lists - (not (and (muse-looking-back "<listitem>") + (not (and (muse-looking-back "<listitem>" + (- (point) 10)) (throw 'bail-out t))))) ((string= (match-string 2) "footnote") (string= (match-string 1) "/")) @@ -277,7 +269,7 @@ and anything after `Firstname' is optional." (setq author (nreverse (cdr author))) (concat "<firstname>" first "</firstname>" "<othername>" - (mapconcat 'identity author " ") + (mapconcat #'identity author " ") "</othername>" "<surname>" last "</surname>")))))) diff --git a/lisp/muse-http.el b/lisp/muse-http.el index 0c83c92dfc..07d713f5b3 100644 --- a/lisp/muse-http.el +++ b/lisp/muse-http.el @@ -1,7 +1,6 @@ -;;; muse-http.el --- publish HTML files over HTTP +;;; muse-http.el --- publish HTML files over HTTP -*- lexical-binding: t; -*- -;; Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 -;; Free Software Foundation, Inc. +;; Copyright (C) 2004-2024 Free Software Foundation, Inc. ;; This file is part of Emacs Muse. It is not part of GNU Emacs. @@ -34,8 +33,8 @@ (require 'muse-html) (require 'muse-project) -(require 'httpd) -(require 'cgi) +(require 'httpd "../contrib/httpd") +(require 'cgi "../contrib/cgi") (defgroup muse-http nil "Options controlling the behavior of Emacs Muse over HTTP." diff --git a/lisp/muse-ipc.el b/lisp/muse-ipc.el index da8eb37d0e..76f116b19b 100644 --- a/lisp/muse-ipc.el +++ b/lisp/muse-ipc.el @@ -1,6 +1,6 @@ -;;; muse-ipc.el --- publish Muse documents from other processes +;;; muse-ipc.el --- publish Muse documents from other processes -*- lexical-binding: t; -*- -;; Copyright (C) 2009, 2010 Free Software Foundation, Inc. +;; Copyright (C) 2009-2024 Free Software Foundation, Inc. ;; This file is part of Emacs Muse. It is not part of GNU Emacs. @@ -33,7 +33,7 @@ ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -(eval-when-compile (require 'cl)) +(eval-when-compile (require 'cl-lib)) (require 'muse) (require 'muse-publish) @@ -77,7 +77,7 @@ (when (eq (process-status proc) 'open) (delete-process proc))) -(defun* muse-ipc-server-filter (proc string) +(cl-defun muse-ipc-server-filter (proc string) "Handle data from a client after it connects." ;; Authenticate (unless (process-get proc :authenticated) @@ -90,7 +90,7 @@ (process-send-string proc "ok\n")) (process-send-string proc "nok\n") (delete-process proc)) - (return-from muse-ipc-server-filter)) + (cl-return-from muse-ipc-server-filter)) ;; Handle case where the client is sending data to be published (when (process-get proc :sending-data) @@ -103,7 +103,7 @@ ((> buf-len expected-len) (process-send-string proc "nok\n") (muse-ipc-delete-client proc))))) - (return-from muse-ipc-server-filter)) + (cl-return-from muse-ipc-server-filter)) ;; Dispatch commands (cond diff --git a/lisp/muse-mode.el b/lisp/muse-mode.el index f20a032076..9ead8caa06 100644 --- a/lisp/muse-mode.el +++ b/lisp/muse-mode.el @@ -1,7 +1,6 @@ -;;; muse-mode.el --- mode for editing Muse files; has font-lock support +;;; muse-mode.el --- mode for editing Muse files; has font-lock support -*- lexical-binding: t; -*- -;; Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 -;; Free Software Foundation, Inc. +;; Copyright (C) 2004-2024 Free Software Foundation, Inc. ;; This file is part of Emacs Muse. It is not part of GNU Emacs. diff --git a/lisp/muse.el b/lisp/muse.el index ae9a975cae..74ed9da3dc 100644 --- a/lisp/muse.el +++ b/lisp/muse.el @@ -1,7 +1,6 @@ -;;; muse.el --- Authoring and publishing tool for Emacs +;;; muse.el --- Authoring and publishing tool for Emacs -*- lexical-binding: t; -*- -;; Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 -;; Free Software Foundation, Inc. +;; Copyright (C) 2004-2024 Free Software Foundation, Inc. ;; Emacs Lisp Archive Entry ;; Filename: muse.el @@ -283,6 +282,7 @@ The undo feature will be disabled in the new buffer. If `debug-on-error' is set to t, keep the buffer around for debugging purposes rather than removing it." + (declare (indent 0) (debug t)) (let ((temp-buffer (make-symbol "temp-buffer"))) `(let ((,temp-buffer (generate-new-buffer " *muse-temp*"))) (buffer-disable-undo ,temp-buffer) @@ -310,9 +310,6 @@ debugging purposes rather than removing it." (set-buffer-modified-p nil)) (unless debug-on-error (kill-buffer ,temp-buffer))))))) -(put 'muse-with-temp-buffer 'lisp-indent-function 0) -(put 'muse-with-temp-buffer 'edebug-form-spec '(body)) - (defun muse-insert-file-contents (filename &optional visit) "Insert the contents of file FILENAME after point. Do character code conversion and end-of-line conversion, but none