My Technical Notes

Tuesday, 15 March 2016

Emacs: Defining a command

First M-x Callable Command

Below is the first command I have implemented, which sets a variable to the maximum-valued integer:


(defun set-org-ascii-text-width-to-max ()
  (interactive)
  (setq org-ascii-text-width most-positive-fixnum))

It is callable using `M-x`.

Note that `setq` is just assignment (`=`, `<-`, `:=`) in other programming languages but the reason it is called `setq` instead of `set` is because otherwise the variable would need quoting:


(set 'org-ascii-text-width most-positive-fixnum)

References

No comments: