Browse Source

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

Dan Davison 15 years ago
parent
commit
068e414dc7
12 changed files with 118 additions and 22 deletions
  1. 6 0
      doc/ChangeLog
  2. 16 2
      doc/org.texi
  3. 33 0
      lisp/ChangeLog
  4. 7 3
      lisp/org-agenda.el
  5. 6 1
      lisp/org-ascii.el
  6. 10 4
      lisp/org-clock.el
  7. 1 1
      lisp/org-exp.el
  8. 10 2
      lisp/org-html.el
  9. 1 0
      lisp/org-indent.el
  10. 17 7
      lisp/org-latex.el
  11. 5 1
      lisp/org-list.el
  12. 6 1
      lisp/org.el

+ 6 - 0
doc/ChangeLog

@@ -1,3 +1,9 @@
+2010-04-26  Carsten Dominik  <carsten.dominik@gmail.com>
+
+	* org.texi (Conflicts): Document new work-around for windmove.el.
+	(Plain lists): Describe counter start cookies.
+	(External links): Add example for a doi link.
+
 2010-04-23  Carsten Dominik  <carsten.dominik@gmail.com>
 
 	* org.texi (Plain lists): Document the commands to promote/demote

+ 16 - 2
doc/org.texi

@@ -1222,7 +1222,9 @@ visually indistinguishable from true headlines.  In short: even though
 as bullets.
 @item
 @emph{Ordered} list items start with a numeral followed by either a period or
-a right parenthesis, such as @samp{1.} or @samp{1)}.
+a right parenthesis, such as @samp{1.} or @samp{1)}.  If you want a list to
+start a different value (e.g. 20), start the text of the item with
+@code{[@@start:20]}. 
 @item
 @emph{Description} list items are unordered list items, and contain the
 separator @samp{ :: } to separate the description @emph{term} from the
@@ -2804,6 +2806,7 @@ the colon.  The following list shows examples for each link type.
 
 @example
 http://www.astro.uva.nl/~dominik          @r{on the web}
+doi:10.1000/182                           @r{DOI for an electronic resource}
 file:/home/dominik/images/jupiter.jpg     @r{file, absolute path}
 /home/dominik/images/jupiter.jpg          @r{same as above}
 file:papers/last.pdf                      @r{file, relative path}
@@ -11371,7 +11374,18 @@ fixed this problem:
 @item @file{windmove.el} by Hovav Shacham
 @cindex @file{windmove.el}
 This package also uses the @kbd{S-<cursor>} keys, so everything written
-in the paragraph above about CUA mode also applies here.
+in the paragraph above about CUA mode also applies here.  If you want make
+the windmove function active in locations where Org-mode does not have
+special functionality on @kbd{S-@key{cursor}}, add this to your
+configuration:
+
+@lisp
+;; Make windmove work in org-mode:
+(add-hook 'org-shiftup-final-hook 'windmove-up)
+(add-hook 'org-shiftleft-final-hook 'windmove-left)
+(add-hook 'org-shiftdown-final-hook 'windmove-down)
+(add-hook 'org-shiftright-final-hook 'windmove-right)
+@end lisp
 
 @item @file{viper.el} by Michael Kifer
 @cindex @file{viper.el}

+ 33 - 0
lisp/ChangeLog

@@ -1,5 +1,38 @@
+2010-04-26  Carsten Dominik  <carsten.dominik@gmail.com>
+
+	* org.el (org-link-types, org-open-at-point): Add doi links.
+
+	* org-ascii.el (org-export-ascii-preprocess): Remove list
+	startcounter cookies.
+
+	* org-list.el (org-renumber-ordered-list): Respect counter
+	start values.
+
+	* org-latex.el (org-export-latex-lists): Accept ordered list
+	item offset cookie.
+
+	* org-html.el (org-export-as-html): Accept ordered list
+	item offset cookie.
+
+	* org-indent.el (org-indent-mode): Turn off `indent-tabs-mode'
+	which messes up alignment of tags.
+
 2010-04-25  Carsten Dominik  <carsten.dominik@gmail.com>
 
+	* org-clock.el (org-clock-cancel, org-clock-out): Make sure
+	the modeline display is removed.
+
+	* org-exp.el (org-export-format-drawer-function): Fix
+	docstring.
+
+	* org-agenda.el (org-agenda-refile): New optional argument
+	NO-UPDATE.
+	(org-agenda-refile): Call `org-agenda-redo' unless NO-UPDATE
+	is set.
+	(org-agenda-bulk-action): Call the refile command with updates
+	suppressed - but arrange for `org-agenda-redo' to be called at
+	the end.
+
 	* org.el (org-mode): Make table mapping quiet.
 	(org-table-map-tables): New optional argument QUIETLY.
 

+ 7 - 3
lisp/org-agenda.el

@@ -6198,7 +6198,7 @@ If this information is not given, the function uses the tree at point."
 	      (delete-region (point-at-bol) (1+ (point-at-eol)))))
 	  (beginning-of-line 0))))))
 
-(defun org-agenda-refile (&optional goto rfloc)
+(defun org-agenda-refile (&optional goto rfloc no-update)
   "Refile the item at point."
   (interactive "P")
   (if (equal goto '(16))
@@ -6217,7 +6217,8 @@ If this information is not given, the function uses the tree at point."
 	    (widen)
 	    (goto-char marker)
 	    (org-remove-subtree-entries-from-agenda)
-	    (org-refile goto buffer rfloc)))))))
+	    (org-refile goto buffer rfloc)))))
+    (unless no-update (org-agenda-redo))))
 
 (defun org-agenda-open-link (&optional arg)
   "Follow the link in the current line, if any.
@@ -7426,6 +7427,7 @@ The prefix arg is passed through to the command if possible."
   (let* ((action (read-char-exclusive))
 	 (org-log-refile (if org-log-refile 'time nil))
 	 (entries (reverse org-agenda-bulk-marked-entries))
+	 redo-at-end
 	 cmd rfloc state e tag pos (cnt 0) (cntskip 0))
     (cond
      ((equal action ?$)
@@ -7445,7 +7447,8 @@ The prefix arg is passed through to the command if possible."
 			       (find-buffer-visiting (nth 1 rfloc))
 			       (error "This should not happen"))))
 
-      (setq cmd (list 'org-agenda-refile nil (list 'quote rfloc))))
+      (setq cmd (list 'org-agenda-refile nil (list 'quote rfloc) t)
+	    redo-at-end t))
 
      ((equal action ?t)
       (setq state (org-icompleting-read
@@ -7506,6 +7509,7 @@ The prefix arg is passed through to the command if possible."
 	(setq cnt (1+ cnt))))
     (setq org-agenda-bulk-marked-entries nil)
     (org-agenda-bulk-remove-all-marks)
+    (when redo-at-end (org-agenda-redo))
     (message "Acted on %d entries%s"
 	     cnt
 	     (if (= cntskip 0)

+ 6 - 1
lisp/org-ascii.el

@@ -565,7 +565,12 @@ publishing directory."
   (goto-char (point-min))
   (while (re-search-forward  "<<<?\\([^<>]*\\)>>>?\\([ \t]*\\)" nil t)
     (org-if-unprotected-at (match-beginning 1)
-      (replace-match "\\1\\2"))))
+      (replace-match "\\1\\2")))
+  ;; Remove list start counters
+  (goto-char (point-min))
+  (while (re-search-forward  "\\[@start:[0-9]+\\] ?" nil t)
+    (org-if-unprotected
+     (replace-match ""))))
 
 (defun org-html-expand-for-ascii (line)
   "Handle quoted HTML for ASCII export."

+ 10 - 4
lisp/org-clock.el

@@ -1194,8 +1194,11 @@ line and position cursor in that line."
 If there is no running clock, throw an error, unless FAIL-QUIETLY is set."
   (interactive)
   (catch 'exit
-    (if (not (org-clocking-p))
-	(if fail-quietly (throw 'exit t) (error "No active clock")))
+    (when (not (org-clocking-p))
+      (setq global-mode-string
+	    (delq 'org-mode-line-string global-mode-string))
+      (force-mode-line-update)
+      (if fail-quietly (throw 'exit t) (error "No active clock")))
     (let (ts te s h m remove)
       (save-excursion ; Do not replace this with `with-current-buffer'.
 	(with-no-warnings (set-buffer (org-clocking-buffer)))
@@ -1263,8 +1266,11 @@ If there is no running clock, throw an error, unless FAIL-QUIETLY is set."
 (defun org-clock-cancel ()
   "Cancel the running clock be removing the start timestamp."
   (interactive)
-  (if (not (org-clocking-p))
-      (error "No active clock"))
+  (when (not (org-clocking-p))
+    (setq global-mode-string
+         (delq 'org-mode-line-string global-mode-string))
+    (force-mode-line-update)
+    (error "No active clock"))
   (save-excursion ; Do not replace this with `with-current-buffer'.
     (with-no-warnings (set-buffer (org-clocking-buffer)))
     (goto-char org-clock-marker)

+ 1 - 1
lisp/org-exp.el

@@ -1343,9 +1343,9 @@ the current file."
 (defvar org-export-format-drawer-function nil
   "Function to be called to format the contents of a drawer.
 The function must accept three parameters:
-  BACKEND  one of the symbols html, docbook, latex, ascii, xoxo
   NAME     the drawer name, like \"PROPERTIES\"
   CONTENT  the content of the drawer.
+  BACKEND  one of the symbols html, docbook, latex, ascii, xoxo
 The function should return the text to be inserted into the buffer.
 If this is nil, `org-export-format-drawer' is used as a default.")
 

+ 10 - 2
lisp/org-html.el

@@ -710,7 +710,7 @@ PUB-DIR is set, use this as the publishing directory."
 	 table-buffer table-orig-buffer
 	 ind item-type starter didclose
 	 rpl path attr desc descp desc1 desc2 link
-	 snumber fnc item-tag
+	 snumber fnc item-tag initial-number
 	 footnotes footref-seen
 	 id-file href
 	 )
@@ -1284,7 +1284,11 @@ lang=\"%s\" xml:lang=\"%s\">
 		    starter (if (match-beginning 2)
 				(substring (match-string 2 line) 0 -1))
 		    line (substring line (match-beginning 5))
+		    initial-number nil
 		    item-tag nil)
+	      (if (string-match "\\`\\[@start:\\([0-9]+\\)\\][ \t]?" line)
+		  (setq initial-number (match-string 1 line)
+			line (replace-match "" t t line)))
 	      (if (and starter (string-match "\\(.*?\\) ::[ \t]*" line))
 		  (setq item-type "d"
 			item-tag (match-string 1 line)
@@ -1309,11 +1313,15 @@ lang=\"%s\" xml:lang=\"%s\">
 	       ((and starter
 		     (or (not in-local-list)
 			 (> ind (car local-list-indent))))
+		;; check for a specified start number
 		;; Start new (level of) list
 		(org-close-par-maybe)
 		(insert (cond
 			 ((equal item-type "u") "<ul>\n<li>\n")
-			 ((equal item-type "o") "<ol>\n<li>\n")
+			 ((equal item-type "o")
+			  (if initial-number
+			      (format "<ol start=%s>\n<li>\n" initial-number)
+			    "<ol>\n<li>\n"))
 			 ((equal item-type "d")
 			  (format "<dl>\n<dt>%s</dt><dd>\n" item-tag))))
 		(push item-type local-list-type)

+ 1 - 0
lisp/org-indent.el

@@ -131,6 +131,7 @@ FIXME:  How to update when broken?"
       (setq org-indent-mode nil)
     (if org-indent-mode
 	(progn
+	  (org-set-local 'indent-tabs-mode nil)
 	  (or org-indent-strings (org-indent-initialize))
 	  (when org-indent-mode-turns-off-org-adapt-indentation
 	    (org-set-local 'org-adapt-indentation nil))

+ 17 - 7
lisp/org-latex.el

@@ -2166,13 +2166,23 @@ The conversion is made depending of STRING-BEFORE and STRING-AFTER."
 
 (defun org-export-latex-lists ()
   "Convert plain text lists in current buffer into LaTeX lists."
-  (goto-char (point-min))
-  (while (re-search-forward org-list-beginning-re nil t)
-    (org-if-unprotected
-     (beginning-of-line)
-     (insert (org-list-to-latex (org-list-parse-list t)
-				org-export-latex-list-parameters))
-     "\n")))
+  (let (res)
+    (goto-char (point-min))
+    (while (re-search-forward org-list-beginning-re nil t)
+      (org-if-unprotected
+       (beginning-of-line)
+       (setq res (org-list-to-latex (org-list-parse-list t)
+				    org-export-latex-list-parameters))
+       (while (string-match "^\\(\\\\item[ \t]+\\)\\[@start:\\([0-9]+\\)\\]"
+			    res)
+	 (setq res (replace-match
+		    (concat (format "\\setcounter{enumi}{%d}"
+				    (1- (string-to-number
+					 (match-string 2 res))))
+			    "\n"
+			    (match-string 1 res))
+		    t t res)))
+       (insert res "\n")))))
 
 (defconst org-latex-entities
  '("\\!"

+ 5 - 1
lisp/org-list.el

@@ -224,7 +224,7 @@ of `org-plain-list-ordered-item-terminator'."
        (< (point) (match-end 0))))
 
 (defun org-in-item-p ()
-  "It the cursor inside a plain list item.
+  "Is the cursor inside a plain list item.
 Does not have to be the first line."
   (save-excursion
     (condition-case nil
@@ -841,6 +841,10 @@ with something like \"1.\" or \"2)\"."
     (setq bobp (bobp))
     (looking-at "[ \t]*[0-9]+\\([.)]\\)")
     (setq fmt (concat "%d" (or (match-string 1) ".")))
+    (save-excursion
+      (goto-char (match-end 0))
+      (if (looking-at "[ \t]*\\[@start:\\([0-9]+\\)")
+	  (setq n (1- (string-to-number (match-string 1))))))
     (beginning-of-line 0)
     ;; walk forward and replace these numbers
     (catch 'exit

+ 6 - 1
lisp/org.el

@@ -4496,7 +4496,7 @@ The following commands are available:
 
 (defconst org-non-link-chars "]\t\n\r<>")
 (defvar org-link-types '("http" "https" "ftp" "mailto" "file" "news"
-			   "shell" "elisp"))
+			   "shell" "elisp" "doi"))
 (defvar org-link-types-re nil
    "Matches a link that has a url-like prefix like \"http:\"")
 (defvar org-link-re-with-space nil
@@ -8680,6 +8680,11 @@ application the system uses for this file type."
 	  (browse-url (concat type ":" (org-link-escape
 					path org-link-escape-chars-browser))))
 
+	 ((string= type "doi")
+	  (browse-url (concat "http://dx.doi.org/"
+                              (org-link-escape
+                               path org-link-escape-chars-browser))))
+
 	 ((member type '("message"))
 	  (browse-url (concat type ":" path)))