1

I am trying to modify a slot in a class (created with EIEIO library). I can access the slot with (oref-default 'helm-source-ffiles filtered-candidate-transformer) and that returns

(helm-ff-sort-candidates
 (lambda
  (candidates _source)
  (cl-loop for f in candidates for ff =
        (helm-ff-filter-candidate-one-by-one f)
        when ff collect ff)))

a list of two items. I am trying to add helm-adaptive-sort to the end of that list. However everything I have tried results in an error. Here is what I am trying to do.

(oset-default 'helm-source-ffiles
              filtered-candidate-transformer
              (helm-ff-sort-candidates
               (lambda
                 (candidates _source)
                 (cl-loop for f in candidates for ff =
                          (helm-ff-filter-candidate-one-by-one f)
                          when ff collect ff))
               helm-adaptive-sort))

that results in Symbol’s value as variable is void: helm-adaptive-sort. If I quote it I get the error Can’t set default to a sexp that gets evaluated again. The only thing that I have found that doesn't give an error is storing my list in a variable then calling it like this (oset-default 'helm-source-ffiles filtered-candidate-transformer (list foo)). However that wraps it in an extra set of quotes. How do I set a slot in a class?

  • EIEIO does not support this functionality: the default value is supposed to be set once and for all in the definition of the class. What are you trying to do? – Stefan Jul 28 '18 at 15:06
  • An instance of class helm-source-ffiles is used to to create a helm command. The slot filtered-candidate-transformer contains of list of functions to filter the candidates. I want to add another function to that list (helm-adaptive-sort). I can then update the instance used by the helm command and my function will be applied. – Prgrm.celeritas Jul 28 '18 at 15:51
  • AFAICT the filtered-candidate-transformer slot is not a class-slot, so why don't you just modify it in the instance ("object") rather than trying to modify the default value for the whole class? – Stefan Jul 28 '18 at 16:12
  • I am afraid that I don’t know the difference between a class slot and object slot. How would I do that? – Prgrm.celeritas Jul 28 '18 at 17:58
0

I got my answer from Stephan in the comments, but I will elaborate encase anyone else has a similar question. Turns out that I was approaching this wrong. You can’t use oset-default to set a class default value. Instead you should use oset to overwrite the slot of an instance of the class (an object).

| improve this answer | |

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.