Subject: bug#36877: 25.3; uniquify renaway uniquify-managed list

From: David Biesack <[email-masked]>
Date: Fri, 16 Aug 2019 14:36:25 +0000

I'll restart Emacs and when I get a backtrace again I'll attach it as file.

David Biesack | Vice President, API Platforms
[email-masked] | @davidbiesack <https://twitter.com/davidbiesack>

On 8/15/19, 1:20 PM, "Noam Postavsky" <[email-masked]> wrote:

    David Biesack <[email-masked]> writes:

    >   uniquify-rationalize-file-buffer-names("index.html" "/Users/david.biesack/dev/developer.apiture.com/_site/docs/apis/workflow/v0.13.0/" #<buffer index.html>)
    >   uniquify--create-file-buffer-advice(#[257 "\301!\211\302\230\203\f

    Ah right, Emacs 25 still has that thing where it cuts off nthe pasted
    text after NUL bytes.  For next time, saving the backtrace to a file and
    attaching it should work better.

    Looking at the fix-list in the backtrace, we have:

      [cl-struct-uniquify-item "index.html" "/Users/david.biesack/dev/developer.apiture.com/_site/docs/apis/workflow/v0.13.0" #<buffer index.html> nil]
      { ;; repeated 5 times...
      [cl-struct-uniquify-item "index.html" "/Users/david.biesack/dev/developer.apiture.com/_site/docs/apis/sample" #<buffer index.html<docs/apis/sample>> "index.html<docs/apis/sample>"]
      [cl-struct-uniquify-item "index.html" "/Users/david.biesack/dev/developer.apiture.com/_site/doc/apis/sample" #<buffer index.html<doc/apis/sample>> "index.html<doc/apis/sample>"]
      [cl-struct-uniquify-item "index.html" "/Users/david.biesack/dev/developer.apiture.com/_site/docs/apis/sample/sample" #<buffer index.html<sample/sample>> "index.html<sample/sample>"]
      [cl-struct-uniquify-item "index.html" "/Users/david.biesack/dev/developer.apiture.com" #<buffer index.html<developer.apiture.com>> "index.html<developer.apiture.com>"]
      [cl-struct-uniquify-item "index.html" "/Users/david.biesack/dev/developer.apiture.com/_site/docs/concepts" #<buffer index.html<concepts>> "index.html<concepts>"]
      }

    I think that means the (dolist (buffer (buffer-list))...) somehow went
    over #<buffer index.html<docs/apis/sample>> 5 times, or else that buffer
    already had duplicates in its uniquify-managed list (i.e., this
    backtrace triggerred "too late").

    Did you add the advice in an ongoing session?  If yes, then it you
    should clear out existing duplicates first, so we can catch a "fresh"
    instance.  Evaluating the below should do:

        (let ((htable (make-hash-table :test 'equal)))
          (save-current-buffer
            (dolist (buf (buffer-list))
              (set-buffer buf)
              (when (cdr uniquify-managed)
                (clrhash htable)
                (dolist (item (cdr uniquify-managed))
                  (puthash item t htable))
                (let ((managed nil))
                  (maphash (lambda (k _v)
                             (push k managed))
                           htable)
                  (push (car uniquify-managed) managed)
                  (setq uniquify-managed managed))))))

    If that backtrace was actually from a new session (that is, the advice
    was added at the beginning of the session), then it means the problem is
    coming from some other unexpected spot.

Disclaimer: The information in this message may be proprietary and/or confidential, and protected from disclosure. If the reader of this message is not the intended recipient, or an employee or agent responsible for delivering this message to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please notify Apiture immediately by replying to this message and deleting it from your computer.