]> git.madduck.net Git - etc/neomutt.git/commitdiff

madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

All patches and comments are welcome. Please squash your changes to logical commits before using git-format-patch and git-send-email to patches@git.madduck.net. If you'd read over the Git project's submission guidelines and adhered to them, I'd be especially grateful.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

buildmimetree.py: housekeeping at the end of commands
authormartin f. krafft <madduck@madduck.net>
Sun, 3 Sep 2023 20:23:51 +0000 (22:23 +0200)
committermartin f. krafft <madduck@madduck.net>
Sun, 3 Sep 2023 20:23:51 +0000 (22:23 +0200)
.config/neomutt/buildmimetree.py

index 2ad671a839d632a87eae622358efab1dccaa086d..f5e3c17ae74512fada4032db862cb72cf29317f1 100755 (executable)
@@ -958,14 +958,6 @@ def do_massage(
     # variable used to identify the command file we're currently writing
     # to.
     cmds = MuttCommands(cmd_f, debug=debug_commands)
-    cmds.cmd('set editor="$my_editor"')
-    cmds.cmd('set edit_headers="$my_edit_headers"')
-    cmds.cmd("unset my_editor")
-    cmds.cmd("unset my_edit_headers")
-
-    # let's flush those commands, as there'll be a lot of pushes from now
-    # on, which need to be run in reverse order
-    cmds.flush()
 
     extensions = extensions.split(",") if extensions else []
     tree = converter(
@@ -1111,6 +1103,10 @@ def do_massage(
     except AttributeError:
         filename = "pytest_internal_file"
     cmds.cmd(f"source 'rm -f {filename}|'")
+    cmds.cmd('set editor="$my_editor"')
+    cmds.cmd('set edit_headers="$my_edit_headers"')
+    cmds.cmd("unset my_editor")
+    cmds.cmd("unset my_edit_headers")
     cmds.cmd("unset my_mdwn_postprocess_cmd_file")
     cmds.flush()
 
@@ -1405,14 +1401,14 @@ try:
                 )
                 lines = cmd_f.read().splitlines()
 
-            assert '="$my_editor"' in lines.pop(0)
-            assert '="$my_edit_headers"' in lines.pop(0)
-            assert "unset my_editor" == lines.pop(0)
-            assert "unset my_edit_headers" == lines.pop(0)
             assert "send-message" in lines.pop(0)
             assert "update-encoding" in lines.pop(0)
             assert "first-entry" in lines.pop(0)
             assert "source 'rm -f " in lines.pop(0)
+            assert '="$my_editor"' in lines.pop(0)
+            assert '="$my_edit_headers"' in lines.pop(0)
+            assert "unset my_editor" == lines.pop(0)
+            assert "unset my_edit_headers" == lines.pop(0)
             assert "unset my_mdwn_postprocess_cmd_file" == lines.pop(0)
 
         @pytest.mark.massage
@@ -1429,7 +1425,7 @@ try:
                     max_other_attachments=max_attachments,
                     converter=converter,
                 )
-                lines = cmd_f.read().splitlines()[4:-2]
+                lines = cmd_f.read().splitlines()[:-6]
 
             assert "first-entry" in lines.pop()
             assert "update-encoding" in lines.pop()
@@ -1471,7 +1467,7 @@ try:
                     cmd_f=cmd_f,
                     converter=converter,
                 )
-                lines = cmd_f.read().splitlines()[4:-2]
+                lines = cmd_f.read().splitlines()[:-6]
 
             assert "first-entry" in lines.pop()
             assert "update-encoding" in lines.pop()