From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Arroyo Menendez Subject: org-envolve.el Date: Sat, 01 Dec 2018 14:28:20 -0500 Message-ID: Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:56357) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gTAw9-0000CX-GQ for emacs-orgmode@gnu.org; Sat, 01 Dec 2018 14:28:22 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gTAw8-00015Y-RS for emacs-orgmode@gnu.org; Sat, 01 Dec 2018 14:28:21 -0500 Received: from fencepost.gnu.org ([2001:4830:134:3::e]:38478) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gTAw8-00015U-NV for emacs-orgmode@gnu.org; Sat, 01 Dec 2018 14:28:20 -0500 Received: from davidam by fencepost.gnu.org with local (Exim 4.82) (envelope-from ) id 1gTAw8-0002ST-LQ for emacs-orgmode@gnu.org; Sat, 01 Dec 2018 14:28:20 -0500 List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: emacs-orgmode@gnu.org --=-=-= Content-Type: text/plain Hello, I've implemented a new file to contrib/lisp. It's called org-envolve.el, this file implements functions to help to format in org-mode from ASCII. For instance, you have a bash source that you are copying in your buffer, later you can call org-envolve-tags to add #+BEGIN_SRC bash in the beginning and #+END_SRC in the end. I use this feature all weeks in the year. But the file provides functions to envolve numbered list, or check list. I can't make git push at this moment davidam@libresoft:~/git/org-mode/contrib/lisp$ git push origin master Counting objects: 27, done. Delta compression using up to 4 threads. Compressing objects: 100% (27/27), done. Writing objects: 100% (27/27), 4.26 KiB | 0 bytes/s, done. Total 27 (delta 17), reused 0 (delta 0) Username for 'https://code.orgmode.org': davidam Password for 'https://davidam@code.orgmode.org': error: RPC failed; HTTP 403 curl 22 GnuTLS recv error (-110): The TLS connection was non-properly terminated. fatal: The remote end hung up unexpectedly fatal: The remote end hung up unexpectedly Everything up-to-date But this software is released with a gpl licencese. Thanks in advance. -- https://cienciabasura.wordpress.com/ http://libremanuals.net/ --=-=-= Content-Type: application/emacs-lisp Content-Disposition: attachment; filename=org-envolve.el Content-Transfer-Encoding: quoted-printable ;; Copyright (C) 2018 David Arroyo Men=C3=A9ndez ;; Author: David Arroyo Men=C3=A9ndez ;; Maintainer: David Arroyo Men=C3=A9ndez ;; This file is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by ;; the Free Software Foundation; either version 3, or (at your option) ;; any later version. ;; This file is distributed in the hope that it will be useful, ;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;; GNU General Public License for more details. ;; You should have received a copy of the GNU General Public License ;; along with GNU Emacs; see the file COPYING. If not, write to ;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, ;; Boston, MA 02110-1301 USA, ;;; Commentary: ;; This file implements functions to help to format in org-mode from ;; ASCII. ;; Org-mode doesn't load this module by default - if this is not what ;; you want, configure the variable `org-modules'. ;;; Code: (require 'org) (defun org-envolve-numbered-list() "Itemize some lines as a numbered list" (interactive) (setq num 1) (setq max (+ 1 (count-lines (point) (mark)))) (if (> (point) (mark)) (goto-line (+ 1 (count-lines 1 (mark)))) (goto-line (+ 1 (count-lines 1 (point))))) (while (< num max) (move-beginning-of-line nil) (insert (concat (number-to-string num) ". ")) (setq num (+ 1 num)) (forward-line))) (defun org-envolve-check-list() "Itemize some lines as a checked list" (interactive) (setq num 1) (setq max (+ 1 (count-lines (point) (mark)))) (if (> (point) (mark)) (goto-line (+ 1 (count-lines 1 (mark)))) (goto-line (+ 1 (count-lines 1 (point))))) (while (< num max) (move-beginning-of-line nil) (insert (concat "+ [ ] ")) (setq num (+ 1 num)) (forward-line))) (defun org-envolve-tags(msg) "Envolve source between org tags" (interactive "sChoose your programming language: " msg) (if (string=3D "" msg) (setq msg "lisp")) (if (> (point) (mark)) (progn (goto-char (point)) (insert "#+END_SRC") (goto-char (mark)) (insert "#+BEGIN_SRC " msg "\n")) (progn (goto-char (point)) (insert "#+BEGIN_SRC " msg "\n") (goto-char (mark)) (insert "#+END_SRC")))) (defun org-envolve-add-tags(msg) "Insert org source tags" (interactive "sChoose your programming language: " msg) ;; TODO: Meter name en interactive. Ej: #+name: myconcat (if (equal nil msg) (setq msg "lisp")) (insert "#+BEGIN_SRC " msg) (insert "\n#+END_SRC\n")) (provide 'org-envolve) --=-=-=--