From 846a2d13d33718f08ca281aef50ca7289980eef8 Mon Sep 17 00:00:00 2001 From: Bastien Guerry Date: Tue, 15 Feb 2011 05:18:22 +0100 Subject: [PATCH] Code cleanup: use (org-mode-p) when possible. --- lisp/org-mouse.el | 4 ++-- lisp/org-src.el | 2 +- lisp/org-timer.el | 2 +- lisp/org.el | 14 +++++++------- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/lisp/org-mouse.el b/lisp/org-mouse.el index d1540c3f3..ef0de24bd 100644 --- a/lisp/org-mouse.el +++ b/lisp/org-mouse.el @@ -614,12 +614,12 @@ This means, between the beginning of line and the point." (beginning-of-line)) (defadvice dnd-insert-text (around org-mouse-dnd-insert-text activate) - (if (eq major-mode 'org-mode) + (if (org-mode-p) (org-mouse-insert-item text) ad-do-it)) (defadvice dnd-open-file (around org-mouse-dnd-open-file activate) - (if (eq major-mode 'org-mode) + (if (org-mode-p) (org-mouse-insert-item uri) ad-do-it)) diff --git a/lisp/org-src.el b/lisp/org-src.el index 4dc269d7f..e97f08734 100644 --- a/lisp/org-src.el +++ b/lisp/org-src.el @@ -394,7 +394,7 @@ the fragment in the Org-mode buffer." (case-fold-search t) (msg (substitute-command-keys "Edit, then exit with C-c ' (C-c and single quote)")) - (org-mode-p (eq major-mode 'org-mode)) + (org-mode-p (org-mode-p)) (beg (make-marker)) (end (make-marker)) (preserve-indentation org-src-preserve-indentation) diff --git a/lisp/org-timer.el b/lisp/org-timer.el index 52c9afc46..908232792 100644 --- a/lisp/org-timer.el +++ b/lisp/org-timer.el @@ -368,7 +368,7 @@ replace any running timer." (org-show-entry) (or (ignore-errors (org-get-heading)) (concat "File:" (file-name-nondirectory (buffer-file-name))))))) - ((eq major-mode 'org-mode) + ((org-mode-p) (or (ignore-errors (org-get-heading)) (concat "File:" (file-name-nondirectory (buffer-file-name))))) (t (error "Not in an Org buffer")))) diff --git a/lisp/org.el b/lisp/org.el index 8168a284d..164081cde 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -6262,7 +6262,7 @@ open and agenda-wise Org files." (let ((files (mapcar 'expand-file-name (org-agenda-files)))) (dolist (buf (buffer-list)) (with-current-buffer buf - (if (and (eq major-mode 'org-mode) (buffer-file-name)) + (if (and (org-mode-p) (buffer-file-name)) (let ((file (expand-file-name (buffer-file-name)))) (unless (member file files) (push file files)))))) @@ -15516,17 +15516,17 @@ If EXCLUDE-TMP is non-nil, ignore temporary buffers." (filter (cond ((eq predicate 'files) - (lambda (b) (with-current-buffer b (eq major-mode 'org-mode)))) + (lambda (b) (with-current-buffer b (org-mode-p)))) ((eq predicate 'export) (lambda (b) (string-match "\*Org .*Export" (buffer-name b)))) ((eq predicate 'agenda) (lambda (b) (with-current-buffer b - (and (eq major-mode 'org-mode) + (and (org-mode-p) (setq bfn (buffer-file-name b)) (member (file-truename bfn) agenda-files))))) (t (lambda (b) (with-current-buffer b - (or (eq major-mode 'org-mode) + (or (org-mode-p) (string-match "\*Org .*Export" (buffer-name b))))))))) (delq nil @@ -19426,7 +19426,7 @@ If there is no such heading, return nil." (defadvice outline-end-of-subtree (around prefer-org-version activate compile) "Use Org version in org-mode, for dramatic speed-up." - (if (eq major-mode 'org-mode) + (if (org-mode-p) (progn (org-end-of-subtree nil t) (unless (eobp) (backward-char 1))) @@ -19579,7 +19579,7 @@ Show the heading too, if it is currently invisible." '(progn (add-hook 'imenu-after-jump-hook (lambda () - (if (eq major-mode 'org-mode) + (if (org-mode-p) (org-show-context 'org-goto)))))) (defun org-link-display-format (link) @@ -19683,7 +19683,7 @@ To get rid of the restriction, use \\[org-agenda-remove-restriction-lock]." (eval-after-load "ecb" '(defadvice ecb-method-clicked (after esf/org-show-context activate) "Make hierarchy visible when jumping into location from ECB tree buffer." - (if (eq major-mode 'org-mode) + (if (org-mode-p) (org-show-context)))) (defun org-bookmark-jump-unhide ()