diff options
| author | Stefan Monnier <monnier@iro.umontreal.ca> | 2024-02-09 18:40:01 -0500 |
|---|---|---|
| committer | Stefan Monnier <monnier@iro.umontreal.ca> | 2024-02-09 18:40:01 -0500 |
| commit | 8710adde8fef5fb570e23383900f5cfa1d39060c (patch) | |
| tree | 70c2b3a522067a199ce05055a093db1e33dc6bbb /contrib | |
| parent | 20fc8575d5bab5a8e67c35046ee26b8b3fe42731 (diff) | |
Fix compilation and address some warningsexternals/muse
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.
Diffstat (limited to 'contrib')
| -rw-r--r-- | contrib/cgi.el | 41 | ||||
| -rw-r--r-- | contrib/htmlize-hack.el | 10 | ||||
| -rw-r--r-- | contrib/httpd.el | 14 |
3 files changed, 32 insertions, 33 deletions
diff --git a/contrib/cgi.el b/contrib/cgi.el index 0e85a52..1b5d706 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 <emarsden@laas.fr> ;; Michael Olson <mwolson@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 b75464e..f9f4a3d 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 1fb64a4..681d761 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 <emarsden@laas.fr> ;; John Wiegley <johnw@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") |
