Commit notifications for all Sup repositories
 help / color / mirror / Atom feed
* [sup.git] branch develop updated (246af746 -> c20d8fe5)
@ 2026-07-19  8:11 Dan Callaghan
  2026-07-19  8:11 ` [sup.git] 01/04: contrib/nix/gem-install-shell.nix: update to Ruby 4.0 Dan Callaghan
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Dan Callaghan @ 2026-07-19  8:11 UTC (permalink / raw)
  To: sup-commits

Pushed branch develop:
    from 246af746 prepare for next release
     new c4902275 contrib/nix/gem-install-shell.nix: update to Ruby 4.0
     new e336a0e8 micro-optimisation for Maildir#maildir_labels
     new 04ccc806 drop unused indexable_content methods
     new c20d8fe5 don't fix_encoding! in Message#indexable_body


Summary of changes:
 Manifest.txt                      |  1 +
 contrib/nix/gem-install-shell.nix |  2 +-
 lib/sup/maildir.rb                | 33 +++++++++++++++++++++------------
 lib/sup/message.rb                | 15 +--------------
 lib/sup/person.rb                 |  6 ------
 test/unit/test_maildir.rb         | 21 +++++++++++++++++++++
 6 files changed, 45 insertions(+), 33 deletions(-)
 create mode 100644 test/unit/test_maildir.rb

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [sup.git] 01/04: contrib/nix/gem-install-shell.nix: update to Ruby 4.0
  2026-07-19  8:11 [sup.git] branch develop updated (246af746 -> c20d8fe5) Dan Callaghan
@ 2026-07-19  8:11 ` Dan Callaghan
  2026-07-19  8:11 ` [sup.git] 02/04: micro-optimisation for Maildir#maildir_labels Dan Callaghan
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Dan Callaghan @ 2026-07-19  8:11 UTC (permalink / raw)
  To: sup-commits

New commit on branch develop:
https://supmua.dev/git/sup/commit/c4902275ca37353c993a19edeaa9b8778afe14f3.html

commit c4902275ca37353c993a19edeaa9b8778afe14f3
Author: Dan Callaghan <djc@djc.id.au>
AuthorDate: Tue Apr 21 20:10:17 2026 +1000

    contrib/nix/gem-install-shell.nix: update to Ruby 4.0
---
 contrib/nix/gem-install-shell.nix | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/contrib/nix/gem-install-shell.nix b/contrib/nix/gem-install-shell.nix
index 767559ed..97796bf9 100644
--- a/contrib/nix/gem-install-shell.nix
+++ b/contrib/nix/gem-install-shell.nix
@@ -7,7 +7,7 @@ pkgs.mkShell {
     libffi.dev
     libuuid
     libuuid.dev
-    ruby_3_2
+    ruby_4_0
     zlib
     zlib.dev
   ];

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [sup.git] 02/04: micro-optimisation for Maildir#maildir_labels
  2026-07-19  8:11 [sup.git] branch develop updated (246af746 -> c20d8fe5) Dan Callaghan
  2026-07-19  8:11 ` [sup.git] 01/04: contrib/nix/gem-install-shell.nix: update to Ruby 4.0 Dan Callaghan
@ 2026-07-19  8:11 ` Dan Callaghan
  2026-07-19  8:11 ` [sup.git] 03/04: drop unused indexable_content methods Dan Callaghan
  2026-07-19  8:11 ` [sup.git] 04/04: don't fix_encoding! in Message#indexable_body Dan Callaghan
  3 siblings, 0 replies; 5+ messages in thread
From: Dan Callaghan @ 2026-07-19  8:11 UTC (permalink / raw)
  To: sup-commits

New commit on branch develop:
https://supmua.dev/git/sup/commit/e336a0e83da82f53be2cf5e5d8911ceeb096825a.html

commit e336a0e83da82f53be2cf5e5d8911ceeb096825a
Author: Dan Callaghan <djc@djc.id.au>
AuthorDate: Sun May 3 17:07:40 2026 +1000

    micro-optimisation for Maildir#maildir_labels
    
    Refactor to avoid repeatedly applying a regexp to the message filename
    to extract every maildir flag individually.
    
    The =~ operator shows up as frequently called in a profile of indexing
    a maildir from scratch, and I was just looking for some likely
    candidates where it can be removed. I don't think this made any overall
    difference to indexing speed but it's a reasonable cleanup.
---
 Manifest.txt              |  1 +
 lib/sup/maildir.rb        | 33 +++++++++++++++++++++------------
 test/unit/test_maildir.rb | 21 +++++++++++++++++++++
 3 files changed, 43 insertions(+), 12 deletions(-)

diff --git a/Manifest.txt b/Manifest.txt
index 4419a339..dfdeb6a6 100644
--- a/Manifest.txt
+++ b/Manifest.txt
@@ -183,6 +183,7 @@ test/unit/test_horizontal_selector.rb
 test/unit/test_index.rb
 test/unit/test_line_cursor_mode.rb
 test/unit/test_locale_fiddler.rb
+test/unit/test_maildir.rb
 test/unit/test_person.rb
 test/unit/test_rmail_message.rb
 test/unit/util/test_query.rb
diff --git a/lib/sup/maildir.rb b/lib/sup/maildir.rb
index 1883844a..1c3aecd1 100644
--- a/lib/sup/maildir.rb
+++ b/lib/sup/maildir.rb
@@ -189,20 +189,29 @@ class Maildir < Source
   end
 
   def maildir_labels id
-    (seen?(id) ? [] : [:unread]) +
-      (trashed?(id) ?  [:deleted] : []) +
-      (flagged?(id) ? [:starred] : []) +
-      (passed?(id) ? [:forwarded] : []) +
-      (replied?(id) ? [:replied] : []) +
-      (draft?(id) ? [:draft] : [])
+    flags = maildir_flags id
+    labels = []
+    labels << :unread unless flags.member? :seen
+    labels << :deleted if flags.member? :trashed
+    labels << :starred if flags.member? :flagged
+    labels << :forwarded if flags.member? :passed
+    labels << :replied if flags.member? :replied
+    labels << :draft if flags.member? :draft
+    labels
   end
 
-  def draft? id; maildir_data(id)[2].include? "D"; end
-  def flagged? id; maildir_data(id)[2].include? "F"; end
-  def passed? id; maildir_data(id)[2].include? "P"; end
-  def replied? id; maildir_data(id)[2].include? "R"; end
-  def seen? id; maildir_data(id)[2].include? "S"; end
-  def trashed? id; maildir_data(id)[2].include? "T"; end
+  def maildir_flags id
+    maildir_data(id)[2].each_char.map do |c|
+      case c
+      when 'D' then :draft
+      when 'F' then :flagged
+      when 'P' then :passed
+      when 'R' then :replied
+      when 'S' then :seen
+      when 'T' then :trashed
+      end
+    end
+  end
 
   def valid? id
     File.exist? File.join(@dir, id)
diff --git a/test/unit/test_maildir.rb b/test/unit/test_maildir.rb
new file mode 100644
index 00000000..a83bab01
--- /dev/null
+++ b/test/unit/test_maildir.rb
@@ -0,0 +1,21 @@
+require 'test_helper'
+require 'sup'
+require 'sup/maildir'
+
+module Redwood
+
+class TestMaildir < Minitest::Test
+  def test_flag_parsing
+    maildir = Maildir.new "maildir:/nowhere"
+    labels = maildir.labels? "asdf:2,S"
+    assert_equal [], labels
+    labels = maildir.labels? "asdf:2,"
+    assert_equal [:unread], labels
+    labels = maildir.labels? "asdf:2,DFPRST"
+    assert_equal [:deleted, :starred, :forwarded, :replied, :draft], labels
+    labels = maildir.labels? "asdf:2,DFPRT"
+    assert_equal [:unread, :deleted, :starred, :forwarded, :replied, :draft], labels
+  end
+end
+
+end

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [sup.git] 03/04: drop unused indexable_content methods
  2026-07-19  8:11 [sup.git] branch develop updated (246af746 -> c20d8fe5) Dan Callaghan
  2026-07-19  8:11 ` [sup.git] 01/04: contrib/nix/gem-install-shell.nix: update to Ruby 4.0 Dan Callaghan
  2026-07-19  8:11 ` [sup.git] 02/04: micro-optimisation for Maildir#maildir_labels Dan Callaghan
@ 2026-07-19  8:11 ` Dan Callaghan
  2026-07-19  8:11 ` [sup.git] 04/04: don't fix_encoding! in Message#indexable_body Dan Callaghan
  3 siblings, 0 replies; 5+ messages in thread
From: Dan Callaghan @ 2026-07-19  8:11 UTC (permalink / raw)
  To: sup-commits

New commit on branch develop:
https://supmua.dev/git/sup/commit/04ccc8069750cb79fac9ac3a3b993c39eb1fd285.html

commit 04ccc8069750cb79fac9ac3a3b993c39eb1fd285
Author: Dan Callaghan <djc@djc.id.au>
AuthorDate: Sun May 3 17:11:32 2026 +1000

    drop unused indexable_content methods
---
 lib/sup/message.rb | 13 -------------
 lib/sup/person.rb  |  6 ------
 2 files changed, 19 deletions(-)

diff --git a/lib/sup/message.rb b/lib/sup/message.rb
index fb92c584..72921ac5 100644
--- a/lib/sup/message.rb
+++ b/lib/sup/message.rb
@@ -333,19 +333,6 @@ EOS
     end
   end
 
-  ## returns all the content from a message that will be indexed
-  def indexable_content
-    load_from_source!
-    [
-      from && from.indexable_content,
-      to.map { |p| p.indexable_content },
-      cc.map { |p| p.indexable_content },
-      bcc.map { |p| p.indexable_content },
-      indexable_chunks.map { |c| c.lines.map { |l| l.fix_encoding! } },
-      indexable_subject,
-    ].flatten.compact.join " "
-  end
-
   def indexable_body
     indexable_chunks.map { |c| c.lines }.flatten.compact.map { |l| l.fix_encoding! }.join " "
   end
diff --git a/lib/sup/person.rb b/lib/sup/person.rb
index 9a9ed501..7381ca6e 100644
--- a/lib/sup/person.rb
+++ b/lib/sup/person.rb
@@ -71,12 +71,6 @@ class Person
   def eql? o; email.eql? o.email end
   def hash; email.hash end
 
-
-  ## see comments in self.from_address
-  def indexable_content
-    [name, email, email.split(/@/).first].join(" ")
-  end
-
   class << self
 
     def full_address name, email

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [sup.git] 04/04: don't fix_encoding! in Message#indexable_body
  2026-07-19  8:11 [sup.git] branch develop updated (246af746 -> c20d8fe5) Dan Callaghan
                   ` (2 preceding siblings ...)
  2026-07-19  8:11 ` [sup.git] 03/04: drop unused indexable_content methods Dan Callaghan
@ 2026-07-19  8:11 ` Dan Callaghan
  3 siblings, 0 replies; 5+ messages in thread
From: Dan Callaghan @ 2026-07-19  8:11 UTC (permalink / raw)
  To: sup-commits

New commit on branch develop:
https://supmua.dev/git/sup/commit/c20d8fe5972b7616c3f45873d5d7a2c7c4a12381.html

commit c20d8fe5972b7616c3f45873d5d7a2c7c4a12381
Author: Dan Callaghan <djc@djc.id.au>
AuthorDate: Sun May 3 21:12:29 2026 +1000

    don't fix_encoding! in Message#indexable_body
    
    The message chunks are already properly encoded so calling
    fix_encoding! again on every chunk is just wasting CPU time.
---
 lib/sup/message.rb | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/sup/message.rb b/lib/sup/message.rb
index 72921ac5..35f78256 100644
--- a/lib/sup/message.rb
+++ b/lib/sup/message.rb
@@ -334,7 +334,7 @@ EOS
   end
 
   def indexable_body
-    indexable_chunks.map { |c| c.lines }.flatten.compact.map { |l| l.fix_encoding! }.join " "
+    indexable_chunks.map { |c| c.lines }.flatten.compact.join " "
   end
 
   def indexable_chunks

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-07-19  8:11 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-19  8:11 [sup.git] branch develop updated (246af746 -> c20d8fe5) Dan Callaghan
2026-07-19  8:11 ` [sup.git] 01/04: contrib/nix/gem-install-shell.nix: update to Ruby 4.0 Dan Callaghan
2026-07-19  8:11 ` [sup.git] 02/04: micro-optimisation for Maildir#maildir_labels Dan Callaghan
2026-07-19  8:11 ` [sup.git] 03/04: drop unused indexable_content methods Dan Callaghan
2026-07-19  8:11 ` [sup.git] 04/04: don't fix_encoding! in Message#indexable_body Dan Callaghan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox