Emacs Lisp: quick publishing of Emacs Lisp function to Internet

Emacs Lisp: quick publishing of Emacs Lisp function to Internet

This is new Emacs Lisp function invented on 2019-07-15 that I am using to publish Emacs Lisp functions to Internet on my gnu.support website. It may not mean much to you as you are not using the PostgreSQL database for WRS or Website Revision System. If you do have a website, you could adapt this function to your own needs and quickly publish functions to Internet without thinking. Forget about those third party websites, just host yourself web pages.

This is the function that I am using to publish Emacs Lisp functions on this website gnu.support.

(defun wrs/publish-emacs-lisp-function (beg end)
  "Publishes the region as Emacs Lisp function on https://gnu.support/gnu-emacs/emacs-lisp/"
  (interactive (if (use-region-p)
                   (list (region-beginning) (region-end))
                 (list (point-min) (point-min))))
  (let* ((selection (buffer-substring-no-properties beg end))
     (size (length selection)))
    (when (> size 0)
      (let* ((template 150)
         (category 9128)
         (area 317)
         (title (read-from-minibuffer "Title for Emacs Lisp function: "))
         (filename (wrs/slug title))
         (description (read-from-minibuffer "Description: "))
         (keywords (read-from-buffer (generate-keywords (concat title description))))
         (underline (string-join (seq-map '(lambda (a) "=") title)))
         (text (read-from-buffer ""))
         (footer (read-from-minibuffer "Final words: "))
         (last-priority (wrs/category-last-priority category))
         (new-priority (+ last-priority 10))
         (elisp-function (wrs/markdown-pandoc-lisp selection))
         (page (concat title "\n" underline "\n\n" description "\n\n" text elisp-function footer))
         (sql (format "INSERT INTO pages (pages_area, pages_filename, pages_title, pages_description, pages_keywords, pages_priority, pages_categories, pages_content, pages_templates) VALUES (%s, '%s', %s, %s, '%s', %s, %s, %s, %s) RETURNING pages_id" area filename (sql-escape-string title) (sql-escape-string description) keywords new-priority category (sql-escape-string page) template))
         (page-id (rcd-sql sql)))
    (message (prin1-to-string page-id))))))

If you find anything interesting on this page, and wish to know more about it, just ask me and I will gladly give you any missing pieces.

Related pages

Leave Your Comment or Contact GNU.Support

Contact GNU.Support now. There is a simple rule at GNU.Support: if we can help you, we do, whenever and wherever necessary, and it's the way we've been doing business since 2002, and the only way we know


Full name:


E-mail:


Message: