Re: [O] Prevent creating empty lines with trailing spaces when tangling noweb

2017-05-05 Thread Kaushal Modi
On Sat, May 6, 2017 at 2:30 AM Kaushal Modi  wrote:

> +(setq body-str (replace-regexp-in-string "^[ \n\r]*\n" "\n"
> body-str)))
>
>
Just one correction to this regexp so that two or more consecutive empty
lines in the source block get retained:

(setq body-str (replace-regexp-in-string "^[ ]+\n" "\n" body-str))

Here's the draft diff again:

diff --git a/lisp/ob-core.el b/lisp/ob-core.el
index cb332ffea92..96628f44ab4 100644
--- a/lisp/ob-core.el
+++ b/lisp/ob-core.el
@@ -2730,9 +2730,7 @@ block but are passed literally to the
\"example-block\"."
  (funcall nb-add (buffer-substring index (point)))
  (goto-char (match-end 0))
  (setq index (point))
- (funcall
- nb-add
- (with-current-buffer parent-buffer
+ (let ((body-str (with-current-buffer parent-buffer
   (save-restriction
 (widen)
 (mapconcat ;; Interpose PREFIX between every line.
@@ -2794,6 +2792,9 @@ block but are passed literally to the
\"example-block\"."
   "`org-babel-noweb-error-langs')"))
"")))
   "[\n\r]") (concat "\n" prefix))
+  (when (string= "yes" (cdr (assq :noweb-notrailingspc (nth 2 info
+(setq body-str (replace-regexp-in-string "^[ ]+\n" "\n" body-str)))
+  (funcall nb-add body-str)))
   (funcall nb-add (buffer-substring index (point-max
 new-body))


-- 

Kaushal Modi


Re: [O] [PATCH 1/2] org-refile: escape slashes only in headline of refile target

2017-05-05 Thread Sebastian Reuße

Kyle Meyer  writes:

> Based on the Org contributor page [*], it doesn't look like you've
> signed papers with the FSF, so the commit message should label this as
> a "TINYCHANGE". (I think this and the next patch would be small enough
> to mark as tiny changes.)

I have a copyright assignment with FSF; the reason I’m not on the org
contributors page is that I haven’t submitted a patch before.



Re: [O] [PATCH 1/2] org-refile: escape slashes only in headline of refile target

2017-05-05 Thread Sebastian Reuße

Kyle Meyer  writes:

> Org's master branch currently supports Emacs >= 24.3, but string-join
> was added in the 24.5 release.

> I'm fine with the append -> cons conversion, but avoiding it would
> make for a cleaner diff that's more focused on the main purpose of
> this patch.

Thank you, Kyle. I’ve incorporated your suggestions (after pulling the
git send-mail trigger early a few times).

Kind regards,
Sebastian



[O] [PATCH 2/2] org-refile: Optionally prefix refile targets with buffer name

2017-05-05 Thread Sebastian Reuße
* org.el (org-refile-get-targets): Add case to optionally prefix
refile targets with the buffer name.
(org-refile-use-outline-path): Add new option setting and document.

Having an option to use the buffer name as a prefix is convenient,
since this will work hand in hand with uniquify to only show those
parts of the filesystem path needed to disambiguate buffers of
identically named files, as opposed to prefixing refile targets with
the full filesystem path.
---
 lisp/org.el | 12 ++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/lisp/org.el b/lisp/org.el
index 5d8166c99..0e41edb44 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -2553,13 +2553,16 @@ (defcustom org-refile-use-outline-path nil
 into the path.  In this case, you can also stop the completion after
 the file name, to get entries inserted as top level in the file.
 
-When `full-file-path', include the full file path."
+When `full-file-path', include the full file path.
+
+When `buffer-name', use the buffer name."
   :group 'org-refile
   :type '(choice
  (const :tag "Not" nil)
  (const :tag "Yes" t)
  (const :tag "Start with file name" file)
- (const :tag "Start with full file path" full-file-path)))
+ (const :tag "Start with full file path" full-file-path)
+ (const :tag "Start with buffer name" buffer-name)))
 
 (defcustom org-outline-path-complete-in-steps t
   "Non-nil means complete the outline path in hierarchical steps.
@@ -11557,6 +11560,8 @@ (defun org-refile-get-targets (&optional default-buffer)
   (setq f (and f (expand-file-name f)))
   (when (eq org-refile-use-outline-path 'file)
 (push (list (file-name-nondirectory f) f nil nil) tgs))
+  (when (eq org-refile-use-outline-path 'buffer-name)
+(push (list (buffer-name (buffer-base-buffer)) f nil nil) tgs))
   (org-with-wide-buffer
(goto-char (point-min))
(setq org-outline-path-cache nil)
@@ -11585,6 +11590,9 @@ (defun org-refile-get-targets (&optional default-buffer)
   (`full-file-path
(list (buffer-file-name
   (buffer-base-buffer
+  (`buffer-name
+   (list (buffer-name
+  (buffer-base-buffer
   (_ nil))
 (mapcar #'org-protect-slash
 (org-get-outline-path t t)))
-- 
2.12.2




[O] [PATCH 1/2] org-refile: Escape slashes only in headline of refile target

2017-05-05 Thread Sebastian Reuße
* org.el (org-refile-get-targets): Only escape slashes in headline
part of refile target; leave any file-system path component (when
enabled) unescaped.

The reason to escape slashes in refile targets is to make it clear
when a slash was part of a headline vs. part of the outline path.  It
makes sense to treat slashes in the file system part the same way as
outline paths, since this won’t result in any confusion and serves to
make target selection less noisy.
---
 lisp/org.el | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/lisp/org.el b/lisp/org.el
index 0d83b4cbd..5d8166c99 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -11576,7 +11576,7 @@ (defun org-refile-get-targets (&optional default-buffer)
(target
 (if (not org-refile-use-outline-path) heading
   (mapconcat
-   #'org-protect-slash
+   #'identity
(append
 (pcase org-refile-use-outline-path
   (`file (list (file-name-nondirectory
@@ -11586,7 +11586,8 @@ (defun org-refile-get-targets (&optional default-buffer)
(list (buffer-file-name
   (buffer-base-buffer
   (_ nil))
-(org-get-outline-path t t))
+(mapcar #'org-protect-slash
+(org-get-outline-path t t)))
"/"
(push (list target f re (org-refile-marker (point)))
  tgs)))
-- 
2.12.2




[O] [PATCH 2/2] org-refile: Optionally prefix refile targets with buffer name

2017-05-05 Thread Sebastian Reuße
* org.el (org-refile-get-targets): Add case to optionally prefix
refile targets with the buffer name.
(org-refile-use-outline-path): Add new option setting and document.

Having an option to use the buffer name as a prefix is convenient,
since this will work hand in hand with uniquify to only show those
parts of the filesystem path needed to disambiguate buffers of
identically named files, as opposed to prefixing refile targets with
the full filesystem path.
---
 lisp/org.el | 11 +--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/lisp/org.el b/lisp/org.el
index 5d8166c99..e6b154716 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -2553,13 +2553,16 @@ (defcustom org-refile-use-outline-path nil
 into the path.  In this case, you can also stop the completion after
 the file name, to get entries inserted as top level in the file.
 
-When `full-file-path', include the full file path."
+When `full-file-path', include the full file path.
+
+When `id', use the buffer name."
   :group 'org-refile
   :type '(choice
  (const :tag "Not" nil)
  (const :tag "Yes" t)
  (const :tag "Start with file name" file)
- (const :tag "Start with full file path" full-file-path)))
+ (const :tag "Start with full file path" full-file-path)
+ (const :tag "Start with buffer name" id)))
 
 (defcustom org-outline-path-complete-in-steps t
   "Non-nil means complete the outline path in hierarchical steps.
@@ -11557,6 +11560,8 @@ (defun org-refile-get-targets (&optional default-buffer)
   (setq f (and f (expand-file-name f)))
   (when (eq org-refile-use-outline-path 'file)
 (push (list (file-name-nondirectory f) f nil nil) tgs))
+  (when (eq org-refile-use-outline-path 'id)
+(push (list (buffer-name (buffer-base-buffer)) f nil nil) tgs))
   (org-with-wide-buffer
(goto-char (point-min))
(setq org-outline-path-cache nil)
@@ -11585,6 +11590,8 @@ (defun org-refile-get-targets (&optional default-buffer)
   (`full-file-path
(list (buffer-file-name
   (buffer-base-buffer
+  (`id (list (buffer-name
+  (buffer-base-buffer
   (_ nil))
 (mapcar #'org-protect-slash
 (org-get-outline-path t t)))
-- 
2.12.2




[O] [PATCH 1/2] org-refile: Escape slashes only in headline of refile target

2017-05-05 Thread Sebastian Reuße
* org.el (org-refile-get-targets): Only escape slashes in headline
part of refile target; leave any file-system path component (when
enabled) unescaped.

The reason to escape slashes in refile targets is to make it clear
when a slash was part of a headline vs. part of the outline path.  It
makes sense to treat slashes in the file system part the same way as
outline paths, since this won’t result in any confusion and serves to
make target selection less noisy.
---
 lisp/org.el | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/lisp/org.el b/lisp/org.el
index 0d83b4cbd..5d8166c99 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -11576,7 +11576,7 @@ (defun org-refile-get-targets (&optional default-buffer)
(target
 (if (not org-refile-use-outline-path) heading
   (mapconcat
-   #'org-protect-slash
+   #'identity
(append
 (pcase org-refile-use-outline-path
   (`file (list (file-name-nondirectory
@@ -11586,7 +11586,8 @@ (defun org-refile-get-targets (&optional default-buffer)
(list (buffer-file-name
   (buffer-base-buffer
   (_ nil))
-(org-get-outline-path t t))
+(mapcar #'org-protect-slash
+(org-get-outline-path t t)))
"/"
(push (list target f re (org-refile-marker (point)))
  tgs)))
-- 
2.12.2




[O] Prevent creating empty lines with trailing spaces when tangling noweb

2017-05-05 Thread Kaushal Modi
Hello,

I have this MWE:

#+TITLE: Org babel tangle and noweb
#+PROPERTY: header-args:shell :shebang "#!/usr/bin/env bash"

* Shell Script
#+BEGIN_SRC shell :noweb yes :tangle code.sh
exec emacs -Q "$@" \
   --eval '(progn
  <>
   )' 2>/dev/null >
   )' 2>/dev/null 

[O] [PATCH 2/2] org-refile: Optionally prefix refile targets with buffer name

2017-05-05 Thread Sebastian Reuße
* org.el (org-refile-get-targets): Add case to optionally prefix
refile targets with the buffer name.
(org-refile-use-outline-path): Add new option setting and document.

Having an option to use the buffer name as a prefix is convenient,
since this will work hand in hand with uniquify to only show those
parts of the filesystem path needed to disambiguate buffers of
identically named files, as opposed to prefixing refile targets with
the full filesystem path.
---
 lisp/org.el | 11 +--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/lisp/org.el b/lisp/org.el
index ad92f3b2e..342143d5a 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -2553,13 +2553,16 @@ (defcustom org-refile-use-outline-path nil
 into the path.  In this case, you can also stop the completion after
 the file name, to get entries inserted as top level in the file.
 
-When `full-file-path', include the full file path."
+When `full-file-path', include the full file path.
+
+When `id', use the buffer name."
   :group 'org-refile
   :type '(choice
  (const :tag "Not" nil)
  (const :tag "Yes" t)
  (const :tag "Start with file name" file)
- (const :tag "Start with full file path" full-file-path)))
+ (const :tag "Start with full file path" full-file-path)
+ (const :tag "Start with buffer name" id)))
 
 (defcustom org-outline-path-complete-in-steps t
   "Non-nil means complete the outline path in hierarchical steps.
@@ -11557,6 +11560,8 @@ (defun org-refile-get-targets (&optional default-buffer)
   (setq f (and f (expand-file-name f)))
   (when (eq org-refile-use-outline-path 'file)
 (push (list (file-name-nondirectory f) f nil nil) tgs))
+  (when (eq org-refile-use-outline-path 'id)
+(push (list (buffer-name (buffer-base-buffer)) f nil nil) tgs))
   (org-with-wide-buffer
(goto-char (point-min))
(setq org-outline-path-cache nil)
@@ -11578,6 +11583,8 @@ (defun org-refile-get-targets (&optional default-buffer)
   (string-join
(cons
 (pcase org-refile-use-outline-path
+  (`id (buffer-name
+(buffer-base-buffer)))
   (`file (file-name-nondirectory
   (buffer-file-name
(buffer-base-buffer
-- 
2.12.2




[O] [PATCH 1/2] org-refile: Escape slashes only in headline of refile target

2017-05-05 Thread Sebastian Reuße
* org.el (org-refile-get-targets): Only escape slashes in headline
part of refile target; leave any file-system path component (when
enabled) unescaped.

The reason to escape slashes in refile targets is to make it clear
when a slash was part of a headline vs. part of the outline path.  It
makes sense to treat slashes in the file system part the same way as
outline paths, since this won’t result in any confusion and serves to
make target selection less noisy.
---
 lisp/org.el | 21 ++---
 1 file changed, 10 insertions(+), 11 deletions(-)

diff --git a/lisp/org.el b/lisp/org.el
index 0d83b4cbd..ad92f3b2e 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -11575,18 +11575,17 @@ (defun org-refile-get-targets (&optional 
default-buffer)
(regexp-quote heading)))
(target
 (if (not org-refile-use-outline-path) heading
-  (mapconcat
-   #'org-protect-slash
-   (append
+  (string-join
+   (cons
 (pcase org-refile-use-outline-path
-  (`file (list (file-name-nondirectory
-(buffer-file-name
- (buffer-base-buffer)
-  (`full-file-path
-   (list (buffer-file-name
-  (buffer-base-buffer
-  (_ nil))
-(org-get-outline-path t t))
+  (`file (file-name-nondirectory
+  (buffer-file-name
+   (buffer-base-buffer
+  (`full-file-path (buffer-file-name
+(buffer-base-buffer)))
+  (_ ""))
+(mapcar #'org-protect-slash
+(org-get-outline-path t t)))
"/"
(push (list target f re (org-refile-marker (point)))
  tgs)))
-- 
2.12.2




Re: [O] [PATCH 2/2] org-refile: optionally prefix refile targets with buffer name

2017-05-05 Thread Kyle Meyer
Sebastian Reuße  writes:

> * org.el (org-refile-get-targets): Add case to optionally prefix
> refile targets with the buffer name.
> (org-refile-use-outline-path): Add new option setting and document.
>
> Having an option to use the buffer name as a prefix is convenient,
> since this will work hand in hand with uniquify to only show those
> parts of the filesystem path needed to disambiguate buffers of
> identically named files, as opposed to prefixing refile targets with
> the full filesystem path.

Yeah, that does seem useful.

> ---
>  lisp/org.el | 11 +--
>  1 file changed, 9 insertions(+), 2 deletions(-)

I think this should be accompanied by an ORG-NEWS entry.

> diff --git a/lisp/org.el b/lisp/org.el
> index ad92f3b2e..342143d5a 100644
> --- a/lisp/org.el
> +++ b/lisp/org.el
> @@ -2553,13 +2553,16 @@ (defcustom org-refile-use-outline-path nil
>  into the path.  In this case, you can also stop the completion after
>  the file name, to get entries inserted as top level in the file.
>  
> -When `full-file-path', include the full file path."
> +When `full-file-path', include the full file path.
> +
> +When `id', use the buffer name."

The link between `id' and buffer name isn't obvious to me.  I'm guessing
that it's because it would be a unique ID for the file, whereas `file'
would not.  Perhaps `buffer' would be better?


-- 
Kyle



Re: [O] [PATCH 1/2] org-refile: escape slashes only in headline of refile target

2017-05-05 Thread Kyle Meyer
Sebastian Reuße  writes:

> * org.el (org-refile-get-targets): only escape slashes in headline

For style consistency, the first word following the colon should be
capitalized.  The same applies to the commit subject.

> part of refile target; leave any file-system path component (when
> enabled) unescaped.
>
> The reason to escape slashes in refile targets is to make it clear
> when a slash was part of a headline vs. part of the outline path.  It
> makes sense to treat slashes in the file system part the same way as
> outline paths, since this won’t result in any confusion and serves to
> make target selection less noisy.

That sounds reasonable to me.

> ---
>  lisp/org.el | 21 ++---
>  1 file changed, 10 insertions(+), 11 deletions(-)

Based on the Org contributor page [*], it doesn't look like you've
signed papers with the FSF, so the commit message should label this as a
"TINYCHANGE".  (I think this and the next patch would be small enough to
mark as tiny changes.)

[*] http://orgmode.org/worg/org-contribute.html

> diff --git a/lisp/org.el b/lisp/org.el
> index 0d83b4cbd..ad92f3b2e 100644
> --- a/lisp/org.el
> +++ b/lisp/org.el
> @@ -11575,18 +11575,17 @@ (defun org-refile-get-targets (&optional 
> default-buffer)
>   (regexp-quote heading)))
>   (target
>(if (not org-refile-use-outline-path) heading
> -(mapconcat
> - #'org-protect-slash
> - (append
> +(string-join

Org's master branch currently supports Emacs >= 24.3, but string-join
was added in the 24.5 release.

> + (cons
>(pcase org-refile-use-outline-path
> -(`file (list (file-name-nondirectory
> -  (buffer-file-name
> -   (buffer-base-buffer)
> -(`full-file-path
> - (list (buffer-file-name
> -(buffer-base-buffer
> -(_ nil))
> -  (org-get-outline-path t t))
> +(`file (file-name-nondirectory
> +(buffer-file-name
> + (buffer-base-buffer
> +(`full-file-path (buffer-file-name
> +  (buffer-base-buffer)))
> +(_ ""))

I'm fine with the append -> cons conversion, but avoiding it would make
for a cleaner diff that's more focused on the main purpose of this
patch.

Also, it does slightly change the result because the fall-through case
would now include "/" at the start of the path, but I don't think that's
a big deal given that this case shouldn't be reached if the user sets
org-refile-use-outline-path to a valid value.  Which makes me wonder
whether we should just raise a user-error for this fall-through case.

> +  (mapcar #'org-protect-slash
> +  (org-get-outline-path t t)))
>   "/"

-- 
Kyle



[O] [PATCH 2/2] org-refile: optionally prefix refile targets with buffer name

2017-05-05 Thread Sebastian Reuße
* org.el (org-refile-get-targets): Add case to optionally prefix
refile targets with the buffer name.
(org-refile-use-outline-path): Add new option setting and document.

Having an option to use the buffer name as a prefix is convenient,
since this will work hand in hand with uniquify to only show those
parts of the filesystem path needed to disambiguate buffers of
identically named files, as opposed to prefixing refile targets with
the full filesystem path.
---
 lisp/org.el | 11 +--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/lisp/org.el b/lisp/org.el
index ad92f3b2e..342143d5a 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -2553,13 +2553,16 @@ (defcustom org-refile-use-outline-path nil
 into the path.  In this case, you can also stop the completion after
 the file name, to get entries inserted as top level in the file.
 
-When `full-file-path', include the full file path."
+When `full-file-path', include the full file path.
+
+When `id', use the buffer name."
   :group 'org-refile
   :type '(choice
  (const :tag "Not" nil)
  (const :tag "Yes" t)
  (const :tag "Start with file name" file)
- (const :tag "Start with full file path" full-file-path)))
+ (const :tag "Start with full file path" full-file-path)
+ (const :tag "Start with buffer name" id)))
 
 (defcustom org-outline-path-complete-in-steps t
   "Non-nil means complete the outline path in hierarchical steps.
@@ -11557,6 +11560,8 @@ (defun org-refile-get-targets (&optional default-buffer)
   (setq f (and f (expand-file-name f)))
   (when (eq org-refile-use-outline-path 'file)
 (push (list (file-name-nondirectory f) f nil nil) tgs))
+  (when (eq org-refile-use-outline-path 'id)
+(push (list (buffer-name (buffer-base-buffer)) f nil nil) tgs))
   (org-with-wide-buffer
(goto-char (point-min))
(setq org-outline-path-cache nil)
@@ -11578,6 +11583,8 @@ (defun org-refile-get-targets (&optional default-buffer)
   (string-join
(cons
 (pcase org-refile-use-outline-path
+  (`id (buffer-name
+(buffer-base-buffer)))
   (`file (file-name-nondirectory
   (buffer-file-name
(buffer-base-buffer
-- 
2.12.2




Re: [O] [PATCH 2/2] org-refile: optionally prefix refile targets with buffer name

2017-05-05 Thread Sebastian Reuße
Apologies for the resubmission; forgot to stage a hunk in one of the
commits.

Kind regards,
Sebastian Reuße



[O] [PATCH 1/2] org-refile: escape slashes only in headline of refile target

2017-05-05 Thread Sebastian Reuße
* org.el (org-refile-get-targets): only escape slashes in headline
part of refile target; leave any file-system path component (when
enabled) unescaped.

The reason to escape slashes in refile targets is to make it clear
when a slash was part of a headline vs. part of the outline path.  It
makes sense to treat slashes in the file system part the same way as
outline paths, since this won’t result in any confusion and serves to
make target selection less noisy.
---
 lisp/org.el | 21 ++---
 1 file changed, 10 insertions(+), 11 deletions(-)

diff --git a/lisp/org.el b/lisp/org.el
index 0d83b4cbd..ad92f3b2e 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -11575,18 +11575,17 @@ (defun org-refile-get-targets (&optional 
default-buffer)
(regexp-quote heading)))
(target
 (if (not org-refile-use-outline-path) heading
-  (mapconcat
-   #'org-protect-slash
-   (append
+  (string-join
+   (cons
 (pcase org-refile-use-outline-path
-  (`file (list (file-name-nondirectory
-(buffer-file-name
- (buffer-base-buffer)
-  (`full-file-path
-   (list (buffer-file-name
-  (buffer-base-buffer
-  (_ nil))
-(org-get-outline-path t t))
+  (`file (file-name-nondirectory
+  (buffer-file-name
+   (buffer-base-buffer
+  (`full-file-path (buffer-file-name
+(buffer-base-buffer)))
+  (_ ""))
+(mapcar #'org-protect-slash
+(org-get-outline-path t t)))
"/"
(push (list target f re (org-refile-marker (point)))
  tgs)))
-- 
2.12.2




[O] [PATCH 2/2] org-refile: optionally prefix refile targets with buffer name

2017-05-05 Thread Sebastian Reuße
* org.el (org-refile-get-targets): Add case to optionally prefix
refile targets with the buffer name.
(org-refile-use-outline-path): Document new option.

Having an option to use the buffer name as a prefix is convenient,
since this will work hand in hand with uniquify to only show those
parts of the filesystem path needed to disambiguate buffers of
identically named files, as opposed to prefixing refile targets with
the full filesystem path.
---
 lisp/org.el | 8 +++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/lisp/org.el b/lisp/org.el
index ad92f3b2e..06066230f 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -2553,7 +2553,9 @@ (defcustom org-refile-use-outline-path nil
 into the path.  In this case, you can also stop the completion after
 the file name, to get entries inserted as top level in the file.
 
-When `full-file-path', include the full file path."
+When `full-file-path', include the full file path.
+
+When `id', use the buffer name."
   :group 'org-refile
   :type '(choice
  (const :tag "Not" nil)
@@ -11557,6 +11559,8 @@ (defun org-refile-get-targets (&optional default-buffer)
   (setq f (and f (expand-file-name f)))
   (when (eq org-refile-use-outline-path 'file)
 (push (list (file-name-nondirectory f) f nil nil) tgs))
+  (when (eq org-refile-use-outline-path 'id)
+(push (list (buffer-name (buffer-base-buffer)) f nil nil) tgs))
   (org-with-wide-buffer
(goto-char (point-min))
(setq org-outline-path-cache nil)
@@ -11578,6 +11582,8 @@ (defun org-refile-get-targets (&optional default-buffer)
   (string-join
(cons
 (pcase org-refile-use-outline-path
+  (`id (buffer-name
+(buffer-base-buffer)))
   (`file (file-name-nondirectory
   (buffer-file-name
(buffer-base-buffer
-- 
2.12.2




[O] About org-sort -> org-sort-list with custom sort function

2017-05-05 Thread Zhitao Gong
Hi All,

I think there is a bug in org-sort or org-sort-list function.

If you call org-sort (C-c ^) on list items, this function will call
org-sort-list.  However, org-sort calls org-sort-list with only one
argument, i.e., the with-case (see the code below)

#+BEGIN_SRC emacs-lisp
((org-at-item-p) (org-call-with-arg 'org-sort-list with-case))
#+END_SRC emacs-lisp

The problem is that if you choose ?f (sorting with custom key function),
then org-sort-list expects another argument, the compare-func, which is
not passed to it.

IMHO, there are two ways to solve this

1. Ask for the compare-func in org-sort-list, as it does for the
   getkey-func.  A default value could be provided for compare-func,
   e.g., string<, <, etc.  Or
2. Restrict the return type to a string (or integer) so that we could
   fix the compare-func

-- 
gongzhitaao / 半緣脩道半緣君



[O] [PATCH 1/2] org-refile: escape slashes only in headline of refile target

2017-05-05 Thread Sebastian Reuße
* org.el (org-refile-get-targets): only escape slashes in headline
part of refile target; leave any file-system path component (when
enabled) unescaped.

The reason to escape slashes in refile targets is to make it clear
when a slash was part of a headline vs. part of the outline path.  It
makes sense to treat slashes in the file system part the same way as
outline paths, since this won’t result in any confusion and serves to
make target selection less noisy.
---
 lisp/org.el | 21 ++---
 1 file changed, 10 insertions(+), 11 deletions(-)

diff --git a/lisp/org.el b/lisp/org.el
index 0d83b4cbd..ad92f3b2e 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -11575,18 +11575,17 @@ (defun org-refile-get-targets (&optional 
default-buffer)
(regexp-quote heading)))
(target
 (if (not org-refile-use-outline-path) heading
-  (mapconcat
-   #'org-protect-slash
-   (append
+  (string-join
+   (cons
 (pcase org-refile-use-outline-path
-  (`file (list (file-name-nondirectory
-(buffer-file-name
- (buffer-base-buffer)
-  (`full-file-path
-   (list (buffer-file-name
-  (buffer-base-buffer
-  (_ nil))
-(org-get-outline-path t t))
+  (`file (file-name-nondirectory
+  (buffer-file-name
+   (buffer-base-buffer
+  (`full-file-path (buffer-file-name
+(buffer-base-buffer)))
+  (_ ""))
+(mapcar #'org-protect-slash
+(org-get-outline-path t t)))
"/"
(push (list target f re (org-refile-marker (point)))
  tgs)))
-- 
2.12.2




[O] [PATCH] ox-s5: Update to work with refactored html backedn

2017-05-05 Thread Łukasz Stelmach
* contrib/lisp/ox-s5.el (org-s5-template): Adapt to changes introduced
by c9ca0b6d in the way :html-divs/org-html-divs are passed to ox-html.
---
 contrib/lisp/ox-s5.el | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/contrib/lisp/ox-s5.el b/contrib/lisp/ox-s5.el
index 503bfd0..7a717fe 100644
--- a/contrib/lisp/ox-s5.el
+++ b/contrib/lisp/ox-s5.el
@@ -304,13 +304,13 @@ holding export options."
   "Return complete document string after HTML conversion.
 CONTENTS is the transcoded contents string.  INFO is a plist
 holding export options."
-  (let ((org-html-divs
-(if (equal (plist-get info :html-container) "li")
-(append '((content "ol" "content")) org-s5--divs)
-  org-s5--divs))
-(info (plist-put
+  (let ((info (plist-put
+  (plist-put
(plist-put info :html-preamble (plist-get info :s5-preamble))
-   :html-postamble (plist-get info :s5-postamble
+   :html-postamble (plist-get info :s5-postamble))
+  :html-divs (if (equal (plist-get info :html-container) "li")
+ (append '((content "ol" "content")) org-s5--divs)
+   org-s5--divs
 (mapconcat
  'identity
  (list
-- 
2.1.4




[O] [PATCH v1.1] ox-s5: update to work with refactored html backedn

2017-05-05 Thread Łukasz Stelmach

* contrib/lisp/ox-s5.el: adapt to changes introduced by c9ca0b6d in the
way :html-divs/org-html-divs are passed to ox-html
---
Now it should be ready.

 contrib/lisp/ox-s5.el | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/contrib/lisp/ox-s5.el b/contrib/lisp/ox-s5.el
index 503bfd0..7a717fe 100644
--- a/contrib/lisp/ox-s5.el
+++ b/contrib/lisp/ox-s5.el
@@ -304,13 +304,13 @@ holding export options."
   "Return complete document string after HTML conversion.
 CONTENTS is the transcoded contents string.  INFO is a plist
 holding export options."
-  (let ((org-html-divs
-(if (equal (plist-get info :html-container) "li")
-(append '((content "ol" "content")) org-s5--divs)
-  org-s5--divs))
-(info (plist-put
+  (let ((info (plist-put
+  (plist-put
(plist-put info :html-preamble (plist-get info :s5-preamble))
-   :html-postamble (plist-get info :s5-postamble
+   :html-postamble (plist-get info :s5-postamble))
+  :html-divs (if (equal (plist-get info :html-container) "li")
+ (append '((content "ol" "content")) org-s5--divs)
+   org-s5--divs
 (mapconcat
  'identity
  (list
-- 
2.1.4





Re: [O] Push rights for repository

2017-05-05 Thread Carsten Dominik
Thank you Bastien,

indeed, it is fixed now - apparently I had cloned with

$ git clone git://orgmode.org/org-mode.git

instead of

$ git clone orgm...@orgmode.org:org-mode.git

- Carsten


On Fri, May 5, 2017 at 11:19 AM, Bastien  wrote:

> Hi Carsten,
>
> Carsten Dominik  writes:
>
> > I seem to have lost my push privilege to the git repository.  Does
> > anyone know why that might be the case?
> >
> > $ git remote -v shows
> >
> > origin git://orgmode.org/org-mode.git (fetch)
> > origin git://orgmode.org/org-mode.git (push)
>
> I get
>
> origin  orgm...@orgmode.org:org-mode.git (fetch)
> origin  orgm...@orgmode.org:org-mode.git (push)
>
> It looks like you are trying to push from a read-only repo?
>
> > and I believe that my ssh settings are OK - I did push a few weeks
> > ago successfully.  Still, on a push attempt, I get
> >
> >   fatal: remote error: access denied or repository not exported:
> > /org-mode.git
>
> I confirm your key didn't change on the server.
>
> Let me know!
>
> --
>  Bastien
>


Re: [O] Push rights for repository

2017-05-05 Thread Bastien
Hi Carsten,

Carsten Dominik  writes:

> I seem to have lost my push privilege to the git repository.  Does
> anyone know why that might be the case?
>
> $ git remote -v shows
>
>     origin git://orgmode.org/org-mode.git (fetch)
>     origin git://orgmode.org/org-mode.git (push)

I get

origin  orgm...@orgmode.org:org-mode.git (fetch)
origin  orgm...@orgmode.org:org-mode.git (push)

It looks like you are trying to push from a read-only repo?

> and I believe that my ssh settings are OK - I did push a few weeks
> ago successfully.  Still, on a push attempt, I get
>
>       fatal: remote error: access denied or repository not exported:
> /org-mode.git

I confirm your key didn't change on the server.

Let me know!

-- 
 Bastien



Re: [O] [PATCH] ox-s5: update to work with refactored html backedn

2017-05-05 Thread Łukasz Stelmach
It was <2017-05-04 czw 17:39>, when Łukasz Stelmach wrote:
> * contrib/lisp/ox-s5.el: adapt to changes introduced by c9ca0b6d in the
> way :html-divs/org-html-divs are passed to ox-html

Please don't apply this patch. I'll send it from another e-mail account.
-- 
Łukasz Stelmach
Samsung R&D Institute Poland
Samsung Electronics




[O] [PATCH] ox-s5: update to work with refactored html backedn

2017-05-05 Thread Łukasz Stelmach

* contrib/lisp/ox-s5.el: adapt to changes introduced by c9ca0b6d in the
way :html-divs/org-html-divs are passed to ox-html
---
It appears that for some reason the patch didn't make it to the list the
first time I sent it.

 contrib/lisp/ox-s5.el | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/contrib/lisp/ox-s5.el b/contrib/lisp/ox-s5.el
index 503bfd0..7a717fe 100644
--- a/contrib/lisp/ox-s5.el
+++ b/contrib/lisp/ox-s5.el
@@ -304,13 +304,13 @@ holding export options."
   "Return complete document string after HTML conversion.
 CONTENTS is the transcoded contents string.  INFO is a plist
 holding export options."
-  (let ((org-html-divs
-(if (equal (plist-get info :html-container) "li")
-(append '((content "ol" "content")) org-s5--divs)
-  org-s5--divs))
-(info (plist-put
+  (let ((info (plist-put
+  (plist-put
(plist-put info :html-preamble (plist-get info :s5-preamble))
-   :html-postamble (plist-get info :s5-postamble
+   :html-postamble (plist-get info :s5-postamble))
+  :html-divs (if (equal (plist-get info :html-container) "li")
+ (append '((content "ol" "content")) org-s5--divs)
+   org-s5--divs
 (mapconcat
  'identity
  (list
-- 
2.1.4





[O] Push rights for repository

2017-05-05 Thread Carsten Dominik
Hi,

I seem to have lost my push privilege to the git repository.  Does anyone
know why that might be the case?

$ git remote -v shows

origin git://orgmode.org/org-mode.git (fetch)
origin git://orgmode.org/org-mode.git (push)

and I believe that my ssh settings are OK - I did push a few weeks ago
successfully.  Still, on a push attempt, I get

  fatal: remote error: access denied or repository not exported:
/org-mode.git


Thanks!

Carsten