[slime-devel] Re: slime-filename-translations xemacs-compatability

Steven E. Harris seh at panix.com
Sun Apr 9 00:03:03 UTC 2006


Nathan Bird <nathan at acceleration.net> writes:

> Attached is a diff (filename-translation-compat.diff) to just the
> slime.el, since I have a separate patch outstanding that also hits
> the changelog.

Using string-match as the test with assoc* causes some surprising
failures. Unlike, say, equal, string-match is asymmetric: the first
argument is a regular expression, the second a string. When trying to
compare (slime-machine-instance) against itself using string-match,
the comparison fails, for (slime-machine-instance) contains regexp
meta-characters:

  (slime-machine-instance)
  > "torus.sehlabs.com [192.168.1.34]"

  (regexp-quote (slime-machine-instance))
  > "torus\\.sehlabs\\.com \\[192\\.168\\.1\\.34\\]"

Next I tried adding the regexp-quoted string to
slime-filename-translations:

  (push (list (regexp-quote (slime-machine-instance))
            'identity 'identity)
      slime-filename-translations)


No dice:

  (assoc* (slime-machine-instance) slime-filename-translations
          :test #'string-match)
  > nil

  ;; It would work this way:
  (string-match (caar slime-filename-translations)
                (slime-machine-instance))
  > 0

  ;; But we're testing it this way:
  (string-match (slime-machine-instance)
                (caar slime-filename-translations))
  > nil


Even though the slime-filename-translations tuples are supposed to
contain a regexp, slime-find-filename-translators is using the car of
each as a string and treating (slime-machine-instance) as a regexp.

I think you'll need a test more like:

  ;; Untested:
  (defun slime-match-translator (instance regexp)
    (string-match regexp instance))

-- 
Steven E. Harris




More information about the slime-devel mailing list