emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Additional indices in TexInfo exporter: FR or may be just a note ...
@ 2021-04-30  7:25 Ramesh Nedunchezian
  2021-04-30 10:51 ` Nicolas Goaziou
  0 siblings, 1 reply; 2+ messages in thread
From: Ramesh Nedunchezian @ 2021-04-30  7:25 UTC (permalink / raw)
  To: emacs-orgmode@gnu.org


TLDR:

1. (May be) support for additional indices in TexInfo exporter.

2. Use `info' function--as opposed to `info' binary--to open an
   exported INFO file. IOW, don't use `org-open-file', but use `info'
   function directly.

(2) would be nice to have.

----------------

I had a need to create an index of EIEIO classes in =helm= package.  

See

    (info "(texinfo) New Indices")

I had to customize the default TexInfo exporter to achieve this
end. You can see the end result here:
https://rnchzn.github.io/helm/doc/helm-classes.html#Class-Index

This is what I did to create the additional index.

(defun org-texinfo-keyword+ (keyword contents info)
  (let* ((v (org-element-property :value keyword))
         (k (org-element-property :key keyword))
         (c (org-texinfo-keyword keyword contents info)))
    (if c c
      (when (string-match  "\\(?:\\`\\(?1:.+\\)INDEX\\'\\)" k)
        (format "@%sindex %s" (downcase (match-string 1 k)) v)))))

(defun org-texinfo-export-to-texinfo+ ()
  (interactive)
  (let ((outfile (org-export-output-file-name ".texi"))
        (org-export-coding-system org-texinfo-coding-system))
    (org-export-to-file 'my-texinfo outfile)))

(org-export-define-derived-backend 'my-texinfo 'texinfo
  :translate-alist '((keyword . org-texinfo-keyword+)))

Since I had to do multiple edit, compile, preview passes, I also
created the following "make-shift" command to make the process more
easier.  

(global-set-key (kbd "<f10>")
		(defun make-shift ()
		  (interactive)
		  (let* ((info-buf-name (format "*info: %s*"
						(file-name-sans-extension
						 (file-name-nondirectory
						  (buffer-file-name))))))
		    (when-let ((info-buf (get-buffer info-buf-name)))
		      (kill-buffer info-buf))
		    (info (org-texinfo-compile (org-texinfo-export-to-texinfo+))
			  info-buf-name))))





^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Additional indices in TexInfo exporter: FR or may be just a note ...
  2021-04-30  7:25 Additional indices in TexInfo exporter: FR or may be just a note Ramesh Nedunchezian
@ 2021-04-30 10:51 ` Nicolas Goaziou
  0 siblings, 0 replies; 2+ messages in thread
From: Nicolas Goaziou @ 2021-04-30 10:51 UTC (permalink / raw)
  To: Ramesh Nedunchezian; +Cc: emacs-orgmode@gnu.org

Hello,

Ramesh Nedunchezian <rameshnedunchezian@outlook.com> writes:

> 1. (May be) support for additional indices in TexInfo exporter.

You can use

#+texinfo: @fooindex whatever

> 2. Use `info' function--as opposed to `info' binary--to open an
>    exported INFO file. IOW, don't use `org-open-file', but use `info'
>    function directly.

You can add, e.g,

  ("info" . (lambda (file _) (info file)))

to `org-file-apps'.

Regards,
-- 
Nicolas Goaziou


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-04-30 11:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-30  7:25 Additional indices in TexInfo exporter: FR or may be just a note Ramesh Nedunchezian
2021-04-30 10:51 ` Nicolas Goaziou

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).