[This is a supplement to my other answer: it has very little to do with emacs, but it does address the common question of how to sustainably carry a patch for some upstream component, in the context of an emacs package. If the moderators deem it off-topic, I will delete it or perhaps incorporate it into my other answer, whichever seems most appropriate.]
My other answer describes the low-level things that you would have to do in emacs to add a timestamp-rendering function that does away with some of the things that the built-in function does. Basically, you write your own back end, my-gfm
, which inherits from the gfm
back end, which inherits from the md
back end, which inherits from the html
back end. You only provide one function in your back end to override the one in the html
back end (since the intermediate back ends do not redefine that function).
There are disadvantages however: you have to maintain your own back end and you don't get your back end in the export menu unless you expend extra effort (see org-export-define-derived-backend
's :menu-entry
option), so you have to manually export with (org-export-to-buffer 'my-gfm)
or (org-export-to-file 'my-gfm)
.
@dbx48's answer correctly advises to file an issue with the upstream ox-gfm
project: they might do the change and that will spare you from the effort necessary to maintain your own back end in perpetuity. The question is: what to do in the meantime (or if they refuse to make that change)?
What I would do is clone the ox-gfm
github repo, create a branch, switch to it and apply the change to add a timestamp
function at the gfm
level:
git clone https://github.com/larstvei/ox-gfm.git
cd ox-gfm
git checkout -b timestamp
... edit ox-gfm.el and add the line `(timestamp . my-gfm-org-timestamp)` to it, somewhere in the `:translate-alist` list.
Then point my emacs to that:
(add-to-list 'load-path "/path/to/cloned/ox-gfm")
That allows you to use the gfm
menu entry and to more-or-less forget that you patched ox-gfm
-- until there is an upstream change to ox-gfm
and you want to install the new version.
Git makes that fairly easy:
cd /path/to/cloned/ox-gfm
git remote update
git checkout master
git rebase
git checkout timestamp
git rebase master
That's it (and you can actually shorten that sequence, using more advanced git, but I'll skip that here). What this does is:
- pull down the changes from upstream
- switch to your master branch
- update the master branch with the changes that you pulled down
- switch to the timestamp branch
- rebase your timestamp branch on your current master, thereby applying the timestamp patch to the current
ox-gfm
code.
You can then continue as if nothing happened.
If the change is applied upstream, all you have to do is get rid of the timestamp branch and just keep the master branch. The update procedure is the same for the first four steps: you just skip the last two steps since you no longer have to maintain a timestamp branch.