From: Stefan Monnier Date: Wed, 15 Oct 2014 20:47:38 +0000 (-0400) Subject: Miscellaneous cleanup. X-Git-Url: https://code.delx.au/gnu-emacs-elpa/commitdiff_plain/e7e02c2582a38a60395c4fc05dc261407946905e Miscellaneous cleanup. * muse/muse-publish.el (muse-current-output-style): Declare. * muse/muse-project.el (muse-project-set-variables): Only call make-local-hook if it exists. * muse/muse-html.el (muse-html-src-tag): Use font-lock-ensure when available. * muse/muse-project.el (muse-project-alist-get, muse-project-alist-set): * muse/muse-blosxom.el (muse-blosxom-new-entry): Avoid add-to-list on local var. * muse/htmlize-hack.el: Require `cl' at run-time as well. * muse/cgi.el (cgi-decode): Avoid `flet'. --- diff --git a/packages/muse/cgi.el b/packages/muse/cgi.el index 936b33f4d..0e85a52e7 100644 --- a/packages/muse/cgi.el +++ b/packages/muse/cgi.el @@ -1,6 +1,6 @@ ;;; cgi.el -- Using Emacs for CGI scripting -;; Copyright (C) 2000, 2006, 2012 Free Software Foundation, Inc. +;; Copyright (C) 2000, 2006, 2012, 2014 Free Software Foundation, Inc. ;; Author: Eric Marsden ;; Michael Olson (slight modifications) @@ -120,11 +120,12 @@ ;; Substrings are plus-decoded and then URI-decoded. (defun cgi-decode (q) (when q - (flet ((split-= (str) - (let ((pos (or (cgi-position ?= str) 0))) - (cons (cgi-decode-string (substring str 0 pos)) - (cgi-decode-string (substring str (+ pos 1))))))) - (mapcar #'split-= (split-string q "&"))))) + (let ((split-= + (lambda (str) + (let ((pos (or (cgi-position ?= str) 0))) + (cons (cgi-decode-string (substring str 0 pos)) + (cgi-decode-string (substring str (+ pos 1)))))))) + (mapcar split-= (split-string q "&"))))) (defun cgi-lose (fmt &rest args) (let ((why (apply #'format fmt args))) diff --git a/packages/muse/htmlize-hack.el b/packages/muse/htmlize-hack.el index e62394646..61627b66a 100644 --- a/packages/muse/htmlize-hack.el +++ b/packages/muse/htmlize-hack.el @@ -2,7 +2,7 @@ ;; To use it, add the path to this directory to your load path and ;; add (require 'htmlize-hack) to your Emacs init file. -(eval-when-compile (require 'cl)) +(require 'cl) (if t (require 'htmlize)) ; Don't load during compilation. (when (equal htmlize-version "1.34") diff --git a/packages/muse/muse-backlink.el b/packages/muse/muse-backlink.el index bc21dddde..d5b7ebdf8 100644 --- a/packages/muse/muse-backlink.el +++ b/packages/muse/muse-backlink.el @@ -1,6 +1,6 @@ ;;; muse-backlink.el --- backlinks for Muse -;; Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 +;; Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2014 ;; Free Software Foundation, Inc. ;; Author: Jim Ottaway @@ -261,7 +261,7 @@ The parent buffer of the forthcomingly visited muse page.") (save-buffer) (when muse-backlink-parent-buffer (with-current-buffer muse-backlink-parent-buffer - (font-lock-fontify-buffer)))) + (font-lock-fontify-buffer)))) ;FIXME: Why? --Stef (setq muse-backlink-links nil muse-backlink-parent-buffer nil muse-backlink-pending nil) diff --git a/packages/muse/muse-blosxom.el b/packages/muse/muse-blosxom.el index 78038d703..d7bce9c40 100644 --- a/packages/muse/muse-blosxom.el +++ b/packages/muse/muse-blosxom.el @@ -1,6 +1,6 @@ ;;; muse-blosxom.el --- publish a document tree for serving by (py)Blosxom -;; Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 +;; Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2014 ;; Free Software Foundation, Inc. ;; Author: Michael Olson @@ -258,7 +258,8 @@ The page will be initialized with the current date and TITLE." (tags nil)) (while (progn (setq tag (read-string "Tag (RET to continue): ")) (not (string= tag ""))) - (add-to-list 'tags tag t)) + (unless (member tag tags) + (setq tags (append tags (list tag))))) tags) (funcall muse-completing-read-function "Category: " diff --git a/packages/muse/muse-html.el b/packages/muse/muse-html.el index 6a9356bfb..2473025f0 100644 --- a/packages/muse/muse-html.el +++ b/packages/muse/muse-html.el @@ -1,6 +1,6 @@ ;;; muse-html.el --- publish to HTML and XHTML -;; Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 +;; Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2014 ;; Free Software Foundation, Inc. ;; This file is part of Emacs Muse. It is not part of GNU Emacs. @@ -667,7 +667,9 @@ This tag requires htmlize 1.34 or later in order to work." (if (functionp mode) (funcall mode) (fundamental-mode)) - (font-lock-fontify-buffer) + (if (fboundp 'font-lock-ensure) + (font-lock-ensure) + (font-lock-fontify-buffer)) ;; silence the byte-compiler (when (fboundp 'htmlize-region-for-paste) ;; transform the region to HTML diff --git a/packages/muse/muse-project.el b/packages/muse/muse-project.el index 7489706d1..d60973576 100644 --- a/packages/muse/muse-project.el +++ b/packages/muse/muse-project.el @@ -1,6 +1,6 @@ ;;; muse-project.el --- handle Muse projects -;; Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 +;; Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2014 ;; Free Software Foundation, Inc. ;; This file is part of Emacs Muse. It is not part of GNU Emacs. @@ -86,11 +86,13 @@ has been modified via the customize interface.") ;; Turn settings of first part into cons cells, symbol->string (while head (cond ((stringp (car head)) - (add-to-list 'res (car head) t) + (unless (member (car head) res) + (setq res (append res (list (car head))))) (setq head (cdr head))) ((symbolp (car head)) - (add-to-list 'res (list (symbol-name (car head)) - (cadr head)) t) + (let ((x (list (symbol-name (car head)) (cadr head)))) + (unless (member x res) + (setq res (append res (list x))))) (setq head (cddr head))) (t (setq head (cdr head))))) @@ -123,10 +125,13 @@ Muse can make use of." ;; Turn cons cells into flat list, string->symbol (while head (cond ((stringp (car head)) - (add-to-list 'res (car head) t)) + (unless (member (car head) res) + (setq res (append res (list (car head)))))) ((consp (car head)) - (add-to-list 'res (intern (caar head)) t) - (add-to-list 'res (car (cdar head)) t))) + (let ((x (intern (caar head))) + (y (car (cdar head)))) + (unless (member x res) (setq res (append res (list x)))) + (unless (member y res) (setq res (append res (list y))))))) (setq head (cdr head))) (setcdr (car val) (cons res (cdr (cdar val))))) (let ((styles (cdar val))) @@ -942,7 +947,8 @@ prompting for one." (setq sym (car vars)) (setq custom-set (or (get sym 'custom-set) 'set)) (setq var (if (eq (get sym 'custom-type) 'hook) - (make-local-hook sym) + (if (fboundp 'make-local-hook) + (make-local-hook sym)) (make-local-variable sym))) (funcall custom-set var (car (cdr vars))) (setq vars (cdr (cdr vars)))))) diff --git a/packages/muse/muse-publish.el b/packages/muse/muse-publish.el index ec6e176e3..cbcd4158e 100644 --- a/packages/muse/muse-publish.el +++ b/packages/muse/muse-publish.el @@ -1,6 +1,6 @@ ;;; muse-publish.el --- base publishing implementation -;; Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 +;; Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2014 ;; Free Software Foundation, Inc. ;; This file is part of Emacs Muse. It is not part of GNU Emacs. @@ -845,6 +845,8 @@ the file is published no matter what." (muse-style-run-hooks :final style file output-path target))) t)))) +(defvar muse-current-output-style) + ;;;###autoload (defun muse-publish-this-file (style output-dir &optional force) "Publish the currently-visited file.