Skip to content

How to edit and return string in Emacs Lisp? #21

@gnusupport

Description

@gnusupport

(defun buffer-out ()
  (interactive)
  (let ((buffer (current-buffer))
	(value (buffer-string)))
    (kill-buffer buffer)))

(defun buffer-string-out ()
  (interactive)
  (buffer-string))

(defun edit-string (string)
  (interactive)
  (let ((buffer "*edit-string*"))
    (get-buffer-create buffer)
    (switch-to-buffer buffer)
    (set-buffer buffer)
    (let ((inhibit-read-only nil))
      (insert string)
      (fundamental-mode)
      (local-set-key (kbd "C-c C-c") 'buffer-out))))

;;      (add-hook 'kill-buffer-hook 'buffer-string-out))))

(setq ok (edit-string "OK"))

I am trying to get this work, could you point me to a solution to edit string, and return the string back?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions