Re: [O] patch for HTML links to GNU documents

2016-03-28 Thread Richard Y. Kim
Nicolas Goaziou  writes:

> Hello,
>
> Richard Kim  writes:
>
>> 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
>
> Thank you. Some comments follow.
>
>> +(defvar org-info-emacs-documents
>
> I suggest to use `defconst' instead, since you're not modifying or
> let-binding the variable whatsoever.
>
>> +  '("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
>> +")
>
> The first sentence in the docstring is expected to be on a single line,
> e.g.
>
>   "List of emacs documents available.
>   Taken from "
>
>> +(defvar org-info-other-documents
>
> `defconst'
>
> Could you also write an entry about it in ORG-NEWS?

Nicolas,

I made all the changes that you suggested in the attached patch.
Please let me know if further changes are needed.

I mailed in my signed licensing paper for emacs to FSF today, so that it
FSF should get it later this week.

>From 20adf43716f602e0c4be1a427bf8c6afd5e44c7e Mon Sep 17 00:00:00 2001
From: Richard Kim 
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
---
 etc/ORG-NEWS | 14 ++
 lisp/org-info.el | 35 +--
 2 files changed, 47 insertions(+), 2 deletions(-)

diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS
index 4e6c7cb..3ddc3f9 100644
--- a/etc/ORG-NEWS
+++ b/etc/ORG-NEWS
@@ -317,6 +317,20 @@ called with 6 parameters.
 *** =ITEM= special property returns headline without stars
 *** Rename ~org-insert-columns-dblock~ into ~org-columns-insert-dblock~
 The previous name is, for the time being, kept as an obsolete alias.
+*** Function ~org-info-export~ changes.
+HTML links created from certain info links now point to =gnu.org= URL's rather
+than just to local files. For example info links such as =info:emacs#List
+Buffers= used to be converted to HTML links like this:
+
+: emacs#List Buffers
+
+where local file =emacs.html= is referenced.
+For most folks this file does not exist.
+Thus the new behavior is to generate this HTML link instead:
+
+: http://www.gnu.org/software/emacs/manual/html_mono/emacs.html#List-Buffers";>emacs#List Buffers
+
+All emacs related info links are similarly translated plus few other =gnu.org= manuals.
 * Version 8.3
 
 ** Incompatible changes
diff --git a/lisp/org-info.el b/lisp/org-info.el
index 270c19f..07693fe 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)))
 
+(defconst 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.
+Taken from ")
+
+(defconst org-info-other-documents
+  '(("libc" . "http://www.gnu.org/software/libc/manual/html_mono/libc.html";)
+("make" . "http://www.gnu.org/software/make/manual/make.html";))
+  "Alist of documents generated from texinfo source.
+
+When converting info links to html, links to any one of these manuals are
+converted to use these URL's.")
+
+(defun org-info-map-html-url (filename)
+  "Given info FILENAME, either return it (plus '.html' suffix added) or convert
+it to URL pointing to the official page on 

Re: [O] Links to Info manuals in exported HTML/LaTeX

2015-08-27 Thread Richard Y. Kim
Marcin Borkowski  writes:

> Hi all,
>
> it seems that links to Info manuals are broken in HTML and LaTeX export
> (and possibly in other backends, too).
>
> Would it make sense to make them work, i.e., link to the official web
> versions, at least for standard Info manuals, like Emacs manual, Elisp
> reference or Org manual?

It is not broken for my use case.  I like the fact that 

[[info:emacs#Top][Emacs Manual]]

is turned into

Emacs Manual

because I generated emacs.html, elisp.html, org.html, etc. all in
my ~/public_html/ or sub-directories.  Hence 
Emacs Manual
works fine for my use case.  It is a lot faster to access GNU manuals
when they are all on local host.

Should the current behavior be the default?  Perhaps not.  I believe
makeinfo and/or texi2html generates html links pointing to the official
pages at gnu.org.  This could be the default behavior, but I hope not
the *only* behavior.  If current export code is to be changed, I would
like to see user selectable option so that I can choose to use the
current behavior.



[O] incorrect HTML rendering of info links with spaces

2015-04-08 Thread Richard Y. Kim

It seems like org-html-publish-to-html does not translate info links
properly in generated HTML files.  The problem is that spaces in info
nodes should be converted to dashes, but instead spaces are left as is.

For example org-mode link [[info:elisp#Hash Tables]] is converted as 

elisp#Hash Tables

when in fact the correct URL that should be generated is

elisp#Hash Tables

where a dash is used in the URL as well as ".html" suffix.

Why should it be "-" instead of " "?  Simply because that is the
convention used by GNU makeinfo when translating texinfo files into HTML
output.  For example

http://www.gnu.org/software/emacs/manual/html_mono/elisp.html#Hash-Tables

is the correct URL rather than this incorrect URL:

http://www.gnu.org/software/emacs/manual/html_mono/elisp.html#Hash%20Tables

So today if I hit C-c C-o on [[info:elisp#Hash Tables]] link, then it
correctly brings up "(elisp) Hash Tables" info node.  However the
generated HTML link does not work.  On the other hand
[[info:elisp#Hash-Tables]] with a dash rather than space generates valid
HTML link (ignoring missing ".html" suffix), but C-c C-o fails to work.
It would be very useful if the same org link such as [[info:elisp#Hash
Tables]] works for both C-c C-o as well as generate valid HTML link.

This issue is important to me, because I would rather use org-mode than
texinfo to write documentation on emacs packages with many links
pointing to the official emacs and elisp manuals.  Right now lack of
proper support for info links in org-mode is the *only* reason why I
currently use texinfo rather than org-mode.



Re: [O] Bleeding edge in elpa

2015-03-09 Thread Richard Y. Kim
tftor...@tftorrey.com (T.F. Torrey) writes:

> I wonder how much effort it would take to copy onto my own machine the
> scripts on the server that package the git maint version into an ELPA
> version, and modify them to package master instead.  Probably not much.

The shell script below is what I use to create my own org-plus-contrib
ELPA package.

Rather than relying on elpa.gnu.org, melpa.org, orgmode.org/elpa, etc.,
I've been creating my own packages over the past year or so.  This way I
know exactly which packages are installed in not only my emacs, but my
colleagues who use my packages.  So far this has worked out great for
me.


#!/bin/sh

# This script builds org-plus-contrib-MMDD.tar ELPA package from the git
# clone of org-mode.

if [ ! -f mk/server.mk ]; then
  echo "Current directory must be org-mode root directory"
  exit 1
fi

# Where to install the tarballs 
SERVROOT=$HOME/public_html/elpa/orgmode

# server.mk has the elpaplus makefile target
echo " include mk/server.mk" >> Makefile

make SERVROOT=$SERVROOT elpaplus elpaplus-up

# Undo the change made above
git checkout Makefile
rm -f archive-contents

# $SERVROOT/org-plus-contrib-MMDD.tar
# should now be created with today as value of MMDD.



[O] [PATCH] org-contribute: fix a type by changing "column" to "colon"

2014-11-15 Thread Richard Y. Kim
Attached patch fixes a typo and also removes trailing white spaces.

The white spaces were removed due to adding a hook to remove them as
shown here:

(defun kimr-before-save-hook ()
  "Delete trailing white spaces only in a few modes."
  (when (eq major-mode 'org-mode)
(delete-trailing-whitespace)))

(add-hook 'before-save-hook 'kimr-before-save-hook)

Please let me know if trailing white spaces should not be removed in
general so that I will omit such changes in future patches.
Thanks.

>From 06bb6361813dad0f1ac111c573f5dd325c47d9e7 Mon Sep 17 00:00:00 2001
From: Kim 
Date: Sat, 15 Nov 2014 10:58:25 -0800
Subject: [PATCH] org-contribute: fix a type by changing "column" to "colon"

* worg/org-contribute.org: fixed a typo.  Also removed trailing white
  spaces in 8 lines.

TINYCHANGE
---
 org-contribute.org | 18 +-
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/org-contribute.org b/org-contribute.org
index cbcee3f..c763b25 100644
--- a/org-contribute.org
+++ b/org-contribute.org
@@ -4,7 +4,7 @@
 #+OPTIONS:H:3 num:nil toc:t \n:nil ::t |:t ^:t -:t f:t *:t tex:t d:(HIDE) tags:not-in-toc
 #+STARTUP:align fold nodlcheck hidestars oddeven lognotestate
 #+SEQ_TODO:   TODO(t) INPROGRESS(i) WAITING(w@) | DONE(d) CANCELED(c@)
-#+TAGS:   Write(w) Update(u) Fix(f) Check(c) 
+#+TAGS:   Write(w) Update(u) Fix(f) Check(c)
 #+LANGUAGE:   en
 #+PRIORITIES: A C B
 #+CATEGORY:   worg
@@ -34,7 +34,7 @@ where your contribution will be useful:
 
 - you can submit *patches* -- You can submit patches to the mailing
   list.  See the [[For Org contributors: preferred way of submitting patches][Preferred way of submitting patches]] section for
-  details.  You can run =make test= to check that your patch does 
+  details.  You can run =make test= to check that your patch does
   not introduce new bugs.
 
   If your patch is against a file that is part of Emacs, then your
@@ -42,7 +42,7 @@ where your contribution will be useful:
   15 lines/ (See the [[http://bzr.savannah.gnu.org/lh/emacs/trunk/annotate/head:/etc/CONTRIBUTE][etc/CONTRIBUTE file in GNU Emacs]].)  If you
   contribute more, you have to assign the copyright of your
   contribution to the Free Software Foundation (see below).
-  
+
 - you can submit Org *add-ons* -- there are many Org add-ons.
   - The best way is to submit your code to [[file:org-mailing-list.org][the mailing list]] to discuss
 it with people.
@@ -271,7 +271,7 @@ A commit message should be constructed in the following way:
 - Line 1 of the commit message should always be a short description of
   the overall change.  Line 1 does /not/ get a dot at the end and does
   not start with a star.  Generally, it starts with the filename that
-  has been changed, followed by a column.
+  has been changed, followed by a colon.
 
 - Line 2 is an empty line.
 
@@ -283,7 +283,7 @@ A commit message should be constructed in the following way:
   : (org-timer-set-timer): Use the number of minutes in the Effort
   : property as the default timer value. Three prefix arguments will
   : ignore the Effort value property.
- 
+
 - After the changelog, another empty line should come before any
   additional information that the committer wishes to provide in order
   to explain the patch.
@@ -307,18 +307,18 @@ Here is an example for such a message:
 
 #+begin_example
   org-capture.el: Fix the case of using a template file
-  
+
   ,* lisp/org-capture.el (org-capture-set-plist): Make sure txt is a
   string before calling `string-match'.
   (org-capture-templates): Fix customization type.
 
   ,* doc/org.texi (Capture): Document using a file for a template.
-  
+
   The problem here was that a wrong keyword was given in the
   customization type.  This let to a string-match against a list value.
-  
+
   Modified from a patch proposal by Johan Friis.
-  
+
   TINYCHANGE
 #+end_example
 
-- 
1.9.1



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

2014-11-15 Thread Richard Y. Kim
Hi Nicolas,

Thanks for your feedback.  Attached is new patch which incorporates all
your suggestions except the following:

> Not directly related to your patch, but shouldn't it be
>
>   (user-error "Could not open: %s" name)

I'm not sure what you mean by this.  Do you mean that the verb "open" is
more approrpriate than "find" in the error message, i.e., "Could not
open" rather than "Could not find"?  If so, then it seems like "find" is
more appropriate since "open" seems like there was a problem with
opening a file when the problem is that a particular node was not found
after successfully opening a file.  Please let me know if I
misunderstood.  Thanks again for your valuable feedbacks.

>From 16c25b88043f6f84c6d3df14ca3018040a09fe25 Mon Sep 17 00:00:00 2001
From: Kim 
Date: Sat, 15 Nov 2014 10:37:39 -0800
Subject: [PATCH] org-info: try info index if info node is not found

* lisp/org-info.el (org-info-follow-link): Attempt index lookup if node
  lookup fails.

* doc/org.texi (External links): Update info links.

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 "close"in 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.  More examples of
new ways to create links are shown using org.info as example

- [[info:org#org-clock-idle-time]] uses "Variable Index"
- [[info:org#org-capture]] uses "Command and Function Index".
- [[info:org#timestamp]] uses "Main Index"
- [[info:org#C-c C-c]] uses "Key Index"

TINYCHANGE
---
 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 b01db2c..fcaee0c 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:(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..7c828a6 100644
--- a/lisp/org-info.el
+++ b/lisp/org-info.el
@@ -67,11 +67,18 @@
   "Follow an Info file and node link specified by NAME."
   (if (or (string-match "\\(.*\\)[#:]:?\\(.*\\)" name)
   (string-match "\\(.*\\)" name))
-  (progn
+  (let ((filename (match-string 1 name))
+	(nodename-or-index (or (match-string 2 name) "Top")))
 	(require 'info)
-(if (match-string 2 name) ; If there isn't a node, choose "Top"
-(Info-find-node (match-string 1 name) (match-string 2 name))
-  (Info-find-node (match-string 1 name) "Top")))
+	;; If nodename-or-index is invalid node name, then look it
+	;; up in the index.
+	(condition-case nil
+	(Info-find-node filename nodename-or-index)
+	  (user-error (Info-find-node filename "Top")
+		  (condition-case nil
+			  (Info-index nodename-or-index)
+			(user-error (format "Could not find '%s' node or index entry" 
+	nodename-or-index))
 (message "Could not open: %s" name)))
 
 (provide 'org-info)
-- 
1.9.1