summaryrefslogtreecommitdiff
path: root/common.el
diff options
context:
space:
mode:
authorJSDurand <mmemmew@gmail.com>2023-01-06 23:35:46 +0800
committerJSDurand <mmemmew@gmail.com>2023-01-06 23:35:46 +0800
commita681e7f368cfd9294841b11d89bbe624b859272a (patch)
tree597188e46ffacaf5333cdaeecb5dc9359d42e2c7 /common.el
parentb947f76e79cffc2bbeda2bbf41605b9ed97d8a0b (diff)
ibuffer: Try to re-invent the wheel of exporting buffers to ibuffer.
Diffstat (limited to 'common.el')
-rw-r--r--common.el12
1 files changed, 12 insertions, 0 deletions
diff --git a/common.el b/common.el
index 94cbe3c..7da6129 100644
--- a/common.el
+++ b/common.el
@@ -474,6 +474,18 @@ If the length of LS is less than N, then return the whole LS."
((setq i n))))
(reverse result)))))
+;;; A helper function to remove the last non-cons-cell `cdr'.
+
+(defun remove-last-non-nil-cdr (arg)
+ "Remove the last `cdr' that is not a cons cell."
+ (let ((temp arg))
+ (while (consp temp)
+ (cond
+ ((consp (cdr temp)))
+ ((setcdr temp nil)))
+ (setq temp (cdr temp))))
+ arg)
+
(provide 'common)
;;; common.el ends here.