Code cleanup: use (org-mode-p) when possible.

This commit is contained in:
Bastien Guerry 2011-02-15 05:18:22 +01:00
parent a923f528cd
commit 846a2d13d3
4 changed files with 11 additions and 11 deletions

View File

@ -614,12 +614,12 @@ This means, between the beginning of line and the point."
(beginning-of-line)) (beginning-of-line))
(defadvice dnd-insert-text (around org-mouse-dnd-insert-text activate) (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) (org-mouse-insert-item text)
ad-do-it)) ad-do-it))
(defadvice dnd-open-file (around org-mouse-dnd-open-file activate) (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) (org-mouse-insert-item uri)
ad-do-it)) ad-do-it))

View File

@ -394,7 +394,7 @@ the fragment in the Org-mode buffer."
(case-fold-search t) (case-fold-search t)
(msg (substitute-command-keys (msg (substitute-command-keys
"Edit, then exit with C-c ' (C-c and single quote)")) "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)) (beg (make-marker))
(end (make-marker)) (end (make-marker))
(preserve-indentation org-src-preserve-indentation) (preserve-indentation org-src-preserve-indentation)

View File

@ -368,7 +368,7 @@ replace any running timer."
(org-show-entry) (org-show-entry)
(or (ignore-errors (org-get-heading)) (or (ignore-errors (org-get-heading))
(concat "File:" (file-name-nondirectory (buffer-file-name))))))) (concat "File:" (file-name-nondirectory (buffer-file-name)))))))
((eq major-mode 'org-mode) ((org-mode-p)
(or (ignore-errors (org-get-heading)) (or (ignore-errors (org-get-heading))
(concat "File:" (file-name-nondirectory (buffer-file-name))))) (concat "File:" (file-name-nondirectory (buffer-file-name)))))
(t (error "Not in an Org buffer")))) (t (error "Not in an Org buffer"))))

View File

@ -6262,7 +6262,7 @@ open and agenda-wise Org files."
(let ((files (mapcar 'expand-file-name (org-agenda-files)))) (let ((files (mapcar 'expand-file-name (org-agenda-files))))
(dolist (buf (buffer-list)) (dolist (buf (buffer-list))
(with-current-buffer buf (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)))) (let ((file (expand-file-name (buffer-file-name))))
(unless (member file files) (unless (member file files)
(push file files)))))) (push file files))))))
@ -15516,17 +15516,17 @@ If EXCLUDE-TMP is non-nil, ignore temporary buffers."
(filter (filter
(cond (cond
((eq predicate 'files) ((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) ((eq predicate 'export)
(lambda (b) (string-match "\*Org .*Export" (buffer-name b)))) (lambda (b) (string-match "\*Org .*Export" (buffer-name b))))
((eq predicate 'agenda) ((eq predicate 'agenda)
(lambda (b) (lambda (b)
(with-current-buffer b (with-current-buffer b
(and (eq major-mode 'org-mode) (and (org-mode-p)
(setq bfn (buffer-file-name b)) (setq bfn (buffer-file-name b))
(member (file-truename bfn) agenda-files))))) (member (file-truename bfn) agenda-files)))))
(t (lambda (b) (with-current-buffer b (t (lambda (b) (with-current-buffer b
(or (eq major-mode 'org-mode) (or (org-mode-p)
(string-match "\*Org .*Export" (string-match "\*Org .*Export"
(buffer-name b))))))))) (buffer-name b)))))))))
(delq nil (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) (defadvice outline-end-of-subtree (around prefer-org-version activate compile)
"Use Org version in org-mode, for dramatic speed-up." "Use Org version in org-mode, for dramatic speed-up."
(if (eq major-mode 'org-mode) (if (org-mode-p)
(progn (progn
(org-end-of-subtree nil t) (org-end-of-subtree nil t)
(unless (eobp) (backward-char 1))) (unless (eobp) (backward-char 1)))
@ -19579,7 +19579,7 @@ Show the heading too, if it is currently invisible."
'(progn '(progn
(add-hook 'imenu-after-jump-hook (add-hook 'imenu-after-jump-hook
(lambda () (lambda ()
(if (eq major-mode 'org-mode) (if (org-mode-p)
(org-show-context 'org-goto)))))) (org-show-context 'org-goto))))))
(defun org-link-display-format (link) (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" (eval-after-load "ecb"
'(defadvice ecb-method-clicked (after esf/org-show-context activate) '(defadvice ecb-method-clicked (after esf/org-show-context activate)
"Make hierarchy visible when jumping into location from ECB tree buffer." "Make hierarchy visible when jumping into location from ECB tree buffer."
(if (eq major-mode 'org-mode) (if (org-mode-p)
(org-show-context)))) (org-show-context))))
(defun org-bookmark-jump-unhide () (defun org-bookmark-jump-unhide ()