From: Stefan Kangas Date: Wed, 25 Oct 2023 07:25:39 +0000 (+0200) Subject: Reduce code duplication in webjump X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=71c366ba0216c0a551c9d02391d6565610019c63;p=emacs.git Reduce code duplication in webjump * lisp/net/webjump.el (webjump): Simplify. --- diff --git a/lisp/net/webjump.el b/lisp/net/webjump.el index fe7c3679876..b377d0798ed 100644 --- a/lisp/net/webjump.el +++ b/lisp/net/webjump.el @@ -1,6 +1,6 @@ ;;; webjump.el --- programmable Web hotlist -*- lexical-binding: t; -*- -;; Copyright (C) 1996-1997, 2001-2023 Free Software Foundation, Inc. +;; Copyright (C) 1996-2023 Free Software Foundation, Inc. ;; Author: Neil W. Van Dyke ;; Maintainer: emacs-devel@gnu.org @@ -262,33 +262,22 @@ Please submit bug reports and other feedback to the author, Neil W. Van Dyke (completing-read "WebJump to site: " webjump-sites nil t) webjump-sites t)) (name (car item)) - (expr (cdr item))) - (if webjump-use-internal-browser - (browse-url-with-browser-kind - 'internal (webjump-url-fix - (cond ((not expr) "") - ((stringp expr) expr) - ((vectorp expr) (webjump-builtin expr name)) - ((listp expr) (eval expr t)) - ((symbolp expr) - (if (fboundp expr) - (funcall expr name) - (error "WebJump URL function \"%s\" undefined" - expr))) - (t (error "WebJump URL expression for \"%s\" invalid" - name))))) - (browse-url (webjump-url-fix - (cond ((not expr) "") - ((stringp expr) expr) - ((vectorp expr) (webjump-builtin expr name)) - ((listp expr) (eval expr t)) - ((symbolp expr) - (if (fboundp expr) - (funcall expr name) - (error "WebJump URL function \"%s\" undefined" - expr))) - (t (error "WebJump URL expression for \"%s\" invalid" - name)))))))) + (expr (cdr item)) + (fun (if webjump-use-internal-browser + (apply-partially #'browse-url-with-browser-kind 'internal) + #'browse-url))) + (funcall fun (webjump-url-fix + (cond ((not expr) "") + ((stringp expr) expr) + ((vectorp expr) (webjump-builtin expr name)) + ((listp expr) (eval expr t)) + ((symbolp expr) + (if (fboundp expr) + (funcall expr name) + (error "WebJump URL function \"%s\" undefined" + expr))) + (t (error "WebJump URL expression for \"%s\" invalid" + name))))))) (defun webjump-builtin (expr name) (if (< (length expr) 1)