branch: externals/ebdb commit 46b434a8d7889561984bf40253851ae69781594b Author: Eric Abrahamsen <e...@ericabrahamsen.net> Commit: Eric Abrahamsen <e...@ericabrahamsen.net>
Use lisp-data-mode for db files, if it exists * ebdb.el (ebdb-load): Refactor out a db file regexp, use it for setting `lisp-data-mode' in `auto-mode-alist'. --- ebdb.el | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/ebdb.el b/ebdb.el index e4a5547..ff11325 100644 --- a/ebdb.el +++ b/ebdb.el @@ -5137,7 +5137,8 @@ All the important work is done by the `ebdb-db-load' method." (let ((sources (if (listp ebdb-sources) ebdb-sources (list ebdb-sources))) - (eieio-skip-typecheck ebdb-try-speedups)) + (eieio-skip-typecheck ebdb-try-speedups) + db-file-regexp) ;; Check if we're re-loading. (when (and ebdb-db-list (object-assoc t 'dirty ebdb-db-list)) @@ -5184,15 +5185,20 @@ All the important work is done by the `ebdb-db-load' method." (message "Initializing EBDB records... done") ;; Users will expect the same ordering as `ebdb-sources' (setq ebdb-db-list (nreverse ebdb-db-list)) + (setq db-file-regexp + (regexp-opt (mapcar (lambda (db) + (slot-value db 'file)) + ebdb-db-list))) ;; If users look at the database files, they should be read as ;; utf-8-emacs. (push - (cons - (regexp-opt (mapcar (lambda (db) - (slot-value db 'file)) - ebdb-db-list)) - 'utf-8-emacs) + (cons db-file-regexp 'utf-8-emacs) auto-coding-alist) + ;; There's now a `lisp-data-mode'. + (when (fboundp 'lisp-data-mode) + (push + (cons db-file-regexp 'lisp-data-mode) + auto-mode-alist)) (run-hooks 'ebdb-after-load-hook) (when ebdb-use-diary (add-hook 'diary-list-entries-hook #'ebdb-diary-add-entries))