From c086ea0832b30ff8797eedb270c247043f43abaa Mon Sep 17 00:00:00 2001 From: Nicolas Goaziou Date: Wed, 27 Feb 2013 10:00:40 +0100 Subject: [PATCH 1/5] Fix infloop when user provides a wrong value for `org-highlight-latex-and-related' * lisp/org.el (org-do-latex-and-related): Fix infloop when user provides a wrong value for `org-highlight-latex-and-related'. In this case, `org-latex-and-related-regexp' is the empty string and generates an infloop since matching it doesn't move point. --- lisp/org.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lisp/org.el b/lisp/org.el index a8bccf15f..729d17e49 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -5913,7 +5913,7 @@ Result depends on variable `org-highlight-latex-and-related'." LIMIT bounds the search for syntax to highlight. Stop at first highlighted object, if any. Return t if some highlighting was done, nil otherwise." - (when org-highlight-latex-and-related + (when (org-string-nw-p org-latex-and-related-regexp) (catch 'found (while (re-search-forward org-latex-and-related-regexp limit t) (unless (memq (car-safe (get-text-property (1+ (match-beginning 0)) From 8506223b2788fa54d66db4e88d00605ddaa614d9 Mon Sep 17 00:00:00 2001 From: Nicolas Goaziou Date: Wed, 27 Feb 2013 10:36:07 +0100 Subject: [PATCH 2/5] Fix function declaration --- lisp/org.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lisp/org.el b/lisp/org.el index 729d17e49..7113b0b5d 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -18180,7 +18180,7 @@ share a good deal of logic." (delete-file (concat texfilebase e)))) pngfile)))) -(declare-function org-latex-compile "org-latex" (texfile &optional snippet)) +(declare-function org-latex-compile "ox-latex" (texfile &optional snippet)) (defun org-create-formula-image-with-imagemagick (string tofile options buffer) "This calls convert, which is included into imagemagick." (require 'ox-latex) From 0f76e8ca4261fae2ab47d1d5f869d2470861e1c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20Jadi?= Date: Mon, 25 Feb 2013 16:06:01 +0100 Subject: [PATCH 3/5] org-contacts.el: Check if the database need a refresh in a dedicated function * contrib/lisp/org-contacts.el (org-contacts-db-need-update?): New function to determine whether we need to refresh `org-contacts-db'. (org-contacts-db): Use `org-contacts-db-need-updated?'. --- contrib/lisp/org-contacts.el | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/contrib/lisp/org-contacts.el b/contrib/lisp/org-contacts.el index 3ad581d81..786650b33 100644 --- a/contrib/lisp/org-contacts.el +++ b/contrib/lisp/org-contacts.el @@ -149,19 +149,21 @@ This overrides `org-email-link-description-format' if set." "Return list of Org files to use for contact management." (or org-contacts-files (org-agenda-files t 'ifmode))) +(defun org-contacts-db-need-update? () + "Determine whether `org-contacts-db' needs to be refreshed." + (or (null org-contacts-last-update) + (some (lambda (file) + (or (time-less-p org-contacts-last-update + (elt (file-attributes file) 5)))) + (org-contacts-files)))) + (defun org-contacts-db () "Return the latest Org Contacts Database" (let* (todo-only (contacts-matcher (cdr (org-make-tags-matcher org-contacts-matcher))) - (need-update? - (or (null org-contacts-last-update) - (some (lambda (file) - (time-less-p org-contacts-last-update - (elt (file-attributes file) 5))) - (org-contacts-files)))) markers result) - (when need-update? + (when (org-contacts-db-need-update?) (message "Update Org Contacts Database") (dolist (file (org-contacts-files)) (org-check-agenda-file file) From e4cebbe40eb6ec87314267079fd672f8c5bb115d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20Jadi?= Date: Mon, 25 Feb 2013 17:19:57 +0100 Subject: [PATCH 4/5] org-contacts.el: Started to silent byte-compiler * contrib/lisp/org-contacts.el: Remove some compile-time warnings by adding the proper declarations. (org-contacts-anniversaries): Hack around an undefined variable because I wasn't able to understand how this function works. (org-contacts-wl-get-from-header-content): Check whether the variable `wl-summary-buffer-elmo-folder' is bound or not. --- contrib/lisp/org-contacts.el | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/contrib/lisp/org-contacts.el b/contrib/lisp/org-contacts.el index 786650b33..f99242c1f 100644 --- a/contrib/lisp/org-contacts.el +++ b/contrib/lisp/org-contacts.el @@ -43,6 +43,7 @@ (require 'org)) (require 'gnus-util) (require 'org-agenda) +(require 'org-capture) (defgroup org-contacts nil "Options about contacts management." @@ -132,6 +133,11 @@ This overrides `org-email-link-description-format' if set." :group 'org-contacts :type 'file) +;; Decalre external functions and variables +(declare-function wl-summary-message-number "ext:wl-summary" ()) +(declare-function wl-address-header-extract-address "ext:wl-address") +(declare-function wl-address-header-extract-realname "ext:wl-address") + (defvar org-contacts-keymap (let ((map (make-sparse-keymap))) (define-key map "M" 'org-contacts-view-send-email) @@ -501,7 +507,8 @@ Format is a string matching the following format specification: (let ((calendar-date-style 'american) (entry "")) (unless format (setq format org-contacts-birthday-format)) - (loop for contact in (org-contacts-filter) + (loop with date = nil ; FIXME: prevent a warning + for contact in (org-contacts-filter) for anniv = (let ((anniv (cdr (assoc-string (or field org-contacts-birthday-property) (caddr contact))))) @@ -647,7 +654,8 @@ Works from wl-summary-mode and mime-view-mode - that is while viewing email. Depends on Wanderlust been loaded." (with-current-buffer (org-capture-get :original-buffer) (cond - ((eq major-mode 'wl-summary-mode) (when wl-summary-buffer-elmo-folder + ((eq major-mode 'wl-summary-mode) (when (and (boundp 'wl-summary-buffer-elmo-folder) + wl-summary-buffer-elmo-folder) (elmo-message-field wl-summary-buffer-elmo-folder (wl-summary-message-number) From aecccc10d06ce28ebcd68c2278b845c427d79e9d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20Jadi?= Date: Wed, 27 Feb 2013 12:41:08 +0100 Subject: [PATCH 5/5] org-contacts.el: Let the users decide if they want to use `org-contacts' to complete mail addresses * contrib/lisp/org-contacts.el (org-contacts-enable-completion): A custom boolean variable to enable the completion with `org-contacts'. Enabled by default. --- contrib/lisp/org-contacts.el | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/contrib/lisp/org-contacts.el b/contrib/lisp/org-contacts.el index f99242c1f..867453390 100644 --- a/contrib/lisp/org-contacts.el +++ b/contrib/lisp/org-contacts.el @@ -133,6 +133,11 @@ This overrides `org-email-link-description-format' if set." :group 'org-contacts :type 'file) +(defcustom org-contacts-enable-completion t + "Enable or not the completion in `message-mode' with `org-contacts'." + :group 'org-contacts + :type 'boolean) + ;; Decalre external functions and variables (declare-function wl-summary-message-number "ext:wl-summary" ()) (declare-function wl-address-header-extract-address "ext:wl-address") @@ -642,7 +647,8 @@ This adds `org-contacts-gnus-check-mail-address' and (add-hook 'gnus-article-prepare-hook 'org-contacts-gnus-check-mail-address) (add-hook 'gnus-article-prepare-hook 'org-contacts-gnus-store-last-mail)) -(when (boundp 'completion-at-point-functions) +(when (and org-contacts-enable-completion + (boundp 'completion-at-point-functions)) (add-hook 'message-mode-hook (lambda () (add-to-list 'completion-at-point-functions