[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Emacspeak] Setting global prefs in init file



It isn't wrong, but it can also depend on how/when the local variable is
created and whether any hooks or post-init processes are run which might
effect the value. For example, setq-default will have no effect on a
buffer local variable if that variable already has a value, so it is
important that your setq-default is evaluated before the variable is set
in some buffer. Then you also have the situation where the init code of
the package/code which creates the local variable explicitly sets it to
a value, possibly overriding your default setting and then you have the
possible complication of hooks which can run after code is loaded or a
mode is used etc which might also set local variables.

My main reason for not mentioning it was just to keep things simple to
start with and reduce the risk for the OP of being caught 'down in the
weeds'. It is also worth noting that one of the benefits of using the
suggested customize interface is that often customize definitions will
include a 'setter' that will ensure a new value is correctly applied,
further smoothing over some of the unexpected side effects which can
occur when writing your own init code in init.el

> Everything that Tim says here is correct, but can't you use (setq-default...) to set the default value of a variable for each buffer? that's what I've been
> doing, and it has been working well for me. Let me know if that's wrong.
>
> On Fri, Jun 6, 2025 at 6:58 AM Tim Cross <emacspeak@xxxxxxxxxxxxx> wrote:
>
>  Hi Andrew,
>
>  there are quite a few things technically incorrect with what you are
>  attempting as well as a few which may indicate some conceptual issues as
>  well. There is a fairly steep learning curve for both Emacs and
>  emacspeak.  To further challenge you, Emacs is extremely flexible and
>  offers multiple ways to achieve the same outcome. While this flexibility
>  is great, it can be somewhat overwhelming initially.
>
>  The two main areas where I think you should focus initially are getting
>  proficient using the help and info systems. Emacs is extremely good when
>  it comes to documentation and help, but you do need to practice and get
>  to know the system to get the most out of it. Get familiar with the
>  options bound to the help ke, which is control H or C-h as it is often
>  referred to. In particular, C-h v for documentation on variables and C-h
>  f for documentation on functions. The C-h k and C-h b keys are very
>  useful for finding out about key bindings (sometimes referred to as key
>  shnortcuts).
>
>  While writing elisp code and setting variables in your init file is what
>  most experienced Emacs users prefer, there is also a high level and easy
>  to use customization interface called custom which is probably a much
>  better wsay to start customising Emacs when you are beginning. I would
>  recommend you start with that to begin with. However, I would also
>  recommend that you keep customisation to a minimum initially. Emacs and
>  to some extent, emacspeak, are a little unique and approach common
>  things from a somewhat different perspective. Often the temptation is to
>  customize things to make them ore familiar. However, this comes at a
>  cost in that you don't get to experience the 'emacs way', which sounds a
>  little wanky. However, many people, after perceivering with these alien
>  approaches end up finding them more superior to what they were
>  accustomed to. Therefore, I highly recommend using the system as vanilla
>  as possible for a time and start customising only after you have used
>  both Emacs and emacspeak for a time. You will also find that with the
>  increased understanding and familiarity this will create, when you do
>  customise things, they way you do it will be better, plus often you will
>  find there is no need to customise anything as the behaviour you wsant
>  is already there, you just need to enabgle it.
>
>  To get started, have a look at the Emacs info pages and in particular
>  the section on customisation and the easy customisation interface. You
>  can also try M-x customize or M-x customize-group <ret> emacspeak to get
>  just the emacspeak customisation group.
>
>  Finally, some specific comments regarding the settings in your init.el
>
>  > ;; trying to get org-agenda not to say ┄ a zillion times
>  I don't get bothered by this, but don't know if that is because of other
>  config settings I have or just due to my workflow being a bit
>  different. If you can, maybe just put up with it for a while and revisit
>  once you are more familiar wsith things. I suspect that once you are
>  better or more familiar with navigation and have applied some other
>  refinements to how org and the org agenda wsorks, this may no longer be
>  an issue.
>
>  >   (setq dtk-add-cleanup-pattern "┄”)
>
>  dtk-add-cleanup-pattern is not a variable, it is a function. You only
>  use setq to set variables. This aside, I don't think this is actually
>  what you want. However, because this is a function and because it is
>  bound to a key, you can execute it when in the agenda buffer to see if
>  it does what you wqant, just enter C-e d a and at the prompt, add the
>  character you want removed.
>
>  >   (setq emacspeak-use-icons nil)
>
>  For technical reasons which will likely cause more confusion at this
>  stage than help, this one is a bit tricky. I'm also not sure it is what
>  you really want. However, there is a command
>  emacspeak-toggle-auditory-icons which will reliably set this variable
>  for the current session. The command is bound to C-e C-a. Note that by
>  default, it toggles auditory icons in the current buffer. If you want to
>  toggle icons in all buffers, you need to call the command with the
>  universal argument, with is C-u, so the full command to toggle auditory
>  icons globally for the current session is C-u C-e C-a.
>
>  >   (setq emacspeak-character-echo nil)
>
>  This is unlikley to be what you want to do. This will turn off echoing
>  of the character as you type. Again, due to technical issues, setting
>  this variable directly with setq is unreliable (see below). Instead, you
>  can use the binding C-e d k to toggle character echo and again, provide
>  the universal argument to toggle it globally. 
>
>  >   (setq dtk-caps nil)
>  >   (setq dtk-punctuation-mode 'some)
>
>  The above have similar issues. The reason is a technical one. These
>  variables are what are referred to as buffer local variables. The
>  general concept is that they are variables which can have different
>  values in different buffers, but which start off with a common default
>  value. This makes them behave a little differently from other variables
>  and they need to be set using different mechanisms. I really don't want
>  to go into full on detail at this point as I fear you will be wading
>  into the wseeds and it will just make life much harder. Therefore, my
>  strong recommendation is either use the associated commands to toggle
>  these settings on a per session basis, possible adding the universal
>  argument to set them globally or use the M-x customize-group interface
>  to set the variables as this interface will ensure the variables are set
>  in such a way as to work correctly.
>
>  You do have a fairly steep learning curve to face on multiple levels. I
>  think the benefits are worth the effort, but be prepared for some
>  frustration and a lot of reading. I would also recommend reading Micky
>  Petterson's Mastering Emacs book https://www.masteringemacs.org/ . It
>  has a fairly good overview of the concepts and rationale underlying
>  Emacs. ueThe emacspeak info page is pretty good as well as Robert
>  Chassell's Introduction to Emacspeak. Finally, there is a fairly good
>  info page called An Introducton to Programming in Emacs Lisp which might
>  help with some of thye basic emacs lisp concepts as wsell as simple
>  programming.
>
>  HTH and good luck!
>  Emacspeak discussion list -- emacspeak@xxxxxxxxxxxxx
>  To unsubscribe send email to:
>  emacspeak-request@xxxxxxxxxxxxx with a subject of: unsubscribe


|Full archive May 1995 - present by Year|Search the archive|


If you have questions about this archive or had problems using it, please contact us.

Contact Info Page