all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: emacs-devel@gnu.org
Subject: Re: [ELPA] Package proposal: EBDB
Date: Mon, 14 Aug 2017 19:15:54 -0400	[thread overview]
Message-ID: <jwvmv71kayo.fsf-monnier+gmane.emacs.devel@gnu.org> (raw)
In-Reply-To: 87mv722l8s.fsf@ericabrahamsen.net

> Aha! Thank you, that's what I was missing. It seems to have worked, I
> guess I'll know for sure when the package gets built.

I just noticed the following issues:
- You use oset-default on instance fields.  This used to work in earlier
  EIEIO and still mostly work now thanks to a hack, but it creates
  a weird/adhoc semantics in terms of interaction with the :initform, so
  I'd like to get rid of this backward compatibility.
- ebdb-vm and ebdb-mu4e will break the compilation of the package if the
  user doesn't have VM and mu4e installed.

The appended patch tries to fix those two, but please take a look at it
to make sure it still works correctly (especially the ebdb-vm part is
quick&dirty, leaving a lot of warnings when VM is not installed, some
of them may be real bugs).

> Assuming all goes well, can I push this documentation patch to ELPA?

Yes, please do, thank you,


        Stefan


diff --git a/.gitignore b/.gitignore
new file mode 100644
index 000000000..f56da6eb7
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,4 @@
+*.elc
+ebdb-autoloads.el
+ebdb-pkg.el
+
diff --git a/ebdb-format.el b/ebdb-format.el
index cd8ccc5ae..46726e15f 100644
--- a/ebdb-format.el
+++ b/ebdb-format.el
@@ -40,7 +40,8 @@
    (coding-system
     :type symbol
     :initarg :coding-system
-    :initform nil
+    ;; "`," is used to trick EIEIO into evaluating the form.
+    :initform `,buffer-file-coding-system
     :documentation "The coding system for the formatted
     file/buffer/stream.")
    ;; TODO: Provide for "psuedo field classes" like 'primary-mail and
@@ -93,8 +94,6 @@
   :documentation "Abstract base class for EBDB formatters.
   Subclass this to produce real formatters.")
 
-(eieio-oset-default 'ebdb-formatter 'coding-system buffer-file-coding-system)
-
 (cl-defmethod ebdb-string ((fmt ebdb-formatter))
   (slot-value fmt 'object-name))
 
diff --git a/ebdb-mu4e.el b/ebdb-mu4e.el
index 2e4ee5e20..8d0798391 100644
--- a/ebdb-mu4e.el
+++ b/ebdb-mu4e.el
@@ -25,9 +25,11 @@
 ;;; Code:
 
 (require 'ebdb-mua)
-(require 'mu4e-view)
+(if t (require 'mu4e-view)) ;;Dummy test to `require' only at runtime.
 
 ;; Tackle `mu4e-headers-mode' later
+(defvar mu4e~view-buffer-name)
+(defvar mu4e-view-mode-map)
 
 (cl-defmethod ebdb-mua-message-header ((header string)
 				   &context (major-mode mu4e-view-mode))
@@ -45,7 +47,7 @@
 
 ;; Why wasn't `ebdb-mua-auto-update' ever hooked in to mu4e?
 
-(add-hook 'mu4e-main-mode-hook 'ebdb-insinuate-mu4e)
+(add-hook 'mu4e-main-mode-hook #'ebdb-insinuate-mu4e)
 
 (provide 'ebdb-mu4e)
 ;;; ebdb-mu4e.el ends here
diff --git a/ebdb-vm.el b/ebdb-vm.el
index 27f5f4c69..00766e10b 100644
--- a/ebdb-vm.el
+++ b/ebdb-vm.el
@@ -25,6 +25,7 @@
 
 (require 'ebdb-com)
 (require 'ebdb-mua)
+(when t ;;Dummy test to `require' only at runtime.
 (require 'vm-autoloads)
 (require 'vm)
 (require 'vm-motion)
@@ -33,7 +34,7 @@
 (require 'vm-vars)
 (require 'vm-macro)
 (require 'vm-message)
-(require 'vm-misc)
+(require 'vm-misc))
 
 (defgroup ebdb-mua-vm nil
   "VM-specific EBDB customizations"
@@ -366,9 +367,11 @@ from different senders."
             ;; the EBDB record of the sender.
             (lambda (m) (ebdb-mua-summary-mark (vm-su-from m))))))
 
+;; FIXME: `vm' is required earlier, so (eval-after-load "vm" ...) doesn't make
+;; much sense at this point.
 (eval-after-load "vm" '(ebdb-insinuate-vm))
 
-(add-hook 'vm-select-message-hook 'ebdb-mua-auto-update)
+(add-hook 'vm-select-message-hook #'ebdb-mua-auto-update)
 
 (provide 'ebdb-vm)
 ;;; ebdb-vm.el ends here
diff --git a/ebdb.el b/ebdb.el
index 16af67494..1daaf8623 100644
--- a/ebdb.el
+++ b/ebdb.el
@@ -2056,11 +2056,11 @@ Eventually this method will go away."
 (defclass ebdb-field-image (ebdb-field)
   ((image
     :type (or null string symbol)
-    :initarg :image))
+    :initarg :image
+    ;; "`," is used to trick EIEIO into evaluating the form.
+    :initform `,ebdb-image))
   :human-readable "image")
 
-(eieio-oset-default 'ebdb-field-image 'image ebdb-image)
-
 (cl-defmethod ebdb-read ((image (subclass ebdb-field-image)) &optional slots obj)
   (let ((existing (when obj (slot-value obj 'image)))
 	value)
@@ -3378,7 +3378,8 @@ executable.  When a symbol, assume an Elisp function."
     ;; I don't think I can actually set this to `ebdb-record': the
     ;; type needs to be a class, not an instance.  Can I do that?
     :type symbol
-    :initform nil
+    ;; "`," is used to trick EIEIO into evaluating the form.
+    :initform `,ebdb-default-record-class
     :custom symbol
     :documentation
     "The default EIEIO class for records in this database.  Must
@@ -3389,11 +3390,6 @@ not be instantiated directly, subclass it instead."
   :allow-nil-initform t
   :abstract t)
 
-;; I was told not to use this in Gnus, but I don't remember why.  I
-;; suspect it was backward compatibility, and that's obviously already
-;; out the window.
-(oset-default 'ebdb-db record-class ebdb-default-record-class)
-
 (cl-defmethod initialize-instance ((db ebdb-db) &optional slots)
   "Make sure DB has a uuid."
   (unless (and (slot-boundp db 'uuid)






  reply	other threads:[~2017-08-14 23:15 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-30 19:18 [ELPA] Package proposal: EBDB Eric Abrahamsen
2017-07-31  0:49 ` Richard Stallman
2017-07-31  3:10   ` Eli Zaretskii
2017-07-31  3:12   ` Eric Abrahamsen
2017-07-31  3:28     ` Eli Zaretskii
2017-07-31  3:30       ` Eric Abrahamsen
2017-08-09 21:17   ` Eric Abrahamsen
2017-08-13  1:03     ` Eric Abrahamsen
2017-08-13 21:47       ` Stefan Monnier
2017-08-14  1:44         ` Eric Abrahamsen
2017-08-14  9:45           ` Stefan Monnier
2017-08-14 15:59             ` Eric Abrahamsen
2017-08-14 23:15               ` Stefan Monnier [this message]
2017-08-14 23:50                 ` Eric Abrahamsen
2017-08-15  7:49                   ` Stefan Monnier
2017-08-15 15:30                     ` Eric Abrahamsen
2017-08-17 16:57                       ` Eric Abrahamsen
2017-08-17 22:21                         ` Stefan Monnier
2017-08-17 22:52                           ` Eric Abrahamsen
2017-08-17 23:27                             ` Stefan Monnier
2017-08-17 23:31                               ` Eric Abrahamsen
2017-08-01  5:33 ` John Wiegley
2017-08-01 16:04   ` Eric Abrahamsen
2017-08-01 22:25     ` John Wiegley
2017-08-01 23:52       ` Eric Abrahamsen
2017-08-02  1:28         ` John Wiegley
2017-08-02  3:08           ` Eric Abrahamsen
2017-08-01  5:58 ` Stefan Monnier
  -- strict thread matches above, loose matches on Subject: below --
2017-08-06 22:12 Roland Winkler
2017-08-07  0:44 ` Eric Abrahamsen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=jwvmv71kayo.fsf-monnier+gmane.emacs.devel@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.