all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#27963: [PATCH] Remove custom version parsing in epg-config.el
@ 2017-08-05  2:45 npostavs
  2017-08-18  0:56 ` npostavs
  0 siblings, 1 reply; 2+ messages in thread
From: npostavs @ 2017-08-05  2:45 UTC (permalink / raw)
  To: 27963; +Cc: Daiki Ueno

[-- Attachment #1: Type: text/plain, Size: 32 bytes --]

Severity: wishlist
Tags: patch


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: patch --]
[-- Type: text/x-diff, Size: 2212 bytes --]

From 9415fb046b260cfdb1f87aa396f652d916abd71e Mon Sep 17 00:00:00 2001
From: Noam Postavsky <npostavs@gmail.com>
Date: Sat, 22 Jul 2017 23:54:34 -0400
Subject: [PATCH] Remove custom version parsing functions from epg-config.el

* lisp/epg-config.el (epg-config--compare-version)
(epg-config--parse-version): Remove.
(epg-check-configuration): Use `version<=' instead.
---
 lisp/epg-config.el | 32 +++++++-------------------------
 1 file changed, 7 insertions(+), 25 deletions(-)

diff --git a/lisp/epg-config.el b/lisp/epg-config.el
index 7b963add88..6aed354ca4 100644
--- a/lisp/epg-config.el
+++ b/lisp/epg-config.el
@@ -210,34 +210,16 @@ (defun epg-configuration ()
   (declare (obsolete epg-find-configuration "25.1"))
   (epg-config--make-gpg-configuration epg-gpg-program))
 
-(defun epg-config--parse-version (string)
-  (let ((index 0)
-	version)
-    (while (eq index (string-match "\\([0-9]+\\)\\.?" string index))
-      (setq version (cons (string-to-number (match-string 1 string))
-			  version)
-	    index (match-end 0)))
-    (nreverse version)))
-
-(defun epg-config--compare-version (v1 v2)
-  (while (and v1 v2 (= (car v1) (car v2)))
-    (setq v1 (cdr v1) v2 (cdr v2)))
-  (- (or (car v1) 0) (or (car v2) 0)))
-
 ;;;###autoload
 (defun epg-check-configuration (config &optional minimum-version)
   "Verify that a sufficient version of GnuPG is installed."
-  (let ((entry (assq 'version config))
-	version)
-    (unless (and entry
-		 (stringp (cdr entry)))
-      (error "Undetermined version: %S" entry))
-    (setq version (epg-config--parse-version (cdr entry))
-	  minimum-version (epg-config--parse-version
-			   (or minimum-version
-			       epg-gpg-minimum-version)))
-    (unless (>= (epg-config--compare-version version minimum-version) 0)
-      (error "Unsupported version: %s" (cdr entry)))))
+  (let ((version (alist-get 'version config)))
+    (unless (stringp version)
+      (error "Undetermined version: %S" version))
+    (unless (version<= (or minimum-version
+                           epg-gpg-minimum-version)
+                       version)
+      (error "Unsupported version: %s" version))))
 
 ;;;###autoload
 (defun epg-expand-group (config group)
-- 
2.11.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-08-18  0:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-08-05  2:45 bug#27963: [PATCH] Remove custom version parsing in epg-config.el npostavs
2017-08-18  0:56 ` npostavs

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.