1

I was looking through the code and found wg-current-workgroup-p ("Return t when WORKGROUP is the current workgroup, nil otherwise.") which seemed to be what I want, but if the current workgroup is called "main" and I do

(wg-current-workgroup-p "main")

I get nil. I'm not sure if I'm doing something wrong or misunderstanding the function. I couldn't find a way to get the current workgroup name either. I'd also like to be able to do this with the workgroup index as well.

1 Answer 1

2

wg-current-workgroup-p doesn't take a string as the workgroup name, it needs to be passed an actual workgroup object. For example, try doing this:

(wg-current-workgroup-p (wg-current-workgroup))

(wg-current-workgroup) returns the current workgroup as a workgroup object. Obviously, this will return true, because you're checking if the current workgroup is the current workgroup.

Some examples:

You can get a list of all workgroup objects with (wg-workgroup-list).

To check if the current workgroup is the last one in the list:

(wg-current-workgroup-p (car (last (wg-workgroup-list))))

To get the name (as a string) of the first workgroup, you can do this:

(wg-workgroup-name (car (wg-workgroup-list)))

You can get all the workgroups names as strings with (wg-workgroup-names)

helm-apropos is useful for finding all these functions.

1
  • I actually did look at these using helm (though thanks for mentioning helm-apropos; I wasn't aware of it), but wg-workgroup-name isn't documented. What I wanted was (wg-workgroup-name (wg-current-workgroup)). Thank you.
    – noctuid
    Jan 23, 2015 at 21:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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