diff options
author | Stefan Monnier <monnier@iro.umontreal.ca> | 2012-07-11 19:13:41 -0400 |
---|---|---|
committer | Stefan Monnier <monnier@iro.umontreal.ca> | 2012-07-11 19:13:41 -0400 |
commit | a464a6c73acf27b0d633d428919a36bc16a9d442 (patch) | |
tree | bcba70ce0242bfd5987356c750ba4eb6b58820b1 /lisp/net | |
parent | c214e35e489145bd3a8ab7a353671f947368a7ae (diff) | |
download | emacs-a464a6c73acf27b0d633d428919a36bc16a9d442.tar.gz |
More CL cleanups and reduction of use of cl.el.
* woman.el, winner.el, vc/vc-rcs.el, vc/vc-hooks.el, vc/vc-hg.el:
* vc/vc-git.el, vc/vc-dir.el, vc/vc-bzr.el, vc/vc-annotate.el:
* textmodes/tex-mode.el, textmodes/sgml-mode.el, tar-mode.el:
* strokes.el, ses.el, server.el, progmodes/js.el, progmodes/gdb-mi.el:
* progmodes/flymake.el, progmodes/ebrowse.el, progmodes/compile.el:
* play/tetris.el, play/snake.el, play/pong.el, play/landmark.el:
* play/hanoi.el, play/decipher.el, play/5x5.el, nxml/nxml-mode.el:
* net/secrets.el, net/quickurl.el, midnight.el, mail/footnote.el:
* image-dired.el, ibuffer.el, ibuf-macs.el, ibuf-ext.el, hexl.el:
* eshell/eshell.el, eshell/esh-io.el, eshell/esh-ext.el:
* eshell/esh-cmd.el, eshell/em-ls.el, eshell/em-hist.el:
* eshell/em-cmpl.el, eshell/em-banner.el:
* url/url.el, url/url-queue.el, url/url-parse.el, url/url-http.el:
* url/url-future.el, url/url-dav.el, url/url-cookie.el:
* calendar/parse-time.el, test/eshell.el: Use cl-lib.
* wid-browse.el, wdired.el, vc/vc.el, vc/vc-mtn.el, vc/vc-cvs.el:
* vc/vc-arch.el, tree-widget.el, textmodes/texinfo.el:
* textmodes/refill.el, textmodes/css-mode.el, term/tvi970.el:
* term/ns-win.el, term.el, shell.el, ps-samp.el:
* progmodes/perl-mode.el, progmodes/pascal.el, progmodes/gud.el:
* progmodes/glasses.el, progmodes/etags.el, progmodes/cwarn.el:
* play/gamegrid.el, play/bubbles.el, novice.el, notifications.el:
* net/zeroconf.el, net/xesam.el, net/snmp-mode.el, net/mairix.el:
* net/ldap.el, net/eudc.el, net/browse-url.el, man.el:
* mail/mailheader.el, mail/feedmail.el:
* url/url-util.el, url/url-privacy.el, url/url-nfs.el, url/url-misc.el:
* url/url-methods.el, url/url-gw.el, url/url-file.el, url/url-expand.el:
Dont use CL.
* ibuf-ext.el (ibuffer-mark-old-buffers): Use float-time.
* eshell/esh-opt.el (eshell-eval-using-options): Quote code with
`lambda' rather than with `quote'.
(eshell-do-opt): Adjust accordingly.
(eshell-process-option): Simplify.
* eshell/esh-var.el:
* eshell/em-script.el: Require `esh-opt' for eshell-eval-using-options.
* emacs-pcase.el (pcase--dontcare-upats, pcase--let*)
(pcase--expand, pcase--u1): Rename pcase's internal `dontcare' pattern
to `pcase--dontcare'.
* emacs-cl.el (labels): Mark obsolete.
(cl--letf, letf): Move to cl-lib.
(cl--letf*, letf*): Remove.
* emacs-cl-lib.el (cl-nth-value): Use defalias.
* emacs-cl-macs.el (cl-dolist, cl-dotimes): Add indent rule.
(cl-progv): Rewrite.
(cl--letf, cl-letf): Move from cl.el.
(cl-letf*): New macro.
* emacs-cl-extra.el (cl--progv-before, cl--progv-after): Remove.
Diffstat (limited to 'lisp/net')
-rw-r--r-- | lisp/net/browse-url.el | 33 | ||||
-rw-r--r-- | lisp/net/eudc.el | 4 | ||||
-rw-r--r-- | lisp/net/ldap.el | 13 | ||||
-rw-r--r-- | lisp/net/mairix.el | 2 | ||||
-rw-r--r-- | lisp/net/quickurl.el | 89 | ||||
-rw-r--r-- | lisp/net/secrets.el | 5 | ||||
-rw-r--r-- | lisp/net/snmp-mode.el | 1 | ||||
-rw-r--r-- | lisp/net/xesam.el | 16 | ||||
-rw-r--r-- | lisp/net/zeroconf.el | 5 |
9 files changed, 72 insertions, 96 deletions
diff --git a/lisp/net/browse-url.el b/lisp/net/browse-url.el index f4e7e942931..20d71215926 100644 --- a/lisp/net/browse-url.el +++ b/lisp/net/browse-url.el @@ -205,8 +205,6 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Variables -(eval-when-compile (require 'cl)) - (defgroup browse-url nil "Use a web browser to look at a URL." :prefix "browse-url-" @@ -1621,22 +1619,21 @@ from `browse-url-elinks-wrapper'." (defun browse-url-elinks-sentinel (process url) "Determines if Elinks is running or a new one has to be started." - (let ((exit-status (process-exit-status process))) - ;; Try to determine if an instance is running or if we have to - ;; create a new one. - (case exit-status - (5 - ;; No instance, start a new one. - (browse-url-elinks-new-window url)) - (0 - ;; Found an instance, open URL in new tab. - (let ((process-environment (browse-url-process-environment))) - (start-process (concat "elinks:" url) nil - "elinks" "-remote" - (concat "openURL(\"" url "\",new-tab)")))) - (otherwise - (error "Unrecognized exit-code %d of process `elinks'" - exit-status))))) + ;; Try to determine if an instance is running or if we have to + ;; create a new one. + (pcase (process-exit-status process) + (5 + ;; No instance, start a new one. + (browse-url-elinks-new-window url)) + (0 + ;; Found an instance, open URL in new tab. + (let ((process-environment (browse-url-process-environment))) + (start-process (concat "elinks:" url) nil + "elinks" "-remote" + (concat "openURL(\"" url "\",new-tab)")))) + (exit-status + (error "Unrecognized exit-code %d of process `elinks'" + exit-status)))) (provide 'browse-url) diff --git a/lisp/net/eudc.el b/lisp/net/eudc.el index 9bd01806d24..0e9707e57f3 100644 --- a/lisp/net/eudc.el +++ b/lisp/net/eudc.el @@ -48,9 +48,7 @@ (eval-and-compile (if (not (fboundp 'make-overlay)) - (require 'overlay)) - (if (not (fboundp 'unless)) - (require 'cl))) + (require 'overlay))) (unless (fboundp 'custom-menu-create) (autoload 'custom-menu-create "cus-edit")) diff --git a/lisp/net/ldap.el b/lisp/net/ldap.el index 941b6d7787c..eb696798b6f 100644 --- a/lisp/net/ldap.el +++ b/lisp/net/ldap.el @@ -34,7 +34,6 @@ ;;; Code: (require 'custom) -(eval-when-compile (require 'cl)) (autoload 'auth-source-search "auth-source") @@ -465,12 +464,12 @@ Additional search parameters can be specified through (error "No LDAP host specified")) (let ((host-plist (cdr (assoc host ldap-host-parameters-alist))) result) - (setq result (ldap-search-internal (list* 'host host - 'filter filter - 'attributes attributes - 'attrsonly attrsonly - 'withdn withdn - host-plist))) + (setq result (ldap-search-internal `(host ,host + filter ,filter + attributes ,attributes + attrsonly ,attrsonly + withdn ,withdn + ,@host-plist))) (if ldap-ignore-attribute-codings result (mapcar (lambda (record) diff --git a/lisp/net/mairix.el b/lisp/net/mairix.el index a8e969a18c5..f85983e6e9f 100644 --- a/lisp/net/mairix.el +++ b/lisp/net/mairix.el @@ -70,8 +70,6 @@ (require 'widget) (require 'cus-edit) -(eval-when-compile - (require 'cl)) ;;; Keymappings diff --git a/lisp/net/quickurl.el b/lisp/net/quickurl.el index b0bfe5b271c..f3b0e372de4 100644 --- a/lisp/net/quickurl.el +++ b/lisp/net/quickurl.el @@ -81,8 +81,7 @@ ;; Things we need: -(eval-when-compile - (require 'cl)) +(eval-when-compile (require 'cl-lib)) (require 'thingatpt) (require 'pp) (require 'browse-url) @@ -206,47 +205,40 @@ in your ~/.emacs (after loading/requiring quickurl).") (list keyword url comment) (cons keyword url))) -(defun quickurl-url-keyword (url) +(defalias 'quickurl-url-keyword #'car "Return the keyword for the URL. - -Note that this function is a setfable place." - (car url)) - -(defsetf quickurl-url-keyword (url) (store) - `(setf (car ,url) ,store)) +\n\(fn URL)") (defun quickurl-url-url (url) "Return the actual URL of the URL. Note that this function is a setfable place." + (declare (gv-setter (lambda (store) + `(setf (if (quickurl-url-commented-p ,url) + (cadr ,url) + (cdr ,url)) + ,store)))) (if (quickurl-url-commented-p url) (cadr url) (cdr url))) -(defsetf quickurl-url-url (url) (store) - ` - (if (quickurl-url-commented-p ,url) - (setf (cadr ,url) ,store) - (setf (cdr ,url) ,store))) - (defun quickurl-url-comment (url) "Get the comment from a URL. If the URL has no comment an empty string is returned. Also note that this function is a setfable place." + (declare + (gv-setter (lambda (store) + `(if (quickurl-url-commented-p ,url) + (if (zerop (length ,store)) + (setf (cdr ,url) (cadr ,url)) + (setf (nth 2 ,url) ,store)) + (unless (zerop (length ,store)) + (setf (cdr ,url) (list (cdr ,url) ,store))))))) (if (quickurl-url-commented-p url) (nth 2 url) "")) -(defsetf quickurl-url-comment (url) (store) - ` - (if (quickurl-url-commented-p ,url) - (if (zerop (length ,store)) - (setf (cdr ,url) (cadr ,url)) - (setf (nth 2 ,url) ,store)) - (unless (zerop (length ,store)) - (setf (cdr ,url) (list (cdr ,url) ,store))))) - (defun quickurl-url-description (url) "Return a description for the URL. @@ -259,14 +251,14 @@ returned." ;; Main code: -(defun* quickurl-read (&optional buffer) +(cl-defun quickurl-read (&optional buffer) "`read' the URL list from BUFFER into `quickurl-urls'. BUFFER, if nil, defaults to current buffer. Note that this function moves point to `point-min' before doing the `read' It also restores point after the `read'." (save-excursion - (setf (point) (point-min)) + (goto-char (point-min)) (setq quickurl-urls (funcall quickurl-sort-function (read (or buffer (current-buffer))))))) @@ -303,7 +295,7 @@ Also display a `message' saying what the URL was unless SILENT is non-nil." (message "Found %s" (quickurl-url-url url)))) ;;;###autoload -(defun* quickurl (&optional lookup) +(cl-defun quickurl (&optional lookup) "Insert a URL based on LOOKUP. If not supplied LOOKUP is taken to be the word at point in the current @@ -464,20 +456,21 @@ The key bindings for `quickurl-list-mode' are: (defun quickurl-list-populate-buffer () "Populate the `quickurl-list' buffer." (with-current-buffer (get-buffer quickurl-list-buffer-name) - (let ((buffer-read-only nil) - (fmt (format "%%-%ds %%s\n" - (apply #'max (or (loop for url in quickurl-urls - collect (length (quickurl-url-description url))) - (list 20)))))) - (setf (buffer-string) "") - (loop for url in quickurl-urls - do (let ((start (point))) - (insert (format fmt (quickurl-url-description url) - (quickurl-url-url url))) - (add-text-properties start (1- (point)) - '(mouse-face highlight - help-echo "mouse-2: insert this URL")))) - (setf (point) (point-min))))) + (let* ((sizes (or (cl-loop for url in quickurl-urls + collect (length (quickurl-url-description url))) + (list 20))) + (fmt (format "%%-%ds %%s\n" (apply #'max sizes))) + (inhibit-read-only t)) + (erase-buffer) + (cl-loop for url in quickurl-urls + do (let ((start (point))) + (insert (format fmt (quickurl-url-description url) + (quickurl-url-url url))) + (add-text-properties + start (1- (point)) + '(mouse-face highlight + help-echo "mouse-2: insert this URL")))) + (goto-char (point-min))))) (defun quickurl-list-add-url (word url comment) "Wrapper for `quickurl-add-url' that doesn't guess the parameters." @@ -494,7 +487,7 @@ The key bindings for `quickurl-list-mode' are: (defun quickurl-list-mouse-select (event) "Select the URL under the mouse click." (interactive "e") - (setf (point) (posn-point (event-end event))) + (goto-char (posn-point (event-end event))) (quickurl-list-insert-url)) (defun quickurl-list-insert (type) @@ -510,16 +503,16 @@ TYPE dictates what will be inserted, options are: (if url (with-current-buffer quickurl-list-last-buffer (insert - (case type - (url (funcall quickurl-format-function url)) - (naked-url (quickurl-url-url url)) - (with-lookup (format "%s <URL:%s>" + (pcase type + (`url (funcall quickurl-format-function url)) + (`naked-url (quickurl-url-url url)) + (`with-lookup (format "%s <URL:%s>" (quickurl-url-keyword url) (quickurl-url-url url))) - (with-desc (format "%S <URL:%s>" + (`with-desc (format "%S <URL:%s>" (quickurl-url-description url) (quickurl-url-url url))) - (lookup (quickurl-url-keyword url))))) + (`lookup (quickurl-url-keyword url))))) (error "No URL details on that line")) url)) diff --git a/lisp/net/secrets.el b/lisp/net/secrets.el index 7833ef679d4..96b74b2f8e2 100644 --- a/lisp/net/secrets.el +++ b/lisp/net/secrets.el @@ -142,8 +142,7 @@ ;; Pacify byte-compiler. D-Bus support in the Emacs core can be ;; disabled with configuration option "--without-dbus". Declare used ;; subroutines and variables of `dbus' therefore. -(eval-when-compile - (require 'cl)) +(eval-when-compile (require 'cl-lib)) (defvar dbus-debug) @@ -648,7 +647,7 @@ If there is no such item, return nil." (let ((item-path (secrets-item-path collection item))) (unless (secrets-empty-path item-path) (dbus-byte-array-to-string - (caddr + (cl-caddr (dbus-call-method :session secrets-service item-path secrets-interface-item "GetSecret" :object-path secrets-session-path)))))) diff --git a/lisp/net/snmp-mode.el b/lisp/net/snmp-mode.el index d3e5759d2fb..c155d53b6d0 100644 --- a/lisp/net/snmp-mode.el +++ b/lisp/net/snmp-mode.el @@ -85,7 +85,6 @@ ;;; Code: (eval-when-compile - (require 'cl) (require 'imenu) ; Need this stuff when compiling for imenu macros, etc. (require 'tempo)) diff --git a/lisp/net/xesam.el b/lisp/net/xesam.el index 82922e61084..585e5eed52d 100644 --- a/lisp/net/xesam.el +++ b/lisp/net/xesam.el @@ -129,10 +129,6 @@ (require 'dbus) -;; Pacify byte compiler. -(eval-when-compile - (require 'cl)) - ;; Widgets are used to highlight the search results. (require 'widget) (require 'wid-edit) @@ -409,24 +405,24 @@ If there is no registered search engine at all, the function returns `nil'." ;; That is not the case now, so we set it ourselves. ;; Hopefully, this will change later. (setq hit-fields - (case (intern vendor-id) - (Beagle + (pcase (intern vendor-id) + (`Beagle '("xesam:mimeType" "xesam:url")) - (Strigi + (`Strigi '("xesam:author" "xesam:cc" "xesam:charset" "xesam:contentType" "xesam:fileExtension" "xesam:id" "xesam:lineCount" "xesam:links" "xesam:mimeType" "xesam:name" "xesam:size" "xesam:sourceModified" "xesam:subject" "xesam:to" "xesam:url")) - (TrackerXesamSession + (`TrackerXesamSession '("xesam:relevancyRating" "xesam:url")) - (Debbugs + (`Debbugs '("xesam:keyword" "xesam:owner" "xesam:title" "xesam:url" "xesam:sourceModified" "xesam:mimeType" "debbugs:key")) ;; xesam-tools yahoo service. - (t '("xesam:contentModified" "xesam:mimeType" "xesam:summary" + (_ '("xesam:contentModified" "xesam:mimeType" "xesam:summary" "xesam:title" "xesam:url" "yahoo:displayUrl")))) (xesam-set-property engine "hit.fields" hit-fields) diff --git a/lisp/net/zeroconf.el b/lisp/net/zeroconf.el index d7330665a5a..6a1a009410b 100644 --- a/lisp/net/zeroconf.el +++ b/lisp/net/zeroconf.el @@ -102,9 +102,6 @@ ;; Pacify byte-compiler. D-Bus support in the Emacs core can be ;; disabled with configuration option "--without-dbus". Declare used ;; subroutines and variables of `dbus' therefore. -(eval-when-compile - (require 'cl)) - (defvar dbus-debug) (require 'dbus) @@ -546,7 +543,7 @@ DOMAIN is nil, the local domain is used." ((string-equal (dbus-event-member-name last-input-event) "ItemNew") ;; Parameters: (interface protocol type domain flags) ;; Register a service browser. - (let ((object-path (zeroconf-register-service-browser (nth-value 2 val)))) + (let ((object-path (zeroconf-register-service-browser (nth 2 val)))) ;; Register the signals. (dolist (member '("ItemNew" "ItemRemove" "Failure")) (dbus-register-signal |