From bb30de44fd73148da435e0b724e200590a622159 Mon Sep 17 00:00:00 2001 From: Nicolas Goaziou Date: Wed, 24 Apr 2013 09:52:20 +0200 Subject: [PATCH 1/3] ox-html: Always use provided description in internal links * lisp/ox-html.el (org-html-link): Don't skip the link description when it matches the name of the headline it targets. --- lisp/ox-html.el | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/lisp/ox-html.el b/lisp/ox-html.el index 54c6a4524..ef7d15a10 100644 --- a/lisp/ox-html.el +++ b/lisp/ox-html.el @@ -2521,7 +2521,7 @@ INFO is a plist holding contextual information. See (type (org-element-property :type link)) (raw-path (org-element-property :path link)) ;; Ensure DESC really exists, or set it to nil. - (desc (and (not (string= desc "")) desc)) + (desc (org-string-nw-p desc)) (path (cond ((member type '("http" "https" "ftp" "mailto")) @@ -2625,12 +2625,9 @@ INFO is a plist holding contextual information. See ;; What description to use? (desc ;; Case 1: Headline is numbered and LINK has no - ;; description or LINK's description matches - ;; headline's title. Display section number. + ;; description. Display section number. (if (and (org-export-numbered-headline-p destination info) - (or (not desc) - (string= desc (org-element-property - :raw-value destination)))) + (not desc)) (mapconcat 'number-to-string (org-export-get-headline-number destination info) ".") From 862b91e8db127a51e50dce0910a144c977d47151 Mon Sep 17 00:00:00 2001 From: Bastien Guerry Date: Wed, 24 Apr 2013 09:55:15 +0200 Subject: [PATCH 2/3] org.el (org-insert-heading): Fix bug about wrong conversion of lines with :END: or #+end_ into headlines * org.el (org-insert-heading): Reveal context when called interactively. Fix bug about wrong conversion of lines with :END: or #+end_ into headlines. (org-in-drawer-p): New function. (org-meta-return): Use `org-catch-invisible-edits' and the `org-in-drawer-p' to check whether we are within a drawer. Thanks to Muchenxuan Tong and John Hendy who reported these errors. --- lisp/org.el | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/lisp/org.el b/lisp/org.el index 70bee87e8..849e34cc8 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -7495,6 +7495,7 @@ and create a new headline with the text in the current line after point When INVISIBLE-OK is set, stop at invisible headlines when going back. This is important for non-interactive uses of the command." (interactive "P") + (if (org-called-interactively-p 'any) (org-reveal)) (cond ((or (= (buffer-size) 0) (and (not (save-excursion @@ -7550,7 +7551,7 @@ This is important for non-interactive uses of the command." (blank-a (cdr (assq 'heading org-blank-before-new-entry))) (blank (if (eq blank-a 'auto) empty-line-p blank-a)) pos hide-previous previous-pos) - (if ;; At the beginning of a heading, open a new line for insertiong + (if ;; At the beginning of a heading, open a new line for insertion (and (bolp) (org-at-heading-p) (not eops) (or (bobp) @@ -7579,7 +7580,10 @@ This is important for non-interactive uses of the command." ((and (not arg) (not on-heading) (not on-empty-line) (not (save-excursion (beginning-of-line 1) - (looking-at org-list-full-item-re)))) + (or (looking-at org-list-full-item-re) + ;; Don't convert :end: lines to headline + (looking-at "^\\s-*:end:") + (looking-at "^\\s-*#\\+end_?"))))) (beginning-of-line 1)) (org-insert-heading-respect-content (if (not eops) @@ -20575,9 +20579,10 @@ number of stars to add." Calls `org-insert-heading' or `org-table-wrap-region', depending on context. See the individual commands for more information." (interactive "P") + (org-check-before-invisible-edit 'insert) (cond ((run-hook-with-args-until-success 'org-metareturn-hook)) - ((or (org-at-drawer-p) (org-at-property-p)) + ((or (org-at-drawer-p) (org-in-drawer-p) (org-at-property-p)) (newline-and-indent)) ((org-at-table-p) (call-interactively 'org-table-wrap-region)) @@ -21541,6 +21546,17 @@ block from point." names)) nil))) +(defun org-in-drawer-p () + "Is point within a drawer?" + (save-match-data + (let ((case-fold-search t) + (lim-up (save-excursion (outline-previous-heading))) + (lim-down (save-excursion (outline-next-heading)))) + (org-between-regexps-p + (concat "^[ \t]*:" (regexp-opt org-drawers) ":") + "^[ \t]*:end:.*$" + lim-up lim-down)))) + (defun org-occur-in-agenda-files (regexp &optional nlines) "Call `multi-occur' with buffers for all agenda files." (interactive "sOrg-files matching: \np") From 240d645dbb2d7d8968162d9d36058ea406ad4b67 Mon Sep 17 00:00:00 2001 From: Bastien Guerry Date: Wed, 24 Apr 2013 10:05:36 +0200 Subject: [PATCH 3/3] org.el (org-read-date-minibuffer-local-map): Call `calendar-goto-today' only if there is a space before point in the minibuffer prompt * org.el (org-read-date-minibuffer-local-map): Call `calendar-goto-today' only if there is a space before point in the minibuffer prompt. Thanks to Michael Brand and others who asked for this regression to be fixed. --- lisp/org.el | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lisp/org.el b/lisp/org.el index 849e34cc8..0d8865445 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -16074,7 +16074,9 @@ So these are more for recording a certain time/date." (set-keymap-parent map minibuffer-local-map) (org-defkey map (kbd ".") (lambda () (interactive) - (org-eval-in-calendar '(calendar-goto-today)))) + (if (= (char-before) 32) + (org-eval-in-calendar '(calendar-goto-today)) + (insert ".")))) (org-defkey map [(meta shift left)] (lambda () (interactive) (org-eval-in-calendar '(calendar-backward-month 1))))