Take a look at the function gist-internal-new
that gist-region
is calling.
(gist-internal-new FILES &optional PRIVATE DESCRIPTION CALLBACK)
The third param is the description but gist-region
is setting it to nil. You can modify that last expression in gist-region
to read a string from the minibuffer to specify a description
(gist-internal-new files private (read-from-minibuffer "Gist Description: ") callback)
Or better yet, don't modify the function and just write your own! That way, you don't mess with other packages that use the function.
Here is just a slightly a modified version that adds an extra parameter and uses interactive
to automatically prompt the user for a description while still allowing prefix args to make private gists.
Unlike the first example when we used `read-from-minibuffer' this one will allow you to use the function in code and specify the description directly without forcing a prompt to be used unless it's called interactively.
;; note that we added the DESCRIPTION argument
(defun gist-region-with-description (begin end &optional description private callback)
"Post the current region as a new paste at gist.github.com
Copies the URL into the kill ring.
With a prefix argument, makes a private paste."
(interactive "r\nsGist Description: \nP") ;; we handle the prompt here!
(let* ((file (or (buffer-file-name) (buffer-name)))
(name (file-name-nondirectory file))
(ext (or (cdr (assoc major-mode gist-supported-modes-alist))
(file-name-extension file)
"txt"))
(fname (concat (file-name-sans-extension name) "." ext))
(files (list
(gh-gist-gist-file "file"
:filename fname
:content (buffer-substring begin end)))))
;; finally we use our new arg to specify the description in the internal call
(gist-internal-new files private description callback)))