Преглед изворни кода

Merge branch 'master' of git://repo.or.cz/org-mode

Dan Davison пре 15 година
родитељ
комит
8a01f3d53a
9 измењених фајлова са 76 додато и 54 уклоњено
  1. 20 0
      lisp/ChangeLog
  2. 4 7
      lisp/org-agenda.el
  3. 5 6
      lisp/org-clock.el
  4. 3 0
      lisp/org-colview.el
  5. 9 0
      lisp/org-compat.el
  6. 3 3
      lisp/org-inlinetask.el
  7. 1 1
      lisp/org-list.el
  8. 14 16
      lisp/org-mouse.el
  9. 17 21
      lisp/org.el

+ 20 - 0
lisp/ChangeLog

@@ -1,3 +1,23 @@
+2010-04-21  Carsten Dominik  <carsten.dominik@gmail.com>
+
+	* org-src.el (org-edit-src-find-region-and-lang): Test for
+	table.el as late as possible.
+
+	* org-colview-xemacs.el: Make sure this file is never loaded into
+	Emacs.  Remove all tests for XEmacs.
+
+	* org-colview.el: Make sure this file is never loaded into XEmacs.
+
+	* org-agenda.el (org-highlight, org-unhighlight): Use direct
+	overlay calls.
+
+	* org.el (org-key): Apply the translations defined in
+	`org-xemacs-key-equivalents'.
+
+	* org-mouse.el (org-mode-hook): Use `org-defkey'.
+
+	* org-compat.el (org-xemacs-key-equivalents): New constant.
+
 2010-04-20  Carsten Dominik  <carsten.dominik@gmail.com>
 2010-04-20  Carsten Dominik  <carsten.dominik@gmail.com>
 
 
 	* org-inlinetask.el (org-inlinetask-defaut-state): New option.
 	* org-inlinetask.el (org-inlinetask-defaut-state): New option.

+ 4 - 7
lisp/org-agenda.el

@@ -1662,10 +1662,8 @@ The following commands are available:
 (org-defkey org-agenda-mode-map "\C-c\C-x\C-mg"    'org-mobile-pull)
 (org-defkey org-agenda-mode-map "\C-c\C-x\C-mg"    'org-mobile-pull)
 (org-defkey org-agenda-mode-map "\C-c\C-x\C-mp"    'org-mobile-push)
 (org-defkey org-agenda-mode-map "\C-c\C-x\C-mp"    'org-mobile-push)
 
 
-(org-defkey org-agenda-mode-map
-  (if (featurep 'xemacs) [(button2)] [(mouse-2)]) 'org-agenda-goto-mouse)
-(org-defkey org-agenda-mode-map
-  (if (featurep 'xemacs) [(button3)] [(mouse-3)]) 'org-agenda-show-mouse)
+(org-defkey org-agenda-mode-map [mouse-2] 'org-agenda-goto-mouse)
+(org-defkey org-agenda-mode-map [mouse-3] 'org-agenda-show-mouse)
 (when org-agenda-mouse-1-follows-link
 (when org-agenda-mouse-1-follows-link
   (org-defkey org-agenda-mode-map [follow-link] 'mouse-face))
   (org-defkey org-agenda-mode-map [follow-link] 'mouse-face))
 (easy-menu-define org-agenda-menu org-agenda-mode-map "Agenda menu"
 (easy-menu-define org-agenda-menu org-agenda-mode-map "Agenda menu"
@@ -5880,12 +5878,11 @@ so that the date SD will be in that range."
 
 
 (defun org-highlight (begin end &optional buffer)
 (defun org-highlight (begin end &optional buffer)
   "Highlight a region with overlay."
   "Highlight a region with overlay."
-  (funcall (if (featurep 'xemacs) 'set-extent-endpoints 'move-overlay)
-	   org-hl begin end (or buffer (current-buffer))))
+  (move-overlay org-hl begin end (or buffer (current-buffer))))
 
 
 (defun org-unhighlight ()
 (defun org-unhighlight ()
   "Detach overlay INDEX."
   "Detach overlay INDEX."
-  (funcall (if (featurep 'xemacs) 'detach-extent 'delete-overlay) org-hl))
+  (org-detach-overlay org-hl))
 
 
 ;; FIXME this is currently not used.
 ;; FIXME this is currently not used.
 (defun org-highlight-until-next-command (beg end &optional buffer)
 (defun org-highlight-until-next-command (beg end &optional buffer)

+ 5 - 6
lisp/org-clock.el

@@ -759,11 +759,10 @@ was started."
 			     (goto-char (match-end 0)))
 			     (goto-char (match-end 0)))
 			   nil))))))
 			   nil))))))
 	      (let (char-pressed)
 	      (let (char-pressed)
-		(if (featurep 'xemacs)
-		    (progn
-		      (message (concat (funcall prompt-fn clock)
-				       " [(kK)eep (sS)ubtract (C)ancel]? "))
-		      (setq char-pressed (read-char-exclusive)))
+		(when (featurep 'xemacs)
+		  (message (concat (funcall prompt-fn clock)
+				   " [(kK)eep (sS)ubtract (C)ancel]? "))
+		  (setq char-pressed (read-char-exclusive)))
 		(while (or (null char-pressed)
 		(while (or (null char-pressed)
 			   (and (not (memq char-pressed '(?k ?K ?s ?S ?C ?i)))
 			   (and (not (memq char-pressed '(?k ?K ?s ?S ?C ?i)))
 				(or (ding) t)))
 				(or (ding) t)))
@@ -771,7 +770,7 @@ was started."
 			(read-char (concat (funcall prompt-fn clock)
 			(read-char (concat (funcall prompt-fn clock)
 					   " [(kK)p (sS)ub (C)ncl (i)gn]? ")
 					   " [(kK)p (sS)ub (C)ncl (i)gn]? ")
 				   nil 45)))
 				   nil 45)))
-		(and (not (eq char-pressed ?i)) char-pressed))))))
+		(and (not (eq char-pressed ?i)) char-pressed)))))
 	 (default (floor (/ (org-float-time
 	 (default (floor (/ (org-float-time
 			     (time-subtract (current-time) last-valid)) 60)))
 			     (time-subtract (current-time) last-valid)) 60)))
 	 (keep (and (memq ch '(?k ?K))
 	 (keep (and (memq ch '(?k ?K))

+ 3 - 0
lisp/org-colview.el

@@ -36,6 +36,9 @@
 (declare-function org-agenda-redo "org-agenda" ())
 (declare-function org-agenda-redo "org-agenda" ())
 (declare-function org-agenda-do-context-action "org-agenda" ())
 (declare-function org-agenda-do-context-action "org-agenda" ())
 
 
+(when (featurep 'xemacs)
+  (error "Do not load this file into XEmacs, use 'org-colview-xemacs.el'."))
+
 ;;; Column View
 ;;; Column View
 
 
 (defvar org-columns-overlays nil
 (defvar org-columns-overlays nil

+ 9 - 0
lisp/org-compat.el

@@ -88,6 +88,15 @@ any other entries, and any resulting duplicates will be removed entirely."
 
 
 ;;;; Emacs/XEmacs compatibility
 ;;;; Emacs/XEmacs compatibility
 
 
+;; Keys
+(defconst org-xemacs-key-equivalents
+  '(([mouse-1] . [button1])
+    ([mouse-2] . [button2])
+    ([mouse-3] . [button3])
+    ([C-mouse-4] . [(control mouse-4)])
+    ([C-mouse-5] . [(control mouse-5)]))
+  "Translation alist for a couple of keys")
+
 ;; Overlay compatibility functions
 ;; Overlay compatibility functions
 (defun org-detach-overlay (ovl)
 (defun org-detach-overlay (ovl)
   (if (featurep 'xemacs) (detach-extent ovl) (delete-overlay ovl)))
   (if (featurep 'xemacs) (detach-extent ovl) (delete-overlay ovl)))

+ 3 - 3
lisp/org-inlinetask.el

@@ -110,9 +110,9 @@ When nil, they will not be exported."
 This should be the state `org-inlinetask-insert-task' should use by
 This should be the state `org-inlinetask-insert-task' should use by
 default, or nil of no state should be assigned."
 default, or nil of no state should be assigned."
   :group 'org-inlinetask
   :group 'org-inlinetask
-  :type (choice
-	 (const :tag "No state" nil)
-	 (string :tag "Specific state")))
+  :type '(choice
+	  (const :tag "No state" nil)
+	  (string :tag "Specific state")))
 
 
 (defun org-inlinetask-insert-task (&optional no-state)
 (defun org-inlinetask-insert-task (&optional no-state)
   "Insert an inline task.
   "Insert an inline task.

+ 1 - 1
lisp/org-list.el

@@ -119,7 +119,7 @@ When a string, it will be used as a regular expression.	 When the bullet
 type of a list is changed, the new bullet type will be matched against this
 type of a list is changed, the new bullet type will be matched against this
 regexp.	 If it matches, there will be two spaces instead of one after
 regexp.	 If it matches, there will be two spaces instead of one after
 the bullet in each item of he list."
 the bullet in each item of he list."
-  :group 'org-plain-list
+  :group 'org-plain-lists
   :type '(choice
   :type '(choice
 	  (const :tag "never" nil)
 	  (const :tag "never" nil)
 	  (regexp)))
 	  (regexp)))

+ 14 - 16
lisp/org-mouse.el

@@ -909,18 +909,18 @@ SCHEDULED: or DEADLINE: or ANYTHINGLIKETHIS:"
      (setq org-mouse-context-menu-function 'org-mouse-context-menu)
      (setq org-mouse-context-menu-function 'org-mouse-context-menu)
 
 
      (when (memq 'context-menu org-mouse-features)
      (when (memq 'context-menu org-mouse-features)
-       (define-key org-mouse-map (if (featurep 'xemacs) [button3] [mouse-3]) nil)
-       (define-key org-mode-map [mouse-3] 'org-mouse-show-context-menu))
-     (define-key org-mode-map [down-mouse-1] 'org-mouse-down-mouse)
+       (org-defkey org-mouse-map [mouse-3] nil)
+       (org-defkey org-mode-map [mouse-3] 'org-mouse-show-context-menu))
+     (org-defkey org-mode-map [down-mouse-1] 'org-mouse-down-mouse)
      (when (memq 'context-menu org-mouse-features)
      (when (memq 'context-menu org-mouse-features)
-       (define-key org-mouse-map [C-drag-mouse-1] 'org-mouse-move-tree)
-       (define-key org-mouse-map [C-down-mouse-1] 'org-mouse-move-tree-start))
+       (org-defkey org-mouse-map [C-drag-mouse-1] 'org-mouse-move-tree)
+       (org-defkey org-mouse-map [C-down-mouse-1] 'org-mouse-move-tree-start))
      (when (memq 'yank-link org-mouse-features)
      (when (memq 'yank-link org-mouse-features)
-       (define-key org-mode-map [S-mouse-2] 'org-mouse-yank-link)
-       (define-key org-mode-map [drag-mouse-3] 'org-mouse-yank-link))
+       (org-defkey org-mode-map [S-mouse-2] 'org-mouse-yank-link)
+       (org-defkey org-mode-map [drag-mouse-3] 'org-mouse-yank-link))
      (when (memq 'move-tree org-mouse-features)
      (when (memq 'move-tree org-mouse-features)
-       (define-key org-mouse-map [drag-mouse-3] 'org-mouse-move-tree)
-       (define-key org-mouse-map [down-mouse-3] 'org-mouse-move-tree-start))
+       (org-defkey org-mouse-map [drag-mouse-3] 'org-mouse-move-tree)
+       (org-defkey org-mouse-map [down-mouse-3] 'org-mouse-move-tree-start))
 
 
      (when (memq 'activate-stars org-mouse-features)
      (when (memq 'activate-stars org-mouse-features)
        (font-lock-add-keywords
        (font-lock-add-keywords
@@ -1131,13 +1131,11 @@ SCHEDULED: or DEADLINE: or ANYTHINGLIKETHIS:"
 (add-hook 'org-agenda-mode-hook
 (add-hook 'org-agenda-mode-hook
    '(lambda ()
    '(lambda ()
      (setq org-mouse-context-menu-function 'org-mouse-agenda-context-menu)
      (setq org-mouse-context-menu-function 'org-mouse-agenda-context-menu)
-     (define-key org-agenda-mode-map
-       (if (featurep 'xemacs) [button3] [mouse-3])
-       'org-mouse-show-context-menu)
-     (define-key org-agenda-mode-map [down-mouse-3] 'org-mouse-move-tree-start)
-     (define-key org-agenda-mode-map (if (featurep 'xemacs) [(control mouse-4)] [C-mouse-4]) 'org-agenda-earlier)
-     (define-key org-agenda-mode-map (if (featurep 'xemacs) [(control mouse-5)] [C-mouse-5]) 'org-agenda-later)
-     (define-key org-agenda-mode-map [drag-mouse-3]
+     (org-defkey org-agenda-mode-map [mouse-3] 'org-mouse-show-context-menu)
+     (org-defkey org-agenda-mode-map [down-mouse-3] 'org-mouse-move-tree-start)
+     (org-defkey org-agenda-mode-map [C-mouse-4] 'org-agenda-earlier)
+     (org-defkey org-agenda-mode-map [C-mouse-5] 'org-agenda-later)
+     (org-defkey org-agenda-mode-map [drag-mouse-3]
        '(lambda (event) (interactive "e")
        '(lambda (event) (interactive "e")
 	  (case (org-mouse-get-gesture event)
 	  (case (org-mouse-get-gesture event)
 	    (:left (org-agenda-earlier 1))
 	    (:left (org-agenda-earlier 1))

+ 17 - 21
lisp/org.el

@@ -417,14 +417,17 @@ therefore you'll have to restart Emacs to apply it after changing."
 
 
 (defun org-key (key)
 (defun org-key (key)
   "Select key according to `org-replace-disputed-keys' and `org-disputed-keys'.
   "Select key according to `org-replace-disputed-keys' and `org-disputed-keys'.
-Or return the original if not disputed."
-  (if org-replace-disputed-keys
-      (let* ((nkey (key-description key))
-	     (x (org-find-if (lambda (x)
-			       (equal (key-description (car x)) nkey))
-			     org-disputed-keys)))
-	(if x (cdr x) key))
-    key))
+Or return the original if not disputed.
+Also apply the trnaslations defined in `org-xemacs-key-equivalents'."
+  (when org-replace-disputed-keys
+    (let* ((nkey (key-description key))
+	   (x (org-find-if (lambda (x)
+			     (equal (key-description (car x)) nkey))
+			   org-disputed-keys)))
+      (setq key (if x (cdr x) key))))
+  (when (featurep 'xemacs)
+    (setq key (or (cdr (assoc key org-xemacs-key-equivalents)) key)))
+  key)
 
 
 (defun org-find-if (predicate seq)
 (defun org-find-if (predicate seq)
   (catch 'exit
   (catch 'exit
@@ -4353,7 +4356,7 @@ The following commands are available:
   ;; we switch another buffer into org-mode.
   ;; we switch another buffer into org-mode.
   (if (featurep 'xemacs)
   (if (featurep 'xemacs)
       (when (boundp 'outline-mode-menu-heading)
       (when (boundp 'outline-mode-menu-heading)
-	;; Assume this is Greg's port, it used easymenu
+	;; Assume this is Greg's port, it uses easymenu
 	(easy-menu-remove outline-mode-menu-heading)
 	(easy-menu-remove outline-mode-menu-heading)
 	(easy-menu-remove outline-mode-menu-show)
 	(easy-menu-remove outline-mode-menu-show)
 	(easy-menu-remove outline-mode-menu-hide))
 	(easy-menu-remove outline-mode-menu-hide))
@@ -4480,10 +4483,8 @@ The following commands are available:
 ;;;; Font-Lock stuff, including the activators
 ;;;; Font-Lock stuff, including the activators
 
 
 (defvar org-mouse-map (make-sparse-keymap))
 (defvar org-mouse-map (make-sparse-keymap))
-(org-defkey org-mouse-map
-  (if (featurep 'xemacs) [button2] [mouse-2]) 'org-open-at-mouse)
-(org-defkey org-mouse-map
-  (if (featurep 'xemacs) [button3] [mouse-3]) 'org-find-file-at-mouse)
+(org-defkey org-mouse-map [mouse-2] 'org-open-at-mouse)
+(org-defkey org-mouse-map [mouse-3] 'org-find-file-at-mouse)
 (when org-mouse-1-follows-link
 (when org-mouse-1-follows-link
   (org-defkey org-mouse-map [follow-link] 'mouse-face))
   (org-defkey org-mouse-map [follow-link] 'mouse-face))
 (when org-tab-follows-link
 (when org-tab-follows-link
@@ -5481,7 +5482,6 @@ in special contexts.
 	  (while (and (not (eobp)) ;; this is like `next-line'
 	  (while (and (not (eobp)) ;; this is like `next-line'
 		      (get-char-property (1- (point)) 'invisible))
 		      (get-char-property (1- (point)) 'invisible))
 	    (goto-char (next-single-char-property-change (point) 'invisible))
 	    (goto-char (next-single-char-property-change (point) 'invisible))
-;;;???	    (or (bolp) (beginning-of-line 2))))
 	    (and (eolp) (beginning-of-line 2))))
 	    (and (eolp) (beginning-of-line 2))))
 	(setq eol (point)))
 	(setq eol (point)))
       (outline-end-of-heading)   (setq eoh (point))
       (outline-end-of-heading)   (setq eoh (point))
@@ -13589,10 +13589,8 @@ user."
 		 (map (copy-keymap calendar-mode-map))
 		 (map (copy-keymap calendar-mode-map))
 		 (minibuffer-local-map (copy-keymap minibuffer-local-map)))
 		 (minibuffer-local-map (copy-keymap minibuffer-local-map)))
 	    (org-defkey map (kbd "RET") 'org-calendar-select)
 	    (org-defkey map (kbd "RET") 'org-calendar-select)
-	    (org-defkey map (if (featurep 'xemacs) [button1] [mouse-1])
-			'org-calendar-select-mouse)
-	    (org-defkey map (if (featurep 'xemacs) [button2] [mouse-2])
-			'org-calendar-select-mouse)
+	    (org-defkey map [mouse-1] 'org-calendar-select-mouse)
+	    (org-defkey map [mouse-2] 'org-calendar-select-mouse)
 	    (org-defkey minibuffer-local-map [(meta shift left)]
 	    (org-defkey minibuffer-local-map [(meta shift left)]
 			(lambda () (interactive)
 			(lambda () (interactive)
 			  (org-eval-in-calendar '(calendar-backward-month 1))))
 			  (org-eval-in-calendar '(calendar-backward-month 1))))
@@ -17001,9 +16999,7 @@ With prefix arg UNCOMPILED, load the uncompiled versions."
   "Display the given MESSAGE as a warning."
   "Display the given MESSAGE as a warning."
   (if (fboundp 'display-warning)
   (if (fboundp 'display-warning)
       (display-warning 'org message
       (display-warning 'org message
-                       (if (featurep 'xemacs)
-                           'warning
-                         :warning))
+                       (if (featurep 'xemacs) 'warning :warning))
     (let ((buf (get-buffer-create "*Org warnings*")))
     (let ((buf (get-buffer-create "*Org warnings*")))
       (with-current-buffer buf
       (with-current-buffer buf
         (goto-char (point-max))
         (goto-char (point-max))