Browse Source

Merge branch 'master' of orgmode.org:org-mode

Paul Sexton 14 years ago
parent
commit
ab075bb452
4 changed files with 91 additions and 30 deletions
  1. 10 2
      doc/org.texi
  2. 7 7
      lisp/org-agenda.el
  3. 10 10
      lisp/org-clock.el
  4. 64 11
      lisp/org-table.el

+ 10 - 2
doc/org.texi

@@ -2064,7 +2064,10 @@ increment.  This key is also used by shift-selection and related modes
 Edit the current field in a separate window.  This is useful for fields that
 Edit the current field in a separate window.  This is useful for fields that
 are not fully visible (@pxref{Column width and alignment}).  When called with
 are not fully visible (@pxref{Column width and alignment}).  When called with
 a @kbd{C-u} prefix, just make the full field visible, so that it can be
 a @kbd{C-u} prefix, just make the full field visible, so that it can be
-edited in place.
+edited in place.  When called with two @kbd{C-u} prefixes, make the editor
+window follow the cursor through the table and always show the current
+field.  The follow mode exits automatically when the cursor leaves the table,
+or when you repeat this command with @kbd{C-u C-u C-c `}.
 @c
 @c
 @item M-x org-table-import
 @item M-x org-table-import
 Import a file as a table.  The table should be TAB or whitespace
 Import a file as a table.  The table should be TAB or whitespace
@@ -8819,7 +8822,7 @@ the object with @code{\ref@{tab:basic-data@}}:
 
 
 Optionally, the caption can take the form:
 Optionally, the caption can take the form:
 @example
 @example
-#+CAPTION: [Caption for list of figures]{Caption for table (or link).}
+#+CAPTION: [Caption for list of figures]@{Caption for table (or link).@}
 @end example
 @end example
 
 
 @cindex inlined images, markup rules
 @cindex inlined images, markup rules
@@ -11153,6 +11156,11 @@ for the title of the file, @code{%a} stands for the author of the file and
 a sitemap entry's date is to be formated. This property bypasses
 a sitemap entry's date is to be formated. This property bypasses
 @code{org-publish-sitemap-date-format} which defaults to @code{%Y-%m-%d}.
 @code{org-publish-sitemap-date-format} which defaults to @code{%Y-%m-%d}.
 
 
+@item @code{:sitemap-sans-extension}
+@tab When non-nil, remove filenames' extensions from the generated sitemap. 
+Useful to have cool URIs (see @uref{http://www.w3.org/Provider/Style/URI}).
+Defaults to @code{nil}.
+
 @end multitable
 @end multitable
 
 
 @node Generating an index,  , Sitemap, Configuration
 @node Generating an index,  , Sitemap, Configuration

+ 7 - 7
lisp/org-agenda.el

@@ -4959,7 +4959,7 @@ See also the user option `org-agenda-clock-consistency-checks'."
 			(plist-get pl :gap-ok-around)))
 			(plist-get pl :gap-ok-around)))
 	 (def-face (or (plist-get pl :default-face)
 	 (def-face (or (plist-get pl :default-face)
 		       '((:background "DarkRed") (:foreground "white"))))
 		       '((:background "DarkRed") (:foreground "white"))))
-	 issue)
+	 issue face m te ts dt ov)
     (goto-char (point-min))
     (goto-char (point-min))
     (while (re-search-forward " Clocked: +(-\\|\\([0-9]+:[0-9]+\\))" nil t)
     (while (re-search-forward " Clocked: +(-\\|\\([0-9]+:[0-9]+\\))" nil t)
       (setq issue nil face def-face)
       (setq issue nil face def-face)
@@ -5046,12 +5046,12 @@ See also the user option `org-agenda-clock-consistency-checks'."
 	;; Wrap it to after midnight.
 	;; Wrap it to after midnight.
 	(setq min2 (+ min2 1440)))
 	(setq min2 (+ min2 1440)))
       ;; Now check if any of the OK times is in the gap
       ;; Now check if any of the OK times is in the gap
-      (mapcar (lambda (x)
-		;; Wrap the time to after midnight if necessary
-		(if (< x min1) (setq x (+ x 1440)))
-		;; Check if in interval
-		(and (<= min1 x) (>= min2 x) (throw 'exit t)))
-	      ok-list)
+      (mapc (lambda (x)
+	      ;; Wrap the time to after midnight if necessary
+	      (if (< x min1) (setq x (+ x 1440)))
+	      ;; Check if in interval
+	      (and (<= min1 x) (>= min2 x) (throw 'exit t)))
+	    ok-list)
       ;; Nope, this gap is not OK
       ;; Nope, this gap is not OK
       nil)))
       nil)))
 
 

+ 10 - 10
lisp/org-clock.el

@@ -976,6 +976,16 @@ so long."
 			 60.0))))
 			 60.0))))
 	   org-clock-user-idle-start)))))
 	   org-clock-user-idle-start)))))
 
 
+(defvar org-clock-current-task nil
+  "Task currently clocked in.")
+(defun org-clock-set-current ()
+  "Set `org-clock-current-task' to the task currently clocked in."
+  (setq org-clock-current-task (nth 4 (org-heading-components))))
+
+(defun org-clock-delete-current ()
+  "Reset `org-clock-current-task' to nil."
+  (setq org-clock-current-task nil))
+
 (defun org-clock-in (&optional select start-time)
 (defun org-clock-in (&optional select start-time)
   "Start the clock on the current item.
   "Start the clock on the current item.
 If necessary, clock-out of the currently active clock.
 If necessary, clock-out of the currently active clock.
@@ -1157,16 +1167,6 @@ the clocking selection, associated with the letter `d'."
 	    (message "Clock starts at %s - %s" ts msg-extra)
 	    (message "Clock starts at %s - %s" ts msg-extra)
 	    (run-hooks 'org-clock-in-hook)))))))
 	    (run-hooks 'org-clock-in-hook)))))))
 
 
-(defvar org-clock-current-task nil
-  "Task currently clocked in.")
-(defun org-clock-set-current ()
-  "Set `org-clock-current-task' to the task currently clocked in."
-  (setq org-clock-current-task (nth 4 (org-heading-components))))
-
-(defun org-clock-delete-current ()
-  "Reset `org-clock-current-task' to nil."
-  (setq org-clock-current-task nil))
-
 (defun org-clock-mark-default-task ()
 (defun org-clock-mark-default-task ()
   "Mark current task as default task."
   "Mark current task as default task."
   (interactive)
   (interactive)

+ 64 - 11
lisp/org-table.el

@@ -162,6 +162,16 @@ Only relevant when `org-enable-table-editor' is equal to `optimized'."
   :group 'org-table-editing
   :group 'org-table-editing
   :type 'boolean)
   :type 'boolean)
 
 
+(defcustom org-table-exit-follow-field-mode-when-leaving-table t
+  "Non-nil means automatically exit the follow mode.
+When nil, the follow mode will stay on and be active in any table
+the cursor enters.  Since the table follow filed mode messes with the
+window configuration, it is not recommended to set this variable to nil,
+except maybe locally in a special file that has mostly tables with long
+fields."
+  :group 'org-table
+  :type 'boolean)
+
 (defcustom org-table-fix-formulas-confirm nil
 (defcustom org-table-fix-formulas-confirm nil
   "Whether the user should confirm when Org fixes formulas."
   "Whether the user should confirm when Org fixes formulas."
   :group 'org-table-editing
   :group 'org-table-editing
@@ -1045,7 +1055,7 @@ copying.  In the case of a timestamp, increment by one day."
 	  (org-move-to-column col))
 	  (org-move-to-column col))
       (error "No non-empty field found"))))
       (error "No non-empty field found"))))
 
 
-(defun org-table-check-inside-data-field ()
+(defun org-table-check-inside-data-field (&optional noerror)
   "Is point inside a table data field?
   "Is point inside a table data field?
 I.e. not on a hline or before the first or after the last column?
 I.e. not on a hline or before the first or after the last column?
 This actually throws an error, so it aborts the current command."
 This actually throws an error, so it aborts the current command."
@@ -1053,7 +1063,10 @@ This actually throws an error, so it aborts the current command."
 	  (= (org-table-current-column) 0)
 	  (= (org-table-current-column) 0)
 	  (org-at-table-hline-p)
 	  (org-at-table-hline-p)
 	  (looking-at "[ \t]*$"))
 	  (looking-at "[ \t]*$"))
-      (error "Not in table data field")))
+      (if noerror
+	  nil
+	(error "Not in table data field"))
+    t))
 
 
 (defvar org-table-clip nil
 (defvar org-table-clip nil
   "Clipboard for table regions.")
   "Clipboard for table regions.")
@@ -1776,21 +1789,32 @@ This is mainly useful for fields that contain hidden parts.
 When called with a \\[universal-argument] prefix, just make the full field visible so that
 When called with a \\[universal-argument] prefix, just make the full field visible so that
 it can be edited in place."
 it can be edited in place."
   (interactive "P")
   (interactive "P")
-  (if arg
-      (let ((b (save-excursion (skip-chars-backward "^|") (point)))
-	    (e (save-excursion (skip-chars-forward "^|\r\n") (point))))
-	(remove-text-properties b e '(org-cwidth t invisible t
-						 display t intangible t))
-	(if (and (boundp 'font-lock-mode) font-lock-mode)
-	    (font-lock-fontify-block)))
+  (cond
+   ((equal arg '(16))
+    (org-table-follow-field-mode (if org-table-follow-field-mode -1 1)))
+   (arg
+    (let ((b (save-excursion (skip-chars-backward "^|") (point)))
+	  (e (save-excursion (skip-chars-forward "^|\r\n") (point))))
+      (remove-text-properties b e '(org-cwidth t invisible t
+					       display t intangible t))
+      (if (and (boundp 'font-lock-mode) font-lock-mode)
+	  (font-lock-fontify-block))))
+   (t
     (let ((pos (move-marker (make-marker) (point)))
     (let ((pos (move-marker (make-marker) (point)))
 	  (field (org-table-get-field))
 	  (field (org-table-get-field))
 	  (cw (current-window-configuration))
 	  (cw (current-window-configuration))
 	  p)
 	  p)
-      (org-switch-to-buffer-other-window "*Org tmp*")
+      (goto-char pos)
+      (org-switch-to-buffer-other-window "*Org Table Edit Field*")
+      (when (and (local-variable-p 'org-field-marker)
+		 (markerp org-field-marker))
+	(move-marker org-field-marker nil))
       (erase-buffer)
       (erase-buffer)
       (insert "#\n# Edit field and finish with C-c C-c\n#\n")
       (insert "#\n# Edit field and finish with C-c C-c\n#\n")
       (let ((org-inhibit-startup t)) (org-mode))
       (let ((org-inhibit-startup t)) (org-mode))
+      (auto-fill-mode -1)
+      (setq truncate-lines nil)
+      (setq word-wrap t)
       (goto-char (setq p (point-max)))
       (goto-char (setq p (point-max)))
       (insert (org-trim field))
       (insert (org-trim field))
       (remove-text-properties p (point-max)
       (remove-text-properties p (point-max)
@@ -1800,7 +1824,7 @@ it can be edited in place."
       (org-set-local 'org-finish-function 'org-table-finish-edit-field)
       (org-set-local 'org-finish-function 'org-table-finish-edit-field)
       (org-set-local 'org-window-configuration cw)
       (org-set-local 'org-window-configuration cw)
       (org-set-local 'org-field-marker pos)
       (org-set-local 'org-field-marker pos)
-      (message "Edit and finish with C-c C-c"))))
+      (message "Edit and finish with C-c C-c")))))
 
 
 (defun org-table-finish-edit-field ()
 (defun org-table-finish-edit-field ()
   "Finish editing a table data field.
   "Finish editing a table data field.
@@ -1825,6 +1849,35 @@ the table and kill the editing buffer."
     (org-table-align)
     (org-table-align)
     (message "New field value inserted")))
     (message "New field value inserted")))
 
 
+(define-minor-mode org-table-follow-field-mode
+  "Minor mode to make the table field editor window follow the cursor.
+When this mode is active, the field editor window will always show the
+current field.  The mode exits automatically when the cursor leaves the
+table (but see `org-table-exit-follow-field-mode-when-leaving-table')."
+  nil " TblFollow" nil
+  (if org-table-follow-field-mode
+      (org-add-hook 'post-command-hook 'org-table-follow-fields-with-editor
+		    'append 'local)
+    (remove-hook 'post-command-hook 'org-table-follow-fields-with-editor 'local)
+    (let* ((buf (get-buffer "*Org Table Edit Field*"))
+	   (win (and buf (get-buffer-window buf))))
+      (when win (delete-window win))
+      (when buf
+	(with-current-buffer buf
+	  (move-marker org-field-marker nil))
+	(kill-buffer buf)))))
+
+(defun org-table-follow-fields-with-editor ()
+  (if (and org-table-exit-follow-field-mode-when-leaving-table
+	   (not (org-at-table-p)))
+      ;; We have left the table, exit the follow mode
+      (org-table-follow-field-mode -1)
+    (when (org-table-check-inside-data-field 'noerror)
+      (let ((win (selected-window)))
+	(org-table-edit-field nil)
+	(org-fit-window-to-buffer)
+	(select-window win)))))
+
 (defvar org-timecnt) ; dynamically scoped parameter
 (defvar org-timecnt) ; dynamically scoped parameter
 
 
 (defun org-table-sum (&optional beg end nlast)
 (defun org-table-sum (&optional beg end nlast)