0

How can I get syntax coloring after exporting when when the contents of my org babel src block is diff style:

#+BEGIN_SRC diff <--- is that even a valid keyword
diff --git a/railties/lib/rails/tasks/zeitwerk.rake b/railties/lib/rails/tasks/zeitwerk.rake
index b7f5cd154b2e..42c20a1976e9 100644
--- a/railties/lib/rails/tasks/zeitwerk.rake
+++ b/railties/lib/rails/tasks/zeitwerk.rake
@@ -17,9 +17,12 @@ eager_load = ->() do
   Rails.configuration.eager_load_namespaces.each(&:eager_load!)
 end

+mailer_preview_path = -> () do
+  Rails.application.config.respond_to?(:action_mailer) ? Rails.application.config.action_mailer.preview_path : ""
+end
+
 mismatches = []
 check_directory = ->(directory, parent) do
-  # test/mailers/previews might not exist.
   return unless File.exist?(directory)

   Dir.foreach(directory) do |entry|
@@ -68,7 +71,8 @@ namespace :zeitwerk do
     eager_load[]

     $stdout.sync = true
-    ActiveSupport::Dependencies.autoload_paths.each do |autoload_path|
+    autoload_paths = ActiveSupport::Dependencies.autoload_paths - [mailer_preview_path[]]
+    autoload_paths.each do |autoload_path|
       check_directory[autoload_path, Object]
     end
     puts
#+END_SRC

Github does coloring for diff style output, so I thought it would be nice if emacs could do it too.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.