help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: Need to know how to goto-column


From: Jean Louis
Subject: Re: Need to know how to goto-column
Date: Mon, 7 Dec 2020 09:37:33 +0300
User-agent: Mutt/2.0 (3d08634) (2020-11-07)

* Michael Heerdegen <michael_heerdegen@web.de> [2020-12-07 01:35]:
> Jean Louis <bugs@gnu.support> writes:
> 
> > (my-print-table-to-string '(("OK" "More")
> >                         ("One" "Two")) nil '(10 50))
> >
> > I have expected that above will give some aligned columns. Maybe you
> > have example how to use it?
> 
> I made it so that the last argument is expected to be a list of symbols
> left, right, centered (not numbers as you tried) - like in the example I
> had given:
> 
> #+begin_src emacs-lisp
(my-print-table-to-string
  '((1 "xx") (50 "yyy"))
  `(,#'number-to-string ,#'identity) ; how cols are formatted
  '(right right))                    ; col alignments
> #+end_src
> 
> Columns are always made as narrow as possible with the given strings.
> One could use the COL-FORMATTERS argument to add padding to a certain
> column (I guess I would use `format' for that).
> 
> Does that answer your question?  Would you prefer different
> semantics?

Thank you. When there is useful function in email there is custom
option in Mutt to quickly capture email message ID so that I may open
that email by from search at any time later.

This is what I was initially thinking of. You have included also
various options for format or call actions.

I have also discovered I could use tabulated-list-mode to print
columns in display buffer, let us say first 4-5 rows, and I can then
change the mode to something else.

(defun my-display ()
  (define-derived-mode my-mode tabulated-list-mode "Choice" "Choice Mode"
    (setq tabulated-list-padding 1)
    (setq tabulated-list-format  [("Title" 60 t) ("Button" 20 t)])
    (tabulated-list-init-header))
  (let* ((buffer "Choice")
         (buffer (get-buffer-create buffer)))
    (switch-to-buffer-other-window buffer)
    (my-mode)
    (setq tabulated-list-entries '((1 ["Something" ("Button" action (lambda (b) 
(message "Hello")) font-lock-face link follow-link t)])))
    (tabulated-list-print t)))

(progn
  (my-display)
  (tabulated-list-mode)
  (read-only-mode 0)
  (goto-line 3)
  (markdown-mode)
  (insert "\n\n## New text\n")
  (insert "\nMore text\n"))

This is because I just need such meta information at header of
displayed file. But I may as well hide it or provide more meta
information that user may see with TAB.

Additionally there is the fancy enriched mode that allows for all
kinds of Emacs Lisp expressions which could be used to
programmatically display information. 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]