[O] Bug: `org-get-outline-path' fails on empty heading [8.3.4 (8.3.4-5-gdc68d2-elpaplus @ /home/uki/.emacs.d/elpa/org-plus-contrib-20160229/)]

2016-03-01 Thread Łukasz Gruner
--text follows this line--

1) create a new headline and don't write anything else.
2) M-x eval-expression and type (org-get-outline-path)
3) this fails with the following stacktrace:
Debugger entered--Lisp error: (wrong-type-argument arrayp nil)
  replace-regexp-in-string("\\[[0-9]+%\\]\\|\\[[0-9]+/[0-9]+\\]" "" nil)
  org--get-outline-path-1(nil)
  org-get-outline-path()
  eval((org-get-outline-path) nil)
  eval-expression((org-get-outline-path) nil)
  call-interactively(eval-expression nil nil)
  command-execute(eval-expression)

in org--get-outline-path-1 the line (org-match-string-no-properties 4)
returns nil.

Emacs  : GNU Emacs 24.5.1 (x86_64-unknown-cygwin)
 of 2015-06-23 on desktop-new
Package: Org-mode version 8.3.4 (8.3.4-5-gdc68d2-elpaplus @
/home/uki/.emacs.d/elpa/org-plus-contrib-20160229/)



Re: [O] Contribution to org-mode, Eldoc support

2014-11-07 Thread Łukasz Gruner


On Sun, Nov 2, 2014, at 20:28, Rasmus wrote:
> It works nice for source blocks.  However, I don't get any feedback in
> header-lines:
> 
>  #+header:
>  #+begin_src emacs-lisp
This works only on #XXX_SRC header lines (I don't use anything else and
am not very knowledgable about it, thus I only support this)



[O] Contribution to org-mode, Eldoc support

2014-11-01 Thread Łukasz Gruner
Hi

I would like to contribute Eldoc support.
I've already changed license, but dont quite get that pgp part, I have
generated my pgp and now what?

Cheers,
Łukasz Gruner
From e96112a92c7c24f16c1274b3e8c6567634e19eb1 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C5=81ukasz=20Gruner?= 
Date: Sat, 1 Nov 2014 15:57:54 +0100
Subject: [PATCH] Add eldoc support for src_blocks and headlines.

* lisp/org-eldoc.el (org-eldoc-hook-setup) initialize
eldoc with org mode. Org mode will display Breadcrumb path
when on a header line, src block properties when on src block
and while inside of src-block will try to act natively for that
language.
---
 lisp/org-eldoc.el | 172 ++
 1 file changed, 172 insertions(+)
 create mode 100644 lisp/org-eldoc.el

diff --git a/lisp/org-eldoc.el b/lisp/org-eldoc.el
new file mode 100644
index 000..844100d
--- /dev/null
+++ b/lisp/org-eldoc.el
@@ -0,0 +1,172 @@
+;;; org-eldoc.el --- display org header and src block info using eldoc
+
+;; Copyright (c) 2014 Free Software Foundation, Inc.
+
+;; Author: Łukasz Gruner 
+;; Maintainer: Łukasz Gruner 
+;; Version: 6
+;; Package-Requires: ((org "8"))
+;; URL: https://bitbucket.org/ukaszg/org-eldoc
+;; Created: 25/05/2014
+;; Keywords: eldoc, outline, breadcrumb, org, babel, minibuffer
+
+;; This file is not part of Emacs.
+
+;; GNU Emacs is free software: you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; GNU Emacs is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.
+
+;;; Commentary:
+
+;; To enable, put the following in your .emacs file:
+;;
+;; (org-eldoc-hook-setup) ;; have org-eldoc add itself to `org-mode-hook'
+;; OR run:
+;; (org-eldoc-load)   ;; to setup org-eldoc and enable `eldoc-mode'
+;;
+;;
+;; Report bugs and feature requests at:
+;;
+;; https://bitbucket.org/ukaszg/org-eldoc/issues
+
+;;; Changelog:
+
+;; As of 01/11/14 switching license to GPL3 to allow submission to org-mode.
+
+;;; Code:
+
+(require 'org)
+(require 'ob-core)
+(require 'eldoc)
+
+(defgroup org-eldoc nil "" :group 'org)
+
+(defcustom org-eldoc-breadcrumb-separator "/"
+  "Breadcrumb separator."
+  :group 'org-eldoc
+  :type 'string)
+
+(defcustom org-eldoc-test-buffer-name " *Org-eldoc test buffer*"
+  "Name of the buffer used while testing for mode-local variable values."
+  :group 'org-eldoc
+  :type 'string)
+
+(defun org-eldoc-get-breadcrumb ()
+  "Return breadcrumb if on a headline or nil."
+  (let ((case-fold-search t) cur)
+(save-excursion
+  (beginning-of-line)
+  (save-match-data
+(when (looking-at org-complex-heading-regexp)
+  (setq cur (match-string 4))
+  (org-format-outline-path
+   (append (org-get-outline-path) (list cur))
+   (frame-width) "" org-eldoc-breadcrumb-separator))
+
+(defun org-eldoc-get-src-header ()
+  "Returns lang and list of header properties if on src definition line and nil otherwise."
+  (let ((case-fold-search t) info lang hdr-args)
+(save-excursion
+  (beginning-of-line)
+  (save-match-data
+(when (looking-at "^[ \t]*#\\+\\(begin\\|end\\)_src")
+  (setq info (org-babel-get-src-block-info 'light)
+lang (propertize (nth 0 info) 'face 'font-lock-string-face)
+hdr-args (nth 2 info))
+  (concat
+   lang
+   ": "
+   (mapconcat
+(lambda (elem)
+  (when (and (cdr elem) (not (string= "" (cdr elem
+(concat
+ (propertize (symbol-name (car elem)) 'face 'org-list-dt)
+ " "
+ (propertize (cdr elem) 'face 'org-verbatim)
+ " ")))
+hdr-args " ")))
+
+(defun org-eldoc-get-src-lang ()
+  "Return value of lang for the current block if in block body and nil otherwise."
+  (let ((case-fold-search t))
+(save-match-data
+  (when (org-between-regexps-p ".*#\\+begin_src"
+   ".*#\\+end_src")
+(save-excursion
+  (goto-char (org-babel-where-is-src-block-head))
+  (car (org-babel-parse-src-block-match)))
+
+(defvar org-eldoc-local-functions-cache (make-hash-table :size 40 :test 'equal)
+  &quo