Skip to content

Commit

Permalink
show message Emacs' echo area but not log to *Message* buffer when ho…
Browse files Browse the repository at this point in the history
…vering links
  • Loading branch information
taquangtrung authored and manateelazycat committed Aug 31, 2021
1 parent e9c0833 commit cfb5832
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
3 changes: 3 additions & 0 deletions core/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,9 @@ def get_emacs_vars(args):
def message_to_emacs(message):
eval_in_emacs('eaf--show-message', [message])

def message_to_emacs_no_logging(message):
eval_in_emacs('eaf--show-message-no-logging', [message])

def clear_emacs_message():
eval_in_emacs('eaf--clear-message', [])

Expand Down
4 changes: 2 additions & 2 deletions core/webengine.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
from PyQt5.QtWidgets import QApplication, QWidget
from PyQt5.QtWebChannel import QWebChannel
from core.buffer import Buffer
from core.utils import touch, string_to_base64, popen_and_call, call_and_check_code, interactive, abstract, eval_in_emacs, message_to_emacs, clear_emacs_message, open_url_in_background_tab, duplicate_page_in_new_tab, open_url_in_new_tab, open_url_in_new_tab_other_window, focus_emacs_buffer, atomic_edit, get_emacs_config_dir, to_camel_case, get_emacs_vars
from core.utils import touch, string_to_base64, popen_and_call, call_and_check_code, interactive, abstract, eval_in_emacs, message_to_emacs, message_to_emacs_no_logging, clear_emacs_message, open_url_in_background_tab, duplicate_page_in_new_tab, open_url_in_new_tab, open_url_in_new_tab_other_window, focus_emacs_buffer, atomic_edit, get_emacs_config_dir, to_camel_case, get_emacs_vars
from functools import partial
from urllib.parse import urlparse, parse_qs, urlunparse, urlencode
import base64
Expand Down Expand Up @@ -294,7 +294,7 @@ def link_hovered(self, url):

if self.show_hover_link:
if url:
message_to_emacs(url)
message_to_emacs_no_logging(url)
else:
clear_emacs_message()

Expand Down
9 changes: 9 additions & 0 deletions eaf.el
Original file line number Diff line number Diff line change
Expand Up @@ -1093,6 +1093,15 @@ of `eaf--buffer-app-name' inside the EAF buffer."
"[EAF] %s")))
(message fmt format-string)))

(defun eaf--show-message-no-logging (format-string)
"A wrapper around `message' that prepends [EAF/app-name] before FORMAT-STRING
and does not log to the *Message* buffer."
(let ((fmt (if eaf--buffer-app-name
(concat "[EAF/" eaf--buffer-app-name "] %s")
"[EAF] %s")))
(let ((message-log-max nil))
(message fmt format-string))))

(defun eaf--clear-message ()
"Clear Emacs' echo area ."
(message nil))
Expand Down

0 comments on commit cfb5832

Please sign in to comment.