Git Product home page Git Product logo

Comments (10)

Alexander-Miller avatar Alexander-Miller commented on July 17, 2024 1

I've run into the same issue - neither helpful-variable, nor helpful-at-point are aware of the buffer-local value.

from helpful.

Wilfred avatar Wilfred commented on July 17, 2024 1

@Alexander-Miller helpful-variable and helpful-at-point should show the buffer-local value. If not, would you mind opening a separate issue?

I think this issue is about showing the default, initial value, not the global value of a buffer-local variable.

from helpful.

Alexander-Miller avatar Alexander-Miller commented on July 17, 2024

Pretty sure I just expressed myself the wrong way round. Trying again the issue is that helpful won't mention the original value. For example do this:

(defvar-local foobar 25)
(setq foobar 10)

When you ask helpful in the same buffer about the variable it will only show 10 as its value.

from helpful.

raxod502 avatar raxod502 commented on July 17, 2024

@Wilfred This doesn't appear to fix the issue. Evaluating the code of @Alexander-Miller and then running M-x helpful-variable RET foobar RET gives me (with the latest version of Helpful from master):

foobar is a buffer-local variable without a source file.

Value in #<buffer *scratch*>
10

Buffer values Default value Set

References
Could not find source file.

Find all references

Debugging
Forget

Source Code

which pretty clearly doesn't include the text 25 anywhere. Whereas M-x describe-variable RET foobar RET gives me:

foobar’s value is 10
Local in buffer *scratch*; global value is 25

  Automatically becomes buffer-local when set.

Documentation:
Not documented as a variable.

which does.

from helpful.

Wilfred avatar Wilfred commented on July 17, 2024

@raxod502 press the 'Default value' button. Helpful lets you view the value in every buffer, so it can't show everything at once.

Perhaps 'Global value' would be better text on the button?

from helpful.

raxod502 avatar raxod502 commented on July 17, 2024

Oh, I see—my bad, sorry.

I do think it would make sense (by default) to show both the global value and one buffer-local value, as that only takes a constant amount of extra space and the default help buffer does it.

And I agree; 'Global value' would probably be more intuitive as it's the language used in Emacs' help facility.

from helpful.

Wilfred avatar Wilfred commented on July 17, 2024

I've updated the button text.

I'm afraid I'm unwilling to show both variables by default: the helpful buffer is already showing a lot of data. For some variables it's fine (e.g. major-mode) but for variables with list values, it's already a lot to show.

What do you think? Can you see a nice heuristic to use here? I agree that for many variables it's fine to show both (most of the variables I've tried are fine, but hooks or buffer-undo-list can get big).

from helpful.

raxod502 avatar raxod502 commented on July 17, 2024

I think I'd be totally satisfied if there were an easy way to toggle between the global and buffer-local values; as is, it's one click to go from buffer-local to global, but to go the other way, I have to select the current buffer's name from a list.

from helpful.

Wilfred avatar Wilfred commented on July 17, 2024

What would you expect to happen when you go from global to buffer-local? Would you be happy with a prompt for a buffer that defaulted to the original buffer you started from?

from helpful.

raxod502 avatar raxod502 commented on July 17, 2024

I would be satisfied with that, yes. It looks currently like the order is just defined by buffer-list, and there is no default defined. Instead, I think the default should be whatever the last buffer was.

from helpful.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.