Skip to content

How I am using moc #4

@gnusupport

Description

@gnusupport

Screenshot-2025-01-01-00-57-43-032381017

I have many such entries in the database, and I often want to see the entry in representative manner. For example a phone number, if I am calling can be nicely focused with moc and displayed on screen.

But maybe you remember my comment how long text is simply showing smaller and basically unreadable.

I have adapted some basic functions which of course could be improved, though this works for me now only for short text:

(defun rcd-db-tabulated-kill-value-show (&optional id)
  (interactive)
  (let* ((value (rcd-db-tabulated-value id))
	 (text (join-lines-1 value))
	 (text (break-lines-1 text 60)))
    (moc-focus :string value)))

The above is basic function which get the entry from the database and then uses moc-focus to display the entry. Lines are first joined, then broken (wrapped).

(defun join-lines-1 (text)
  (let ((fill-column (point-max)))
    (with-temp-buffer
      (insert text)
      (mark-whole-buffer)
      (fill-paragraph)
      (buffer-string))))

(defun break-lines-1 (text &optional my-fill-column)
  (let ((fill-column (or my-fill-column fill-column)))
    (with-temp-buffer
      (insert text)
      (mark-whole-buffer)
      (call-interactively 'fill-paragraph)
      (buffer-string))))

Those 2 functions make sure first to join the lines, then to break them. It works well and I get beautiful display of the entry. If the text is short, it is displayed as following:

Screenshot-2025-01-01-01-09-22-396217162

But problem is there when entry is too long! Even if lines are broken, it is displayed smaller and smaller, look here:

Screenshot-2025-01-01-01-09-54-595727953

I think this is due to how library moc processes the text. I can provide wrapped text for display, but cannot improve your library.

Could you please try to find out how to do it? 🤔💼🔍📘✨

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions