all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Jean Louis <bugs@gnu.support>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 33007@debbugs.gnu.org
Subject: bug#33007: 27.0.50; Proposal for function to edit and return string
Date: Thu, 11 Oct 2018 08:33:21 +0200	[thread overview]
Message-ID: <20181011063321.GD27672@protected.rcdrun.com> (raw)
In-Reply-To: <83bm81xl84.fsf@gnu.org>

On Thu, Oct 11, 2018 at 05:36:59AM +0300, Eli Zaretskii wrote:
> > From: Jean Louis <bugs@gnu.support>
> > Date: Wed, 10 Oct 2018 22:49:19 +0200
> > 
> > 
> > I would like to propose function for GNU Emacs so that there is
> > function to edit and return the string.
> > 
> > It would be equivalent to read-from-minibuffer only that we shall have
> > function to edit in the whole buffer, not just in one line in mini
> > buffer.
> 
> We already have read-string, I think it does what you want.

It reads from mini buffer, it does not open
standard buffer where one could change modes and
have editing capabilities, preview, insert from
other files, etc.

I have found solution for me. And I think
something like that shall be included in emacs.

Why?

We have read-from-minibuffer.

Logically there shall be read-from-buffer too.

Isn't it?

I am using this one below now but it would be nice
to have it as fully fledged with options
etc. professional built-in function.

I have website revision system written in LISP
that invokes Emacs to edit PostgreSQL variables,
including LISP variables. Such contain markup,
notes, description, bodies of text that cannot fit
into read-string function and where I need to
preview the file, work with it, until it is
published. Some page are even in Org mode, so I
would need to see how they look like before I let
it be fed into the database again.

At the moment I tried doing the same from within
Emacs, I have spent hours trying to find something
like read-from-buffer as I was convinced it exists
there.

That is why I am proposing standardized function
to read-from-buffer with nice options as built in
function.

And I will appreciate any improvements to the
below function.

Jean

Something like this below shall become read-from-buffer

;;; edited from https://raw.githubusercontent.com/deestan/emacs/master/emacs-goodies-el/miniedit.el
(defun edit-string (value)
  "Edits string and returns it"
  (let ((this-buffer (buffer-name))
	(new-value value)
	(buffy "*edit-string*"))
    (save-excursion
      (switch-to-buffer buffy)
      (set-buffer buffy)
      (text-mode)
      (local-set-key (kbd "C-c C-c") 'exit-recursive-edit)
      (if (stringp value) (insert value))
      (message "When you're done editing press C-c C-c or C-M-c to continue.")
      (unwind-protect
	  (recursive-edit)
	(if (get-buffer-window buffy)
	    (progn
	      (setq new-value (buffer-substring (point-min) (point-max)))
	      (kill-buffer buffy))))
      (switch-to-buffer this-buffer)
      new-value)))





  reply	other threads:[~2018-10-11  6:33 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-10 20:49 bug#33007: 27.0.50; Proposal for function to edit and return string Jean Louis
2018-10-11  2:36 ` Eli Zaretskii
2018-10-11  6:33   ` Jean Louis [this message]
2018-10-11 13:31     ` Michael Heerdegen
2018-10-11 13:40       ` Jean Louis
2018-10-11 14:24       ` Eli Zaretskii
2018-10-11 20:20         ` Michael Heerdegen
2018-10-11 21:23           ` Drew Adams
2018-10-12  4:26           ` Eli Zaretskii
2018-10-12 11:26             ` Michael Heerdegen
2018-10-12 12:41               ` Eli Zaretskii
2022-04-24 13:15       ` Lars Ingebrigtsen
2022-04-25  3:00         ` Michael Heerdegen
2022-04-25  7:50           ` Lars Ingebrigtsen
2022-04-25 15:42             ` Juri Linkov
2022-04-25 22:26               ` Michael Heerdegen
2022-04-26  7:23                 ` Juri Linkov
2022-04-26  9:56                 ` Lars Ingebrigtsen
2022-04-26 15:36                   ` Juri Linkov
2022-04-27 12:09                     ` Lars Ingebrigtsen
2022-04-26  9:55               ` Lars Ingebrigtsen
2022-04-26 15:39                 ` Juri Linkov
2022-04-27 12:10                   ` Lars Ingebrigtsen
2022-04-27 16:44                     ` Juri Linkov
2022-04-27 17:05                       ` Lars Ingebrigtsen
2022-04-28  7:32                       ` Juri Linkov
2022-04-28 10:19                         ` Lars Ingebrigtsen
2022-05-08 18:22                           ` Juri Linkov
2022-05-09  9:49                             ` Lars Ingebrigtsen
2022-05-09 18:52                               ` Juri Linkov
2022-05-10  1:53                                 ` Lars Ingebrigtsen
2022-04-25 22:46         ` Michael Heerdegen
2022-04-26  9:58           ` Lars Ingebrigtsen
2018-10-11 13:55     ` Eli Zaretskii
2018-10-11 14:01       ` Michael Heerdegen
2018-10-11 14:08       ` Jean Louis
2018-10-11 14:16         ` Michael Heerdegen
2018-10-11 14:27         ` Eli Zaretskii
2018-10-11 14:36           ` Jean Louis
     [not found]     ` <<87lg74zk2k.fsf@web.de>
     [not found]       ` <<834ldsy31m.fsf@gnu.org>
2018-10-11 14:41         ` Drew Adams
2018-10-11 16:40           ` Eric Abrahamsen
2018-10-15 20:34           ` Juri Linkov
2018-10-15 22:07             ` Drew Adams
2018-10-16 22:12               ` Juri Linkov
2018-10-16 23:05                 ` Drew Adams
2018-10-17 15:39                   ` Michael Heerdegen
     [not found] <<86pnwh4je8.fsf@protected.rcdrun.com>

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20181011063321.GD27672@protected.rcdrun.com \
    --to=bugs@gnu.support \
    --cc=33007@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.