emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: "Rudolf Adamkovič" <salutis@me.com>
To: emacs-orgmode@gnu.org
Subject: Re: [PATCH] org-src: Improve the name of source editing buffers
Date: Sun, 05 Mar 2023 22:26:47 +0100	[thread overview]
Message-ID: <m2cz5mj3e0.fsf@me.com> (raw)
In-Reply-To: <20230302140224.6169-1-salutis@me.com>

[-- Attachment #1: Type: text/plain, Size: 226 bytes --]

I had a little bit of spare time today to refine the patch.

Changes:

- The patch now comes with a test to avoid regressions.
- The patch has a slightly better commit message.

Please see the attached file.

Thank you!

Rudy

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-org-src-Improve-naming-of-source-editing-buffers.patch --]
[-- Type: text/x-patch, Size: 2176 bytes --]

From a831b9014b3aaef16846dca049882a485ebf1dd6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Rudolf=20Adamkovi=C4=8D?= <salutis@me.com>
Date: Sun, 5 Mar 2023 22:21:40 +0100
Subject: [PATCH] org-src: Improve naming of source editing buffers

* lisp/org-src.el (org-src--construct-edit-buffer-name): Fix the name
given to a source editing buffer.  The original format was documented
as "ORG-BUFFER-NAME [ LANG ]" but in reality it was "ORG-BUFFER-NAME[
LANG ]", with different spacing.  We make the format more standard and
more compact, as well as, make the documentation match reality.
* testing/lisp/test-org-src.el (test-org-src/buffer-name): Test the
buffer name used for 'org-edit-special'.
---
 lisp/org-src.el              |  4 ++--
 testing/lisp/test-org-src.el | 13 +++++++++++++
 2 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/lisp/org-src.el b/lisp/org-src.el
index 9e4392811..bb894de9c 100644
--- a/lisp/org-src.el
+++ b/lisp/org-src.el
@@ -315,8 +315,8 @@ is 0.")
 
 (defun org-src--construct-edit-buffer-name (org-buffer-name lang)
   "Construct the buffer name for a source editing buffer.
-Format is \"*Org Src ORG-BUFFER-NAME [ LANG ]*\"."
-  (concat "*Org Src " org-buffer-name "[ " lang " ]*"))
+Format is \"*Org Src ORG-BUFFER-NAME [LANG]*\"."
+  (concat "*Org Src " org-buffer-name " [" lang "]*"))
 
 (defun org-src--edit-buffer (beg end)
   "Return buffer editing area between BEG and END.
diff --git a/testing/lisp/test-org-src.el b/testing/lisp/test-org-src.el
index 2a45ba66e..8829ce306 100644
--- a/testing/lisp/test-org-src.el
+++ b/testing/lisp/test-org-src.el
@@ -491,6 +491,19 @@ This is a tab:\t.
   (should (equal "#" (org-unescape-code-in-string "#")))
   (should (equal "," (org-unescape-code-in-string ","))))
 
+;;; Other
+
+(ert-deftest test-org-src/buffer-name ()
+  "Buffer has the correct name."
+  (org-test-with-temp-text "
+<point>#+begin_src emacs-lisp
+  (message hello)
+#+end_src"
+    (rename-buffer "Buffy")
+    (org-edit-special)
+    (should (equal "*Org Src Buffy [emacs-lisp]*"
+                   (buffer-name)))
+    (org-edit-src-exit)))
 
 (provide 'test-org-src)
 ;;; test-org-src.el ends here
-- 
2.39.2


[-- Attachment #3: Type: text/plain, Size: 208 bytes --]

-- 
"Be especially critical of any statement following the word
'obviously.'"
-- Anna Pell Wheeler, 1883-1966

Rudolf Adamkovič <salutis@me.com> [he/him]
Studenohorská 25
84103 Bratislava
Slovakia

  reply	other threads:[~2023-03-05 21:27 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-02 14:02 [PATCH] org-src: Improve the name of source editing buffers Rudolf Adamkovič
2023-03-05 21:26 ` Rudolf Adamkovič [this message]
2023-03-06 12:09   ` Max Nikulin
2023-03-07 13:13   ` Ihor Radchenko
2023-03-07 21:15     ` Rudolf Adamkovič
2023-03-08 13:51       ` Ihor Radchenko
2023-03-08 22:02         ` Rudolf Adamkovič
2023-03-10 11:12           ` Ihor Radchenko
2023-03-14 20:55             ` Rudolf Adamkovič

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

  List information: https://www.orgmode.org/

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

  git send-email \
    --in-reply-to=m2cz5mj3e0.fsf@me.com \
    --to=salutis@me.com \
    --cc=emacs-orgmode@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 public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).