You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In several of my libraries, I have created custom print behavior for my data structures. I do this by implementing clojure.core/print-method for that data structure, which takes care of pr/print and then I add a method for clojure.core/pprint.
With the rise in popularity of puget as the printer of choice for cider, I'm finding it inconvenient that puget ignores my hooks into clojure's printing system, and continues to print records in its own default way.
Would you consider a pull-request that changes visit-record to first check whether print-method is implemented for the record, and when it is, use pr-handler instead?
Is there another good way to handle this?
The text was updated successfully, but these errors were encountered:
One of the original motivations for writing Puget was that Clojure's built-in print-method and kin are subject to global modification. I needed a printer that was canonical and that also meant I needed to ensure it would be fully configurable with a local dispatch function. Later on, this expanded to colorization and the broader use as a REPL pretty-printer. Which is perhaps a long way of saying that deferring to print-method implementations would go against that original design.
Given the above, there's no way to globally change Puget's behavior with respect to your custom types, but you can use its dispatch mechanism to choose a different representation within a specific REPL or project. I'm not an emacs user, so I'm not familiar with how you would wire this up in CIDER, but as an example, whidbey has the notion of escape types which are rendered with print-method instead of Puget's normal formatters. You should be able to configure something similar.
Happy to help with any configuration questions along that route!
In several of my libraries, I have created custom print behavior for my data structures. I do this by implementing clojure.core/print-method for that data structure, which takes care of pr/print and then I add a method for clojure.core/pprint.
For example:
With the rise in popularity of puget as the printer of choice for cider, I'm finding it inconvenient that puget ignores my hooks into clojure's printing system, and continues to print records in its own default way.
Would you consider a pull-request that changes visit-record to first check whether print-method is implemented for the record, and when it is, use pr-handler instead?
Is there another good way to handle this?
The text was updated successfully, but these errors were encountered: