3

I am a total emacs/elisp newbie and I can't figure out how to do this.

  • I have time-stamp-active t with a pretty standard format: time-stamp-format "Last modified %Y-%02m-%02d %02H:%02M:%02S MyUser").

  • I have different git repos where I use other nicknames.

How can I write a function which checks if the file-in-buffer belongs to a git repository, if yes, substitute 'MyUser' with the local git user name, and if not revert to the default?

I googled around and I did not find anything useful to me...

0
0

You can configure per-repo options following this magit manual page, but what you want is just git.

Then if you want to get your configured user.name or user.email from your elisp code, this should work:

(shell-command-to-string "git config user.name")

Note that you're launching a short-living process for each call to obtain a parameter that probably you can call once and keep.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.