[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] scratch/org-contacts-rebased b2837af 109/118: simplify logic, re
From: |
Stefan Monnier |
Subject: |
[elpa] scratch/org-contacts-rebased b2837af 109/118: simplify logic, remove unused variables, switch to lexical binding |
Date: |
Fri, 12 Nov 2021 15:37:14 -0500 (EST) |
branch: scratch/org-contacts-rebased
commit b2837af5138381f8c22f026321f09d9d5cef64df
Author: Morgan Smith <Morgan.J.Smith@outlook.com>
Commit: Stefan Monnier <monnier@iro.umontreal.ca>
simplify logic, remove unused variables, switch to lexical binding
---
org-contacts.el | 44 +++++++++++++++++++-------------------------
1 file changed, 19 insertions(+), 25 deletions(-)
diff --git a/org-contacts.el b/org-contacts.el
index 4e4587a..4c34cdd 100644
--- a/org-contacts.el
+++ b/org-contacts.el
@@ -1,4 +1,4 @@
-;;; org-contacts.el --- Contacts management
+;;; org-contacts.el --- Contacts management -*- lexical-binding: t; -*-
;; Copyright (C) 2010-2014 Julien Danjou <julien@danjou.info>
@@ -247,16 +247,16 @@ A regexp matching strings of whitespace, `,' and `;'.")
(org-contacts-files))
(org-contacts-db-has-dead-markers-p org-contacts-db)))
-(defun org-contacts-db-has-dead-markers-p (org-contacts-db)
- "Returns t if at least one dead marker is found in
-ORG-CONTACTS-DB. A dead marker in this case is a marker pointing
-to dead or no buffer."
+(defun org-contacts-db-has-dead-markers-p (db)
+ "Return t if at least one dead marker is found in DB.
+A dead marker in this case is a marker pointing to dead or no
+buffer."
;; Scan contacts list looking for dead markers, and return t at first
found.
(catch 'dead-marker-found
- (while org-contacts-db
- (unless (marker-buffer (nth 1 (car org-contacts-db)))
+ (while db
+ (unless (marker-buffer (nth 1 (car db)))
(throw 'dead-marker-found t))
- (setq org-contacts-db (cdr org-contacts-db)))
+ (setq db (cdr db)))
nil))
(defun org-contacts-db ()
@@ -460,9 +460,7 @@ prefixes rather than just the beginning of the string."
((eq flag 'lambda)
(org-contacts-test-completion-prefix string collection predicate))
((and (listp flag) (eq (car flag) 'boundaries))
- (cl-destructuring-bind (to-ignore &rest suffix)
- flag
- (org-contacts-boundaries-prefix string collection predicate
suffix)))
+ (org-contacts-boundaries-prefix string collection predicate (cdr
flag)))
((eq flag 'metadata)
(org-contacts-metadata-prefix string collection predicate))
(t nil ; operation unsupported
@@ -569,16 +567,15 @@ description."
(cdr
(assoc-string org-contacts-email-property
(cl-caddr contact)))
"")))
""))
- for tags = (cdr (assoc "TAGS" (nth 2 contact)))
- for tags-list = (if tags
- (split-string (substring (cdr (assoc
"TAGS" (nth 2 contact))) 1 -1) ":")
- '())
+ ;; for tags = (cdr (assoc "TAGS" (nth 2 contact)))
+ ;; for tags-list = (if tags
+ ;; (split-string (substring (cdr (assoc "TAGS"
(nth 2 contact))) 1 -1) ":")
+ ;; '())
for marker = (nth 1 contact)
if (with-current-buffer (marker-buffer marker)
(save-excursion
(goto-char marker)
- (let (todo-only)
- (eval (cdr (org-make-tags-matcher (cl-subseq
string 1)))))))
+ (eval (cdr (org-make-tags-matcher (cl-subseq
string 1))))))
collect (org-contacts-format-email contact-name email))
",")))
(when (not (string= "" result))
@@ -687,8 +684,7 @@ Format is a string matching the following format
specification:
%l - Link to the heading
%y - Number of year
%Y - Number of year (ordinal)"
- (let ((calendar-date-style 'american)
- (entry ""))
+ (let ((calendar-date-style 'american))
(unless format (setq format org-contacts-birthday-format))
(cl-loop for contact in (org-contacts-filter)
for anniv = (let ((anniv (cdr (assoc-string
@@ -912,8 +908,7 @@ address."
(create-image image-data)))))
;; Next, try Gravatar
(when org-contacts-icon-use-gravatar
- (let* ((gravatar-size org-contacts-icon-size)
- (email-list (org-entry-get pom org-contacts-email-property))
+ (let* ((email-list (org-entry-get pom org-contacts-email-property))
(gravatar
(when email-list
(cl-loop for email in (org-contacts-split-property email-list)
@@ -1166,10 +1161,9 @@ are effectively trimmed). If nil, all zero-length
substrings are retained."
:type "org-contact"
:link headline-str
:description headline-str)
- (setq desc headline-str)
- (setq link (concat "org-contact:" headline-str))
- (org-add-link-props :link link :description desc)
- link))))
+ (let ((link (concat "org-contact:" headline-str)))
+ (org-link-add-props :link link :description headline-str)
+ link)))))
(defun org-contacts--all-contacts ()
"Return an alist (name . (file . position)) of all contacts in
`org-contacts-files'."
- [elpa] scratch/org-contacts-rebased a603ab3 099/118: org-contacts.el: replace obsolete alias `loop' with `cl-loop', (continued)
- [elpa] scratch/org-contacts-rebased a603ab3 099/118: org-contacts.el: replace obsolete alias `loop' with `cl-loop', Stefan Monnier, 2021/11/12
- [elpa] scratch/org-contacts-rebased 38f7b80 100/118: org-contacts.el: Only use org-id-store-link if org-id is loaded, Stefan Monnier, 2021/11/12
- [elpa] scratch/org-contacts-rebased 3d068b7 104/118: org-contacts.el: Display contacts buffer result., Stefan Monnier, 2021/11/12
- [elpa] scratch/org-contacts-rebased fd660ce 111/118: Tidy up whitespace, Stefan Monnier, 2021/11/12
- [elpa] scratch/org-contacts-rebased 7b87e73 106/118: Prefer HTTPS to HTTP in most links, Stefan Monnier, 2021/11/12
- [elpa] scratch/org-contacts-rebased 03dc64d 110/118: Change how completion is done, Stefan Monnier, 2021/11/12
- [elpa] scratch/org-contacts-rebased 18ba907 114/118: Try to support different type of AVATAR property., Stefan Monnier, 2021/11/12
- [elpa] scratch/org-contacts-rebased 45bc95a 083/118: org-contacts: Fix org-contacts-matcher for BIRTHDAYs, Stefan Monnier, 2021/11/12
- [elpa] scratch/org-contacts-rebased 49dd482 089/118: Use `string-match-p' instead of `org-string-match-p', Stefan Monnier, 2021/11/12
- [elpa] scratch/org-contacts-rebased 124cc7a 098/118: org-contacts.el: Add usage comments, Stefan Monnier, 2021/11/12
- [elpa] scratch/org-contacts-rebased b2837af 109/118: simplify logic, remove unused variables, switch to lexical binding,
Stefan Monnier <=
- [elpa] scratch/org-contacts-rebased 5174678 116/118: Fix AVATAR property value not exist problem, Stefan Monnier, 2021/11/12
- [elpa] scratch/org-contacts-rebased 1be8aa9 069/118: Merge branch 'maint', Stefan Monnier, 2021/11/12
- [elpa] scratch/org-contacts-rebased 9c233be 070/118: Revert "Update copyright years.", Stefan Monnier, 2021/11/12
- [elpa] scratch/org-contacts-rebased fc25530 074/118: contrib/lisp/org-contacts.el: Add a hook to allow users to plug completion functions, Stefan Monnier, 2021/11/12
- [elpa] scratch/org-contacts-rebased d3509e4 076/118: contrib/lisp/org-contacts.el: Complete contacts using tags and properties, Stefan Monnier, 2021/11/12
- [elpa] scratch/org-contacts-rebased 6bcb093 079/118: contrib: Fix error messages., Stefan Monnier, 2021/11/12
- [elpa] scratch/org-contacts-rebased 44968ec 084/118: Make `org-make-tags-matcher' lexical binding friendly, Stefan Monnier, 2021/11/12
- [elpa] scratch/org-contacts-rebased 034be20 093/118: org-contacts.el: Add new link type "contact:", Stefan Monnier, 2021/11/12
- [elpa] scratch/org-contacts-rebased 7161351 094/118: contrib/lisp/org-contacts.el: Add stardiviner as the maintainer, Stefan Monnier, 2021/11/12
- [elpa] scratch/org-contacts-rebased 3beb906 057/118: org-contacts: Use progress-reporter for cache update message, Stefan Monnier, 2021/11/12