1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-06 06:20:55 -08:00

Don't quote lambdas in net/*.el

* lisp/net/eudc-export.el (eudc-create-bbdb-record):
* lisp/net/eudc.el (eudc-print-attribute-value)
(eudc-display-records, eudc-process-form)
(eudc-filter-duplicate-attributes, eudc-filter-partial-records)
(eudc-add-field-to-records, eudc-query-with-words)
(eudc-query-form, eudc-menu):
* lisp/net/eudcb-bbdb.el (eudc-bbdb-extract-phones)
(eudc-bbdb-query-internal):
* lisp/net/mairix.el (mairix-widget-make-query-from-widgets)
(mairix-widget-build-editable-fields, mairix-widget-get-values):
Don't quote lambdas.
This commit is contained in:
Stefan Kangas 2020-11-16 18:52:42 +01:00
parent f0f2c8563b
commit 9191c82f6d
4 changed files with 176 additions and 198 deletions

View file

@ -78,12 +78,11 @@ If SILENT is non-nil then the created BBDB record is not displayed."
record t)))
;; BBDB custom fields
(setq bbdb-notes (append (list (and bbdb-notes (cons 'notes bbdb-notes)))
(mapcar (function
(lambda (mapping)
(mapcar (lambda (mapping)
(if (and (not (memq (car mapping)
'(name company net address phone notes)))
(setq value (eudc-parse-spec (cdr mapping) record nil)))
(cons (car mapping) value))))
(cons (car mapping) value)))
conversion-alist)))
(setq bbdb-notes (delq nil bbdb-notes))
(setq bbdb-record (bbdb-create-internal

View file

@ -414,10 +414,9 @@ if any, is called to print the value in cdr of FIELD."
(eval (list (cdr match) val))
(insert "\n"))
(mapc
(function
(lambda (val-elem)
(indent-to col)
(insert val-elem "\n")))
(insert val-elem "\n"))
(cond
((listp val) val)
((stringp val) (split-string val "\n"))
@ -464,10 +463,8 @@ otherwise they are formatted according to `eudc-user-attribute-names-alist'."
;; Replace field names with user names, compute max width
(setq precords
(mapcar
(function
(lambda (record)
(mapcar
(function
(lambda (field)
(setq attribute-name
(if raw-attr-names
@ -475,26 +472,24 @@ otherwise they are formatted according to `eudc-user-attribute-names-alist'."
(eudc-format-attribute-name-for-display (car field))))
(if (> (length attribute-name) width)
(setq width (length attribute-name)))
(cons attribute-name (cdr field))))
record)))
(cons attribute-name (cdr field)))
record))
records))
;; Display the records
(setq first-record (point))
(mapc
(function
(lambda (record)
(setq beg (point))
;; Map over the record fields to print the attribute/value pairs
(mapc (function
(lambda (field)
(eudc-print-record-field field width)))
(mapc (lambda (field)
(eudc-print-record-field field width))
record)
;; Store the record internal format in some convenient place
(overlay-put (make-overlay beg (point))
'eudc-record
(car records))
(setq records (cdr records))
(insert "\n")))
(insert "\n"))
precords))
(insert "\n")
(widget-create 'push-button
@ -518,12 +513,11 @@ otherwise they are formatted according to `eudc-user-attribute-names-alist'."
(if (not (and (boundp 'eudc-form-widget-list)
eudc-form-widget-list))
(error "Not in a directory query form buffer")
(mapc (function
(lambda (wid-field)
(mapc (lambda (wid-field)
(setq value (widget-value (cdr wid-field)))
(if (not (string= value ""))
(setq query-alist (cons (cons (car wid-field) value)
query-alist)))))
query-alist))))
eudc-form-widget-list)
(kill-buffer (current-buffer))
(eudc-display-records (eudc-query query-alist) eudc-use-raw-directory-names))))
@ -543,16 +537,14 @@ otherwise they are formatted according to `eudc-user-attribute-names-alist'."
(if (null (cdar rec))
(list record) ; No duplicate attrs in this record
(mapc (function
(lambda (field)
(mapc (lambda (field)
(if (listp (cdr field))
(setq duplicates (cons field duplicates))
(setq unique (cons field unique)))))
(setq unique (cons field unique))))
record)
(setq result (list unique))
;; Map over the record fields that have multiple values
(mapc
(function
(lambda (field)
(let ((method (if (consp eudc-duplicate-attribute-handling-method)
(cdr
@ -585,7 +577,7 @@ otherwise they are formatted according to `eudc-user-attribute-names-alist'."
result)))
((eq 'duplicate method)
(setq result
(eudc-distribute-field-on-records field result)))))))
(eudc-distribute-field-on-records field result))))))
duplicates)
result)))
@ -593,19 +585,17 @@ otherwise they are formatted according to `eudc-user-attribute-names-alist'."
"Eliminate records that do not contain all ATTRS from RECORDS."
(delq nil
(mapcar
(function
(lambda (rec)
(if (cl-every (lambda (attr)
(consp (assq attr rec)))
attrs)
rec)))
rec))
records)))
(defun eudc-add-field-to-records (field records)
"Add FIELD to each individual record in RECORDS and return the resulting list."
(mapcar (function
(lambda (r)
(cons field r)))
(mapcar (lambda (r)
(cons field r))
records))
(defun eudc-distribute-field-on-records (field records)
@ -886,10 +876,9 @@ see `eudc-inline-expansion-servers'."
(let ((response-string
(apply #'format
(car eudc-inline-expansion-format)
(mapcar (function
(lambda (field)
(mapcar (lambda (field)
(or (cdr (assq field r))
"")))
""))
(eudc-translate-attribute-list
(cdr eudc-inline-expansion-format))))))
(if (> (length response-string) 0)
@ -929,16 +918,14 @@ queries the server for the existing fields and displays a corresponding form."
;; Build the list of prompts
(setq prompts (if eudc-use-raw-directory-names
(mapcar #'symbol-name (eudc-translate-attribute-list fields))
(mapcar (function
(lambda (field)
(mapcar (lambda (field)
(or (cdr (assq field eudc-user-attribute-names-alist))
(capitalize (symbol-name field)))))
(capitalize (symbol-name field))))
fields)))
;; Loop over prompt strings to find the longest one
(mapc (function
(lambda (prompt)
(mapc (lambda (prompt)
(if (> (length prompt) width)
(setq width (length prompt)))))
(setq width (length prompt))))
prompts)
;; Insert the first widget out of the mapcar to leave the cursor
;; in the first field
@ -949,14 +936,13 @@ queries the server for the existing fields and displays a corresponding form."
eudc-form-widget-list))
(setq fields (cdr fields))
(setq prompts (cdr prompts))
(mapc (function
(lambda (field)
(mapc (lambda (field)
(widget-insert "\n\n" (format (concat "%" (int-to-string width) "s: ") (car prompts)))
(setq widget (widget-create 'editable-field
:size 15))
(setq eudc-form-widget-list (cons (cons field widget)
eudc-form-widget-list))
(setq prompts (cdr prompts))))
(setq prompts (cdr prompts)))
fields)
(widget-insert "\n\n")
(widget-create 'push-button
@ -1118,7 +1104,6 @@ queries the server for the existing fields and displays a corresponding form."
(append
'("Server")
(mapcar
(function
(lambda (servspec)
(let* ((server (car servspec))
(protocol (cdr servspec))
@ -1138,7 +1123,7 @@ queries the server for the existing fields and displays a corresponding form."
(vector (format "%s (%s)" server proto-name)
command
:style 'radio
:selected `(equal eudc-server ,server)))))
:selected `(equal eudc-server ,server))))
eudc-server-hotlist)
eudc-server-menu))
eudc-tail-menu)))

View file

@ -137,8 +137,7 @@ BBDB < 3 used `net'; BBDB >= 3 uses `mail'."
(defun eudc-bbdb-extract-phones (record)
(require 'bbdb)
(mapcar (function
(lambda (phone)
(mapcar (lambda (phone)
(if eudc-bbdb-use-locations-as-attribute-names
(cons (intern (if (eudc--using-bbdb-3-or-newer-p)
(bbdb-phone-label phone)
@ -148,7 +147,7 @@ BBDB < 3 used `net'; BBDB >= 3 uses `mail'."
(if (eudc--using-bbdb-3-or-newer-p)
(bbdb-phone-label phone)
(bbdb-phone-location phone))
(bbdb-phone-string phone))))))
(bbdb-phone-string phone)))))
(if (eudc--using-bbdb-3-or-newer-p)
(bbdb-record-phone record)
(bbdb-record-phones record))))
@ -243,17 +242,15 @@ RETURN-ATTRS is a list of attributes to return, defaulting to
(if (car query-attrs)
(setq records (eval `(bbdb-search ,(quote records) ,@bbdb-attrs))))
(setq query-attrs (cdr query-attrs)))
(mapc (function
(lambda (record)
(mapc (lambda (record)
(setq filtered (eudc-filter-duplicate-attributes record))
;; If there were duplicate attributes reverse the order of the
;; record so the unique attributes appear first
(if (> (length filtered) 1)
(setq filtered (mapcar (function
(lambda (rec)
(reverse rec)))
(setq filtered (mapcar (lambda (rec)
(reverse rec))
filtered)))
(setq result (append result filtered))))
(setq result (append result filtered)))
(delq nil
(mapcar 'eudc-bbdb-format-record-as-result
(delq nil

View file

@ -631,14 +631,13 @@ See %s for details" mairix-output-buffer)))
(when (member 'flags mairix-widget-other)
(setq flag
(mapconcat
(function
(lambda (flag)
(setq temp
(widget-value (cadr (assoc (car flag) mairix-widgets))))
(if (string= "yes" temp)
(cadr flag)
(if (string= "no" temp)
(concat "-" (cadr flag))))))
(concat "-" (cadr flag)))))
'(("seen" "s") ("replied" "r") ("flagged" "f")) ""))
(when (not (zerop (length flag)))
(push (concat "F:" flag) query)))
@ -694,7 +693,6 @@ Fill in VALUES if based on an article."
VALUES may contain values for editable fields from current article."
(let ((ret))
(mapc
(function
(lambda (field)
(setq field (car (cddr field)))
(setq
@ -721,7 +719,7 @@ VALUES may contain values for editable fields from current article."
ret))
(widget-insert "\n")
;; Deactivate editable field
(widget-apply (cadr (nth 1 ret)) :deactivate)))
(widget-apply (cadr (nth 1 ret)) :deactivate))
mairix-widget-fields-list)
ret))
@ -936,13 +934,12 @@ Use cursor keys or C-n,C-p to select next/previous search.\n\n")
(save-excursion
(save-restriction
(mapcar
(function
(lambda (field)
(list (car (cddr field))
(if (car field)
(mairix-replace-invalid-chars
(funcall get-mail-header (car field)))
nil))))
nil)))
mairix-widget-fields-list)))
(error "No function for obtaining mail header specified"))))