Re: One of my Org files hangs Emacs

2023-01-18 Thread Richard Kim
Ihor Radchenko  writes:

> Marcin Borkowski  writes:
>
>> so I have a bunch of Org files, most of them pretty big (over 1
>> megabyte), and one of them repeatedly causes my Emacsa to hang.
>> Sometimes a plain `C-g' helps, sometimes I need to kill the Emacs
>> process.  How do I even begin to find out what happens?  Any hints?
>
> 1. Set debug-on-quit to t and study the backtrace you get after C-g
> 2. Set debug-on-error to t, send SIGUSR2 signal to Emacs and study the 
> backtrace
> 3. Run emacs -Q only loading the Org version you use and try to
>reproduce. If you can, this is a bug in Org. If you can't, bisect
>your config to identify the cause (there is a helper bug-hunter
>package to assist; it can be used for manual reproduction as well)

I would suggest disabling "org persist" which has caused so much grief for me.

(setq org-element-cache-persistent nil)

Prior to me adding above line, I would get mysterious hangs, and all
kinds of frequent errors.  I tried debug-on-quit and debug-on-error, but
this "org persist" thing was impossible to debug.





Re: [BUG] warning message for straight-use-package [9.6 (9.6-gb2adb6 @ /Users/stephen/.emacs.d/straight/build/org/)]

2022-12-30 Thread Richard Kim
Stephen Eglen  writes:

> Checking the source, I see line 77 of org-macs.el has
>
>  (straight-use-package 'org)
>
> so I'm not sure what the fix is, but does anyone have any ideas on
> providing a warning that uses the correct quote character?

The correct character is the usual 7-bit single quote, i.e., the line
you have here correct.

My straight.el setup is done in early-init.el rather than in .emacs. I
also have (straight-use-package 'org) in early-init.el to make sure that
org version I want (which is the one installed by straight.el) is used.
I've had this setup for years, and I have never run into another org
mode getting installed by package.el to cause problems.




Re: Recommended way to work on main without upgrading Org?

2022-12-23 Thread Richard Kim
Richard Kim  writes:

> Richard Kim  writes:
>
>> Karthik Chikmagalur  writes:
>>
>>> I can get it to work with emacs -Q as well, and this is good for testing, 
>>> thank you.
>>>
>>> But I'm looking for a way to retain the rest of my configuration and swap 
>>> out
>>> Org as required. Otherwise I can't do any interactive development. Another
>>> alternative is to set up a completely different init directory and run Emacs
>>> with a chemacs2 profile or with the new --init-directory flag, but 
>>> considering
>>> the complexity/size of my configuration this would be onerous.
>>
>> How about specifying org version of your choice on command line like this?
>>
>> emacs --eval "(add-to-list 'load-path \"/path/to/org\")"
>>
>> So long as you don't activate another org mode package within your
>> start-up files, above should work I think.
>
> If you want to better control where your org path end up in load-path,
> then you can use one of several hooks, e.g., following delays updating
> load-path till almost the very end of emacs startup process
>
> emacs --eval "(add-hook 'emacs-startup-hook (lambda () (add-to-list 
> 'load-path \"/path/to/org\")) 100)"
>
> See [[info:elisp#Startup Summary]] for emacs startup details.

An alternative is to use --init-directory with thin wrapper around your normal 
config, e.g.,
you can create arbitrary configuration which makes small tweaks to your
normal configuration with something like the following:

$ cat /tmp/e1/early-init.el
(add-to-list 'load-path "/path/to/org")
(setq user-emacs-directory "~/.emacs.d/")
(load-library (expand-file-name "early-init.el" user-emacs-directory))

$ cat /tmp/e1/init.el
(load-library (expand-file-name "init.el" user-emacs-directory))

$ emacs --init-directory /tmp/e1




Re: Recommended way to work on main without upgrading Org?

2022-12-23 Thread Richard Kim
Richard Kim  writes:

> Karthik Chikmagalur  writes:
>
>> I can get it to work with emacs -Q as well, and this is good for testing, 
>> thank you.
>>
>> But I'm looking for a way to retain the rest of my configuration and swap out
>> Org as required. Otherwise I can't do any interactive development. Another
>> alternative is to set up a completely different init directory and run Emacs
>> with a chemacs2 profile or with the new --init-directory flag, but 
>> considering
>> the complexity/size of my configuration this would be onerous.
>
> How about specifying org version of your choice on command line like this?
>
> emacs --eval "(add-to-list 'load-path \"/path/to/org\")"
>
> So long as you don't activate another org mode package within your
> start-up files, above should work I think.

If you want to better control where your org path end up in load-path,
then you can use one of several hooks, e.g., following delays updating
load-path till almost the very end of emacs startup process

emacs --eval "(add-hook 'emacs-startup-hook (lambda () (add-to-list 
'load-path \"/path/to/org\")) 100)"

See [[info:elisp#Startup Summary]] for emacs startup details.




Re: Recommended way to work on main without upgrading Org?

2022-12-23 Thread Richard Kim
Karthik Chikmagalur  writes:

> I can get it to work with emacs -Q as well, and this is good for testing, 
> thank you.
>
> But I'm looking for a way to retain the rest of my configuration and swap out
> Org as required. Otherwise I can't do any interactive development. Another
> alternative is to set up a completely different init directory and run Emacs
> with a chemacs2 profile or with the new --init-directory flag, but considering
> the complexity/size of my configuration this would be onerous.

How about specifying org version of your choice on command line like this?

emacs --eval "(add-to-list 'load-path \"/path/to/org\")"

So long as you don't activate another org mode package within your
start-up files, above should work I think.




Re: org-capture firefox extension broken [silently]

2022-06-09 Thread Richard Kim
Samuel Wales  writes:

> idk if there are other org capture extensions.  i am aware of spookfox
> and eagerly look forward to its maturing, at which point i will try
> it.  but idk if that can do simple, id-less org capture.

I too noticed that org-capture stopped working months ago.
Fortunately I had setup https://github.com/kuanyui/copy-as-org-mode
which works great.  It is superset of org-capture in that I can
cut and paste regions of text and it does good job of translating
HTML into org.




Re: straight.el and org info pages?

2021-03-23 Thread Richard Kim
Greg Minshall  writes:

> Gustav,
>
>> Straight.el is worth looking into for this. Has served me well for
>> similar use cases.
>
> have you (or anyone else?) had problems getting straight.el to build and
> install the info pages for Org mode?
>
> cheers, Greg

For me (info "(org)") brings up org mode info page located in
org-plus-contrib package installed by straight.el. Thus it appears that
straight.el has no problem building info pages for org mode.

I use straight.el along with spacemacs.




Re: Let emacs align all columns automatically on-the-fly within orgmode.

2021-01-01 Thread Richard Kim


Hongyi Zhao  writes:

> On Mon, Dec 28, 2020 at 5:50 PM Ihor Radchenko  wrote:
>>
>> Hongyi Zhao  writes:
>>
>> > I use Chinese characters in some column, and it seems that pressing
>> > TAB can't do the trick for this senario.
>>
>> Take a look at https://github.com/casouri/valign
>
> Wonderful. Thanks a lot. I'll take a look and try it.

In my experience valign was a disaster in that it made org-mode pretty
much unusable. For details see
https://github.com/syl20bnr/spacemacs/issues/14223




Re: Bug: headline folding broken by whitespace

2020-11-02 Thread Richard Kim
Kyle Meyer  writes:

> Russell Adams writes:
>
>> On Sat, Oct 31, 2020 at 01:58:25PM -0400, Kyle Meyer wrote:
>>> As I mentioned elsewhere in the thread, my guess is that Russell was
>>> using your example as is, rather than adding the space on the line
>>> (where X is below).
>>
>> No. I added a space, and even used highlight-regexp to confirm all
>> spaces.
>>
>> It did not occur for me.
>
> Well, then I'm out of guesses.
>
> In any case, for those who can trigger the issue (using the example from
> this thread as well as the examples from the related threads) on
> ee3c3b554 up through 47bf6005b (as I can, with a vanilla Emacs 27.1),
> e8070d71a should resolve it.

I cannot trigger the problem on emacs 27.1 when it was launched with -q.
However I can trigger the issue on emacs 27.1 when spacemacs is used.
This is using latest org-mode package which I built from latest git
files.

The problem seems to be due in part to org-cycle-show-empty-lines which
is one of the functions in org-cycle-hook.  I say this based on two
the observations that the problem goes away if either of these two
things are done:

1. Remove org-cycle-show-empty-lines from org-cycle-hook.

2. Set org-cycle-separator-lines (whose default value is 2) to some
   large value, e.g., 5.

As far as I can tell the values of org-cycle-hook and
org-cycle-separator-lines are the same whether spacemacs is used or not.
Yet the problem is seen only on spacemacs. So it appears that some other
feature is used within spacemacs which interferes with
org-cycle-show-empty-lines. I have not been able to figure this out,
because there are just too many org related features enabled or
customized within spacemacs.




Re: Cycling through TODO workflow joins the next line onto the current one

2020-09-23 Thread Richard Kim
Richard Kim  writes:

> Bastien  writes:
>
>> Hi Krishan,
>>
>> Krishan Kharagjitsing  writes:
>>
>>> Hello, I found the following weird behaviour. 
>>
>> What is M-x org-version RET ?
>
> Because of (setq org-log-done 'time) according to
> https://github.com/syl20bnr/spacemacs/issues/13901#issuecomment-697323151
>
>>> When I set some tasks to DONE and fold the headings with TAB, then
>>> when I cycle back from DONE to TODO it joins the next line with the
>>> current one.
>>>
>>> org_mode_bug
>>>
>>> Reproduction guide
>>>
>>> Make two TODO headings in org mode
>>> Cycle both TODO items to DONE
>>> Fold the headings (so the dots appear, because the timestamp gets
>>> folded with the heading)
>>> Cycle the first DONE heading
>>
>> Why are there timestamps?  Can you provide a test .org file where we
>> can reproduce the problem?
>>
>> Thanks,
>
> The original report at the top of
> https://github.com/syl20bnr/spacemacs/issues/13901
> has gif animation on how this problem can be seen.

On my emacs 27, following demonstrates the problem.

(let ()
  (switch-to-buffer (generate-new-buffer "*demo line joining bug*"))
  (erase-buffer)
  (org-mode)
  (setq org-log-done 'time)
  (insert "* one\n")
  (insert "* two\n")
  (goto-line 1)
  (org-todo)
  (org-todo)
  (org-todo)
  (org-cycle)
  (org-todo)
  (org-todo)
  )



Re: Cycling through TODO workflow joins the next line onto the current one

2020-09-23 Thread Richard Kim
Bastien  writes:

> Hi Krishan,
>
> Krishan Kharagjitsing  writes:
>
>> Hello, I found the following weird behaviour. 
>
> What is M-x org-version RET ?

Because of (setq org-log-done 'time) according to
https://github.com/syl20bnr/spacemacs/issues/13901#issuecomment-697323151

>> When I set some tasks to DONE and fold the headings with TAB, then
>> when I cycle back from DONE to TODO it joins the next line with the
>> current one.
>>
>> org_mode_bug
>>
>> Reproduction guide
>>
>> Make two TODO headings in org mode
>> Cycle both TODO items to DONE
>> Fold the headings (so the dots appear, because the timestamp gets
>> folded with the heading)
>> Cycle the first DONE heading
>
> Why are there timestamps?  Can you provide a test .org file where we
> can reproduce the problem?
>
> Thanks,

The original report at the top of
https://github.com/syl20bnr/spacemacs/issues/13901
has gif animation on how this problem can be seen.



patch to suppress "deprecated cl" warnings plus few others

2020-08-22 Thread Richard Kim
Attached patch suppresses byte compiler warnings.

Most changes are to replace (require 'cl) with (require 'cl-lib). Few other
changes were also made simply by following messages printed by the byte
compiler, e.g., replacing show-branches with outline-show-branches,
org-pop-to-buffer-same-window with pop-to-buffer-same-window, and declaring
new-of as a dynamic variable to prevent it from being a free variable.
From bc6e0dd7c1f3bc8c7d78c4c38eb04140d99001fc Mon Sep 17 00:00:00 2001
From: Richard Kim 
Date: Sat, 22 Aug 2020 11:05:30 -0700
Subject: [PATCH] Suppressed all "deprecated cl" warnings plus few others.

---
 contrib/lisp/ob-tcl.el |  2 +-
 contrib/lisp/org-choose.el |  6 ++
 contrib/lisp/org-depend.el | 11 +--
 contrib/lisp/org-invoice.el|  2 +-
 contrib/lisp/org-learn.el  |  6 +++---
 contrib/lisp/org-notify.el |  2 +-
 contrib/lisp/org-registry.el   |  2 +-
 contrib/lisp/org-toc.el| 18 +-
 contrib/lisp/org-wikinodes.el  |  8 
 contrib/lisp/ox-deck.el|  4 ++--
 contrib/lisp/ox-groff.el   |  2 +-
 contrib/lisp/ox-s5.el  |  2 +-
 contrib/lisp/ox-taskjuggler.el |  2 +-
 contrib/scripts/org-docco.org  |  8 
 14 files changed, 36 insertions(+), 39 deletions(-)

diff --git a/contrib/lisp/ob-tcl.el b/contrib/lisp/ob-tcl.el
index 091eb5d09..d269ad38a 100644
--- a/contrib/lisp/ob-tcl.el
+++ b/contrib/lisp/ob-tcl.el
@@ -31,7 +31,7 @@
 ;;; Code:
 (require 'ob)
 (require 'ob-eval)
-(eval-when-compile (require 'cl))
+(eval-when-compile (require 'cl-lib))
 
 (defvar org-babel-tangle-lang-exts)
 (add-to-list 'org-babel-tangle-lang-exts '("tcl" . "tcl"))
diff --git a/contrib/lisp/org-choose.el b/contrib/lisp/org-choose.el
index c1006d095..799fd917f 100644
--- a/contrib/lisp/org-choose.el
+++ b/contrib/lisp/org-choose.el
@@ -62,9 +62,7 @@
 ;;; Requires
 
 (require 'org)
-	;(eval-when-compile
-	;   (require 'cl))
-(require 'cl)
+(require 'cl-lib)
 
 ;;; Body
 ;;; The variables
@@ -357,7 +355,7 @@ setting was changed."
 (defun org-choose-get-index-in-keywords (ix all-keywords)
   "Return the index of the current entry."
   (if ix
-  (position ix all-keywords
+  (cl-position ix all-keywords
 		:test #'equal)))
 
 ;;; org-choose-get-entry-index
diff --git a/contrib/lisp/org-depend.el b/contrib/lisp/org-depend.el
index 263cd7175..6d0aaba2e 100644
--- a/contrib/lisp/org-depend.el
+++ b/contrib/lisp/org-depend.el
@@ -155,8 +155,7 @@
 ;;
 
 (require 'org)
-(eval-when-compile
-  (require 'cl))
+(eval-when-compile (require 'cl-lib))
 
 (defcustom org-depend-tag-blocked t
   "Whether to indicate blocked TODO items by a special tag."
@@ -281,13 +280,13 @@ This does two different kinds of triggers:
 			  (from-bottom items)
 			  ((or from-current no-wrap)
 			   (let* ((items (nreverse items))
-  (pos (position this-item items :key #'first))
-  (items-before (subseq items 0 pos))
-  (items-after (subseq items pos)))
+  (pos (cl-position this-item items :key #'first))
+  (items-before (cl-subseq items 0 pos))
+  (items-after (cl-subseq items pos)))
  (if no-wrap items-after
    (append items-after items-before
 			  (t (nreverse items
-		  (setq items (remove-if
+		  (setq items (cl-remove-if
 			   (lambda (item)
  (or (equal (first item) this-item)
  (and (not todo-and-done-only)
diff --git a/contrib/lisp/org-invoice.el b/contrib/lisp/org-invoice.el
index 686889411..8d9f1a8ba 100644
--- a/contrib/lisp/org-invoice.el
+++ b/contrib/lisp/org-invoice.el
@@ -52,7 +52,7 @@
 ;;
 ;; git clone git://pmade.com/elisp
 (eval-when-compile
-  (require 'cl)
+  (require 'cl-lib)
   (require 'org))
 
 (declare-function org-duration-from-minutes "org-duration" (minutes  fmt fractional))
diff --git a/contrib/lisp/org-learn.el b/contrib/lisp/org-learn.el
index dfce196b1..50e9fa22c 100644
--- a/contrib/lisp/org-learn.el
+++ b/contrib/lisp/org-learn.el
@@ -35,7 +35,7 @@
 
 (require 'org)
 (eval-when-compile
-  (require 'cl))
+  (require 'cl-lib))
 
 (defgroup org-learn nil
   "Options concerning the learning code in Org-mode."
@@ -112,7 +112,7 @@ OF matrix."
 	(mod2 (/ (1- interval-used) interval-used))
 	;; the number determining how many times the OF value will
 	;; increase or decrease
-	modifier)
+	modifier new-of)
 (if (< mod5 1.05)
 	(setq mod5 1.05))
 (if (< mod2 0.75)
@@ -159,7 +159,7 @@ OF matrix."
   (let* ((learn-str (org-entry-get (point) "LEARN_DATA"))
 	 (learn-data (or (and learn-str
 			  (read learn-str))
-			 (copy-list initial-repetition-state)))
+			 (cl-copy-list initial-repetition-state)))
 	 closed-dates)
 (setq learn-data
 	  (determine-next-interval (nth 1 learn-data)
diff --git a/contrib/lisp/org-notify.el b/contrib/lisp/org-notify.el
index 9f8677871..ce0bc07c9 100644
--- a/contrib/lisp/org-notify.

Re: [BUG] org-fill-paragraph [M-q] not apply on last paragraph

2020-07-06 Thread Richard Kim


I see the problem as well using very latest org source code, i.e., this change

  * 2020-07-06 12:05:18 +0200 07a4a7286 Nicolas Goaziou list: Fix regression 
when inserting items

I created two long lines separated by a blank line.
Each long line was created by typing "0 1 2 3 4 5 6 7 8 9 " then repeating it 7 
more times.

There are multiple problems.

1. Select both long lines and the blank line in between.
   M-q fills the first line but not the second one.

2. Select only the second line.
   M-q fills the first line, i.e., the line that was not selected!
   It does not fill the second line.

3. The problem occurs whether the long lines are delimited between
   #+begin_src ... #+end_src or not.

4. Select only the first line.
   M-q does nothing!

5. Select first line plus the following blank line.
   M-q fills first line.

6. The problem occurs for normal emacs mode as well vim mode within spacemacs.




Re: patch for org-confluence.el to add menu entry

2020-04-11 Thread Richard Kim
How about this:

Add key binding for converting org mode to Confluence wiki, i.e.,
'C-x C-e f f' converts current org buffer to a temporary buffer
holding Confluence wiki markup.

This key binding takes effect only when org-confluence.el file
in contrib directory is loaded first.

---

As far as I now, there is no way to make this new key binding work
along with autoload so that it just works.  I think org-confluence.el
has to be loaded first for the key binding to take effect.  I just
need to do (load "org-confluence") in my startup file.


From: Nicolas Goaziou 
Sent: Saturday, April 11, 2020 2:04 PM
To: Richard Kim 
Cc: emacs-orgmode@gnu.org 
Subject: Re: patch for org-confluence.el to add menu entry

Hello,

Richard Kim  writes:

> I would like to suggest the following patch so that I can easily export
> to Confluence wiki format using the usual org-mode export mechanism.

Sure. Could you write a proper commit message and send it again?

Thank you.

Regards,

--
Nicolas Goaziou


patch for org-confluence.el to add menu entry

2020-04-09 Thread Richard Kim
I would like to suggest the following patch so that I can easily export 
to Confluence wiki format using the usual org-mode export mechanism.

Given the trivial change, I don't think I need to sign any papers.
However I have already signed copyright forms with FSF years ago.

#+begin_src diff
diff --git a/contrib/lisp/ox-confluence.el b/contrib/lisp/ox-confluence.el
index b521b247..c12d1a05 100644
--- a/contrib/lisp/ox-confluence.el
+++ b/contrib/lisp/ox-confluence.el
@@ -60,7 +60,10 @@
 (template . org-confluence-template)
 (timestamp . org-confluence-timestamp)
 (underline . org-confluence-underline)
-(verbatim . org-confluence-verbatim)))
+(verbatim . org-confluence-verbatim))
+  :menu-entry
+  '(?f "Export to Confluence"
+   ((?f "As Confluence buffer" org-confluence-export-as-confluence
 
 (defcustom org-confluence-lang-alist
   '(("sh" . "bash"))
#+end_src





restore window configuration after org-edit-src-exit

2019-12-16 Thread Richard Kim
About a year ago change 819e98afd018cad3c13fd58bfcbd979ab36dfbc7 was checked in
to remove code that restored window configuration when =org-edit-src-exit=
finished. The net result is af if =C-x 1= is called to remove all windows except
the org buffer just edited. This is very inconvenient.

Why not call =winner-undo= to restore window configuration as shown here?

#+begin_src diff
>From bd0a2abaa8097338d7f33c7ca9a1d45f5da67e7a Mon Sep 17 00:00:00 2001
From: kimr 
Date: Sat, 14 Dec 2019 10:59:00 -0800
Subject: [PATCH] restore window config by calling winner-undo

---
 lisp/org-src.el | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lisp/org-src.el b/lisp/org-src.el
index 5e50a1b4..c8c30889 100644
--- a/lisp/org-src.el
+++ b/lisp/org-src.el
@@ -1182,7 +1182,8 @@ Throw an error if there is no such buffer."
(write-back (org-src--goto-coordinates coordinates beg end
 ;; Clean up left-over markers and restore window configuration.
 (set-marker beg nil)
-(set-marker end nil)))
+(set-marker end nil)
+(winner-undo)))
 
 
 (provide 'org-src)
-- 
2.22.1
#+end_src


For now I'm using the following advice do the same thing.


#+begin_src elisp
(defadvice org-edit-src-exit (after restore-window-config activate)
  (winner-undo))
#+end_src





Re: [O] org-link-set-parameters missing in ELPA version

2016-09-11 Thread Richard Kim
 
I added the following elisp code at the start of my ~/.emacs to deal
with this problem. My analysis of the problem is described in the
comments. In short the root cause seems to be loading built-in org.el
during initialization rather than org.el from either org-plus-contrib or
org add-on packages.  Symbols such as org-link-set-parameters are not
defined in built-in org.el of emacs 25. They are defined only in newer
versions of org package.

I use my own build of the following which is re-built once a week or two:
- emacs 25 from 'emacs-25' git branch
- org and org-plus-contribute packages from git source files
- spacemacs from 'develop' git branch

If I have erred in my analysis of the root cause, please let me know.
What I know is that before I started using the code below, I would get
emacs startup error every time after I removed all installed packages.
With this code, I no longer see any failure.


;; Bootstrap `org-plus-contrib' and/or `org' packages


;; The purpose of this section is to make sure that org-mode package(s) are
;; installed and setup early on so as to prevent built-in org-mode files from
;; getting loaded. The built-in org-mode commands are autoloaded so that none
;; of the built-in org files are actually loaded when emacs starts up. However
;; it is easy to get one or more org files to get loaded directly or indirectly
;; by using one or more org mode functions. Once that happens, then it is
;; nearly impossible to fix this. For example if built-in org.el gets loaded,
;; then subsequent (require 'org) will not reload org.el even if an org package
;; was installed which provided newer org.el! A workaround is to make sure that
;; the org package(s) are not only installed, but also activated (i.e.,
;; `load-path' setup) so that the first time (require 'org) is done, it will
;; cause the newer org.el to be loaded rather than the built in one.


;; Where to find packages to install from. If spacemacs is loaded, then it is
;; important that `package-archives' value here is the same as the one embedded
;; in spacemacs. Otherwise strange errors may pop up.
(if (file-directory-p "/u/me/public_html/elpa/elpa/")
(custom-set-variables
 `(package-archives
   `(("my-elpa" . ,(expand-file-name "/u/me/public_html/elpa/elpa/"))
 ("my-orgmode" . ,(expand-file-name 
"/u/me/public_html/elpa/orgmode/")
  (custom-set-variables
   `(package-archives
 `(("melpa" . "https://melpa.org/packages/;)
   ("orgmode" . "http://orgmode.org/elpa/;
  )

;; Where to install packages to.  Spacemacs honors this as of about Aug 2016.
(setq package-user-dir "/u/me/opt/elpa25/")

;; Do not activate all installed packages at the end of startup processing.
;; I activate packages as needed.
(setq package-enable-at-startup nil)

;; We must initialize packages before we can call `package-installed-p'.
;; However just do minimal setup (via 'no-activate optional argument), i.e., do
;; not activate any packages. Without `no-activate', all installed packages are
;; activated.
(unless (bound-and-true-p package--initialized)
  (package-initialize 'no-activate)
  (package-refresh-contents)

;; I use `use-package' to install and setup all packages except `use-pacakge'
;; itself. You can't use it if it is not already installed and activated. So
;; make sure that it is installed and setup using only built-in package.el
;; functions.
(if (package-installed-p 'use-package)
(package-activate 'use-package) ; just activate if already installed
  (package-install 'use-package))

;; We *must* install `org-plus-contrib' or `org' package very early on so that
;; these shadow the built-in org-mode files. If this is not done early, and one
;; or more of the built-in org-mode files are loaded during emacs startup, then
;; failures may arise later on while installing `org-plus-contrib' or `org'
;; packages. Typical errors in such case are "void-function
;; org-link-set-parameters" or "void-function org-link-types". Such errors
;; started popping up with spacemacs around August 2016 when emacs is started
;; after removing all installed packages which forced installation of all
;; needed packages.
;;
;; The need to install this early on is the reason for all the setup done so 
far.
(use-package org-plus-contrib :ensure t :defer t)


;; Setup spacemacs


(setq spacemacs-start-directory "/u/me/opt/spacemacs/")
(load-file (expand-file-name "init.el" spacemacs-start-directory))


;; Setup my stuff


(load "/u/me/Private/elisp/init.el")


Heikki 

[O] patch for HTML links to GNU documents

2016-03-27 Thread Richard Kim
Attached patch affects how 'info' links in org mode are converted to HTML
links.  Today info links such as

[[info:emacs#List Buffers]]

are converted to this HTML link:

emacs#List Buffers

With the patch applied, the HTML link generated would be

http://www.gnu.org/software/emacs/manual/html_mono/emacs.html#List-Buffers;>emacs#List
Buffers

The general idea is that couple of list variables describe how to map
info file names to URLs so that those URL's would be used if available.

One motivation for this patch is to make it easy for elisp package
authors to to create links to wonderful emacs documents, because writing
an org info-link to emacs manual in org files is trivial once you know
the info node name.
From f0a8a7d12d90d219cd4d8f4d3d9bc580e02c255a Mon Sep 17 00:00:00 2001
From: Richard Kim <emac...@gmail.com>
Date: Thu, 10 Mar 2016 06:29:48 -0800
Subject: [PATCH] org-info.el: generate HTML links to gnu.org

* lisp/org-info.el (org-info-export): Convert info links to HTML URL's
that point to appropriate gnu.org or other pages.  User's can customize
the behavior using `org-info-emacs-documents' and
`org-info-other-documets' new variables.

TINYCHANGE
---
 lisp/org-info.el | 35 +--
 1 file changed, 33 insertions(+), 2 deletions(-)

diff --git a/lisp/org-info.el b/lisp/org-info.el
index 270c19f..e7ff9ed 100644
--- a/lisp/org-info.el
+++ b/lisp/org-info.el
@@ -81,6 +81,37 @@
 nodename-or-index)
 (user-error "Could not open: %s" name)))
 
+(defvar org-info-emacs-documents
+  '("ada-mode" "auth" "autotype" "bovine" "calc" "ccmode" "cl" "dbus" "dired-x"
+"ebrowse" "ede" "ediff" "edt" "efaq-w32" "efaq" "eieio" "eintr" "elisp"
+"emacs-gnutls" "emacs-mime" "emacs" "epa" "erc" "ert" "eshell" "eudc" "eww"
+"flymake" "forms" "gnus" "htmlfontify" "idlwave" "ido" "info" "mairix-el"
+"message" "mh-e" "newsticker" "nxml-mode" "octave-mode" "org" "pcl-cvs"
+"pgg" "rcirc" "reftex" "remember" "sasl" "sc" "semantic" "ses" "sieve"
+"smtpmail" "speedbar" "srecode" "todo-mode" "tramp" "url" "vip" "viper"
+"widget" "wisent" "woman")
+  "List of emacs documents available at the official URL
+<http://www.gnu.org/software/emacs/manual/html_mono/.>")
+
+(defvar org-info-other-documents
+  '(("gcc"  . "https://gcc.gnu.org/onlinedocs/gcc-5.3.0/gcc/index.html;)
+("libc" . "http://www.gnu.org/software/libc/manual/html_mono/libc.html;)
+("make" . "http://www.gnu.org/software/make/manual/index.html;))
+  "Alist of documents generated from texinfo source.
+
+When converting info links to html, links to any one of these manuals
+are converted to point to these links.")
+
+(defun org-info-map-html-url (filename)
+  "Given info FILENAME, either return it or convert it to URL pointing
+to the official page on internet, e.g., use gnu.org for all emacs related documents.
+See `org-info-official-gnu-document' and `org-info-other-documents' for details."
+  (if (member filename org-info-emacs-documents)
+  (format "http://www.gnu.org/software/emacs/manual/html_mono/%s.html;
+  filename)
+(let ((url (cdr (assoc filename org-info-other-documents
+  (or url (concat filename ".html")
+
 (defun org-info-export (path desc format)
   "Export an info link.
 See `org-add-link-type' for details about PATH, DESC and FORMAT."
@@ -89,8 +120,8 @@ See `org-add-link-type' for details about PATH, DESC and FORMAT."
 	(string-match "\\(.*\\)" path))
 (let ((filename (match-string 1 path))
 	  (node (or (match-string 2 path) "Top")))
-  (format "%s"
-	  filename
+  (format "%s"
+	  (org-info-map-html-url filename)
 	  (replace-regexp-in-string " " "-" node)
 	  (or desc path)
 
-- 
2.5.0



Re: [O] patch to add new link type infoi that leverages Info-index command

2014-11-09 Thread Richard Kim
Nicolas,

Thanks for your feedback.  I agree that using the same link type is better.
Hence I took an alternate approach as detailed in the attached patch.
 Enhanced org-info-follow-link to attempt index lookup if node lookup fails.
Following is my check in message found in the attached patch:

Enhanced org-info-follow-link to attempt index lookup if node lookup
fails.

Info index is almost always finer grain than info nodes.  For example
with this change, [[info:libc#close]] brings up not only
(libc)Opening and Closing Files info node, but also place the cursor
on the line that documents close function within the node.  This is
done by looking up closein the index upon failing to find a node
named close.  Hence one can now link function, variable and other
names that are in the index rather than being limited to info node
names.  Typically there are far more index items than there are node
names.  For example libc manual has about 700 nodes, but over
4000 concept, type, function, and variables index items.



On 6 November 2014 10:41, Nicolas Goaziou m...@nicolasgoaziou.fr wrote:

 Hello,

 Richard Kim emac...@gmail.com writes:

  A patch is provided below which implements a new link type called infoi
  as a complement to info type that exist already.

 Thanks for your patch.

  Why new link type?  Because info index is almost always finer grain
  than info nodes.  For example [[infoi:libc#close]] brings up not only
  (libc)Opening and Closing Files info node, but also place the cursor
  on the line that documents open function within the node.  Hence it
  is more useful to link function, variable and other names that are in
  the index.  Most info documents have very rich indexes.

 OK. I would have preferred to merge both features into the same link
 type, but I see no elegant syntax to distinguish between a node and an
 index search.

  I am not familiar with org coding style, so I share this patch to
  present the idea rather than as a finished patch that can be checked
  in.  I assume that name changes and other changes will be needed prior
  to being acceptable for check in assuming that the idea is ok.

 The idea is OK. Some comments follow.

  org-info.el: Add new link type infoi that looks up info file index.

 No full stop at the end of the summary.

  * lisp/org-info.el (org-info-index-open): New function to implement
  new link type named infoi.

 New function is enough here.

 You can describe the motivation behind the patch farther in the commit
 message, after another blank line.

  +;;; info-index
  +
  +(org-add-link-type infoi 'org-info-index-open)
  +
  +(declare-function Info-index info (topic))
  +
  +(defun org-info-index-open (name)
  +  Follow an Info file and look up index item specified by NAME.
  +  (if (or (string-match \\(.*\\)[#:]:?\\(.*\\) name)
  +  (string-match \\(.*\\) name))
  +  (let ((nodename (match-string 2 name)))
  +(require 'info)
  +(Info-find-node (match-string 1 name) Top)
  +(if nodename ; If there isn't a node, choose Top
  +(Info-index nodename)))

 Prefer `when' over one-armed `if'.

  +(message Could not open: %s name)))

 This introduce some code duplication in org-info.el. Could you factor
 it out?


 Regards,

 --
 Nicolas Goaziou

From c850804267f343d020f91499e18cbde84a3fb897 Mon Sep 17 00:00:00 2001
From: Kim emac...@gmail.com
Date: Sun, 9 Nov 2014 19:43:18 -0800
Subject: [PATCH] Enhanced org-info-follow-link to attempt index lookup if node
 lookup fails.

Info index is almost always finer grain than info nodes.  For example
with this change, [[info:libc#close]] brings up not only
(libc)Opening and Closing Files info node, but also place the cursor
on the line that documents close function within the node.  This is
done by looking up closein the index upon failing to find a node
named close.  Hence one can now link function, variable and other
names that are in the index rather than being limited to info node
names.  Typically there are far more index items than there are node
names.  For example libc manual has about 700 nodes, but over
4000 concept, type, function, and variables index items.
---
 doc/org.texi |  2 +-
 lisp/org-info.el | 15 +++
 2 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/doc/org.texi b/doc/org.texi
index db1490a..08e071d 100644
--- a/doc/org.texi
+++ b/doc/org.texi
@@ -3575,7 +3575,7 @@ gnus:group@r{Gnus group link}
 gnus:group#id @r{Gnus article link}
 bbdb:R.*Stallman  @r{BBDB link (with regexp)}
 irc:/irc.com/#emacs/bob   @r{IRC link}
-info:org#External links   @r{Info node link}
+info:org#External links   @r{Info node or index link}
 shell:ls *.org@r{A shell command}
 elisp:org-agenda  @r{Interactive Elisp command}
 elisp

[O] patch to add new link type infoi that leverages Info-index command

2014-11-01 Thread Richard Kim
A patch is provided below which implements a new link type called infoi
as a complement to info type that exist already.

Why new link type?  Because info index is almost always finer grain
than info nodes.  For example [[infoi:libc#close]] brings up not only
(libc)Opening and Closing Files info node, but also place the cursor
on the line that documents open function within the node.  Hence it
is more useful to link function, variable and other names that are in
the index.  Most info documents have very rich indexes.

I am not familiar with org coding style, so I share this patch to
present the idea rather than as a finished patch that can be checked
in.  I assume that name changes and other changes will be needed prior
to being acceptable for check in assuming that the idea is ok.

ChangeLog entry is followed by the git diff of my change.



org-info.el: Add new link type infoi that looks up info file index.

* lisp/org-info.el (org-info-index-open): New function to implement
new link type named infoi.



diff --git a/doc/org.texi b/doc/org.texi
index 3fcf4b2..3aedefe 100644
--- a/doc/org.texi
+++ b/doc/org.texi
@@ -3576,6 +3576,7 @@ gnus:group#id @r{Gnus
article link}
 bbdb:R.*Stallman  @r{BBDB link (with regexp)}
 irc:/irc.com/#emacs/bob   @r{IRC link}
 info:org#External links   @r{Info node link}
+infoi:org#topic   @r{Info index link}
 shell:ls *.org@r{A shell command}
 elisp:org-agenda  @r{Interactive Elisp command}
 elisp:(find-file-other-frame Elisp.org) @r{Elisp form to evaluate}
diff --git a/lisp/org-info.el b/lisp/org-info.el
index 8a2d717..bb65347 100644
--- a/lisp/org-info.el
+++ b/lisp/org-info.el
@@ -74,6 +74,23 @@
   (Info-find-node (match-string 1 name) Top)))
 (message Could not open: %s name)))

+;;; info-index
+
+(org-add-link-type infoi 'org-info-index-open)
+
+(declare-function Info-index info (topic))
+
+(defun org-info-index-open (name)
+  Follow an Info file and look up index item specified by NAME.
+  (if (or (string-match \\(.*\\)[#:]:?\\(.*\\) name)
+  (string-match \\(.*\\) name))
+  (let ((nodename (match-string 2 name)))
+(require 'info)
+(Info-find-node (match-string 1 name) Top)
+(if nodename ; If there isn't a node, choose Top
+(Info-index nodename)))
+(message Could not open: %s name)))
+
 (provide 'org-info)

 ;;; org-info.el ends here


[O] [PATCH] orgguide.texi: Replace spaces with tabs in two menu lines to be consistent with all other menu lines.

2014-05-03 Thread Richard Kim
Why this trivial patch?  As I make changes to orgguide.texi, I may
invoke texinfo-all-menus-update or texinfo-every-node-update elisp
commands.  When I do the spaces are replaced with tabs.  I would
rather not have to deal with these changes when I view git diff.
Besides I think using white spaces consistently is a good thing.

I submitted this email following the instruction at
http://orgmode.org/worg/org-contribute.html.
Please let me know if I could have done better.
Thanks.

---
 doc/orgguide.texi |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/doc/orgguide.texi b/doc/orgguide.texi
index f93b99a..a3470bd 100644
--- a/doc/orgguide.texi
+++ b/doc/orgguide.texi
@@ -211,7 +211,7 @@ Exporting
 * ASCII/Latin-1/UTF-8 export:: Exporting to flat files with encoding
 * HTML export::Exporting to HTML
 * @LaTeX{} and PDF export::Exporting to @LaTeX{}, and processing to PDF
-* iCalendar export::Exporting to iCalendar
+* iCalendar export::   Exporting to iCalendar
 
 Miscellaneous
 
@@ -2307,7 +2307,7 @@ that planning information can be incorporated into 
desktop calendars.
 * ASCII/Latin-1/UTF-8 export:: Exporting to flat files with encoding
 * HTML export::Exporting to HTML
 * @LaTeX{} and PDF export::Exporting to @LaTeX{}, and processing to PDF
-* iCalendar export::Exporting to iCalendar
+* iCalendar export::   Exporting to iCalendar
 @end menu
 
 @node Export options, The export dispatcher, Exporting, Exporting
-- 
1.7.9.5




[O] Bug: need to eval-when-compile org-compat [8.0.5 (8.0.5-elpaplus @ /u/kimr/elisp/emacs-24/org-plus-contrib-20130704/)]

2013-07-07 Thread Richard Kim
Line 83 of org.el nees to be changed from

  (require 'org-compat)

to

  (eval-when-compile (require 'org-compat))

in order to prevent (invalid-function org-with-silent-modifications)
error when an org file is loaded and `C-x C-e h h' is hit to export to
a file.  The call stack is

  org-with-silent-modifications
  org-refresh-category-properties
  org-get-category
  org-entry-properties
  org-element-headline-parser
  org-element--current-element
  org-element--parse-elements
  org-element-parse-buffer
  org-export-filter-apply-functions
  org-export-as
  org-export-to-file
  org-html-export-to-html
  org-export-dispatch
  call-interactively(org-export-dispatch nil nil)

This occured on emacs-24 (which I compiled using latest version from
http://bzr.savannah.gnu.org/r/emacs/emacs-24/ branch as of July 6,
2013).  This is with org-plus-contrib-20130704.tar ELPA package
installed.

I can work around (invalid-function org-with-silent-modifications)
problem if I byte compile org.el again after making sure that org-compat
is loaded.  However it seems like to me that one should not have to mess
with files byte compiled as part of `M-x package-install'.  That is why
I think the one line change suggested above should be made.

Emacs  : GNU Emacs 24.3.1 (x86_64-unknown-linux-gnu, GTK+ Version 2.24.10)
 of 2013-07-06 on kimr-laptop
Package: Org-mode version 8.0.5 (8.0.5-elpaplus @ 
/u/kimr/elisp/emacs-24/org-plus-contrib-20130704/)



[O] Bug: error on html export [7.9.3e (7.9.3e-3-gb07a9b @ /u/kimr/src/emacs/emacs-trunk_latest/lisp/org/)]

2013-02-24 Thread Richard Kim

Starting with emacs bzr trunk revision 111688 of Feb 7, 2013,
following three line org file results in error when html export is
attempted.

-- start of foo.org 
#+TITLE: Nothing

# file:/tmp
-- end   of foo.org 

To see the problem, load the three line org file, then hit `C-c C-e h'.
It results in the following stack trace:

Debugger entered--Lisp error: (wrong-type-argument stringp nil)
  string-match(\\([^]\\)\\([_^]\\) nil)
  org-export-protect-sub-super(nil)
  org-export-normalize-links()
  org-export-preprocess-string(#(#+TITLE: Nothing\n\n# file:/tmp\n 0 
8 (fontified t font-lock-fontified t org-category foo face 
org-document-info-keyword) 8 13 (fontified t org-category foo) 13 21 
(fontified t org-category foo font-lock-fontified t face org-document-title) 
21 22 (fontified t font-lock-fontified t org-category foo) 22 24 (fontified t 
font-lock-fontified t org-category foo face font-lock-comment-face) 24 30 
(fontified t font-lock-fontified t org-category foo org-no-flyspell t 
mouse-face highlight face font-lock-comment-face keymap (keymap (follow-link . 
mouse-face) (mouse-3 . org-find-file-at-mouse) (mouse-2 . org-open-at-mouse))) 
30 31 (fontified t font-lock-fontified t org-category foo rear-nonsticky 
(mouse-face highlight keymap invisible intangible help-echo org-linked-text 
htmlize-link) org-no-flyspell t mouse-face highlight face 
font-lock-comment-face keymap (keymap (follow-link . mouse-face) (mouse-3 . 
org-find-file-at-mouse) (mouse-2 . org-open-at-mouse))) 31 32 
(font-lock-fontified t fontified t org-category foo rear-nonsticky 
(mouse-face highlight keymap invisible intangible help-echo org-linked-text 
htmlize-link) org-no-flyspell t mouse-face highlight face 
font-lock-comment-face keymap (keymap (follow-link . mouse-face) (mouse-3 . 
org-find-file-at-mouse) (mouse-2 . org-open-at-mouse))) 32 33 
(font-lock-fontified t fontified t org-category foo rear-nonsticky 
(mouse-face highlight keymap invisible intangible help-echo org-linked-text 
htmlize-link) org-no-flyspell t mouse-face highlight face 
font-lock-comment-face keymap (keymap (follow-link . mouse-face) (mouse-3 . 
org-find-file-at-mouse) (mouse-2 . org-open-at-mouse))) 33 34 (fontified t 
org-category foo)) :emph-multiline t :for-backend html 
:skip-before-1st-heading nil :drawers nil :todo-keywords t :tasks t :tags 
not-in-toc :priority nil :footnotes t :timestamps t :archived-trees headline 
:select-tags (export) :exclude-tags (noexport) :add-text nil 
:LaTeX-fragments t)
  org-export-as-html(nil)
  call-interactively(org-export-as-html)
  org-export(nil)
  call-interactively(org-export nil nil)

I believe this bug was introduced by bzr version 111688 which has this comment

2013-02-07  Bastien Guerry  b...@gnu.org

* org-exp.el (org-export-normalize-links): Don't match links
within tags.

along with this code change:

=== modified file 'lisp/org/org-exp.el'
--- lisp/org/org-exp.el 2013-01-08 14:27:18 +
+++ lisp/org/org-exp.el 2013-02-07 07:11:59 +
@@ -2113,7 +2113,8 @@
   (put-text-property (match-beginning 0) (match-end 0) 
'org-normalized-link t))
 (goto-char (point-min))
 (while (re-search-forward re-plain-link nil t)
-  (unless (get-text-property (match-beginning 0) 
'org-normalized-link)
+  (unless (or (get-text-property (match-beginning 0) 
'org-normalized-link)
+ (assoc :tags (org-context)))
(goto-char (1- (match-end 0)))
(org-if-unprotected-at (1+ (match-beginning 0))
  (let* ((s (concat (match-string 1)

If I revert this change, then the error goes away.

Since # file:/tmp is a comment line, shouldn't the link be ignored
instead of causing an error?



Emacs  : GNU Emacs 24.3.50.1 (x86_64-unknown-linux-gnu, GTK+ Version 2.24.10)
 of 2013-02-22 on kimr-e6410
Package: Org-mode version 7.9.3e (7.9.3e-3-gb07a9b @ 
/u/kimr/src/emacs/emacs-trunk_latest/lisp/org/)

current state:
==
(setq
 org-export-preprocess-before-selecting-backend-code-hook 
'(org-beamer-select-beamer-code)
 org-tab-first-hook '(org-hide-block-toggle-maybe
  org-src-native-tab-command-maybe
  org-babel-hide-result-toggle-maybe
  org-babel-header-arg-expand)
 org-speed-command-hook '(org-speed-command-default-hook
  org-babel-speed-command-hook)
 org-occur-hook '(org-first-headline-recenter)
 org-metaup-hook '(org-babel-load-in-session-maybe)
 org-export-preprocess-before-normalizing-links-hook 
'(org-remove-file-link-modifiers)
 org-confirm-shell-link-function 'yes-or-no-p
 org-export-latex-final-hook '(org-beamer-amend-header org-beamer-fix-toc