Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How I am using moc #4

Open
gnusupport opened this issue Dec 31, 2024 · 0 comments
Open

How I am using moc #4

gnusupport opened this issue Dec 31, 2024 · 0 comments

Comments

@gnusupport
Copy link

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? 🤔💼🔍📘✨

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant