emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Ramesh Nedunchezian <rameshnedunchezian@outlook.com>
To: "emacs-orgmode@gnu.org" <emacs-orgmode@gnu.org>
Subject: Additional indices in TexInfo exporter: FR or may be just a note ...
Date: Fri, 30 Apr 2021 12:55:11 +0530	[thread overview]
Message-ID: <TY2PR0101MB3693B752D552559380F15E50DA5E9@TY2PR0101MB3693.apcprd01.prod.exchangelabs.com> (raw)


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))))





             reply	other threads:[~2021-04-30  7:28 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-30  7:25 Ramesh Nedunchezian [this message]
2021-04-30 10:51 ` Additional indices in TexInfo exporter: FR or may be just a note Nicolas Goaziou

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=TY2PR0101MB3693B752D552559380F15E50DA5E9@TY2PR0101MB3693.apcprd01.prod.exchangelabs.com \
    --to=rameshnedunchezian@outlook.com \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).