aboutsummaryrefslogtreecommitdiffstats
path: root/yeetube-buffer.el
diff options
context:
space:
mode:
authorThanos Apollo <[email protected]>2023-09-30 00:23:43 +0300
committerThanos Apollo <[email protected]>2023-09-30 00:23:43 +0300
commitc0c228e39d604e23c862e3b8a978036543fa6597 (patch)
treeb065120c73930d48faa24feb647ee683586373a3 /yeetube-buffer.el
parent80a06f7db6e8677881da856babe3ba498eddff66 (diff)
[feature] Add yeetube-buffer-strip-emojis
Custom function that will be used to strip emojis from titles
Diffstat (limited to 'yeetube-buffer.el')
-rw-r--r--yeetube-buffer.el13
1 files changed, 11 insertions, 2 deletions
diff --git a/yeetube-buffer.el b/yeetube-buffer.el
index 80738c5..cfa0e93 100644
--- a/yeetube-buffer.el
+++ b/yeetube-buffer.el
@@ -31,12 +31,21 @@
(require 'yeetube-face)
-;; TODO: Fix titles with emojis (ruin formatting)
+
(defcustom yeetube-buffer-display-emojis nil
- "Display video title's emojis."
+ "Display video title's emojis.
+
+Emojis cause formatting issues, this should be off by default."
:type 'boolean
:safe #'booleanp
:group 'yeetube)
+
+(defun yeetube-buffer-strip-emojis (str)
+ "Remove characters which are part of the `emoji' script from STR."
+ (cl-remove-if (lambda (c)
+ (equal (aref char-script-table c) 'emoji))
+ str))
+
(defun yeetube-buffer-fix-title (title)
"Adjust TITLE."
(let ((replacements '(("&amp;" . "&")